Make sure you have the following installed:
- Ubuntu 22.04
- ROS 2 (Humble)
- Python 3.8+
- OpenCV
- cv_bridge (ROS2 image conversion)
- numpy
To install all of the dependencies use the following script by copying this:
sudo apt install software-properties-common -y && sudo add-apt-repository universe && sudo apt update -y && sudo apt install curl python3-pip -y && sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null && sudo sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - && sudo apt update && sudo apt upgrade && sudo apt install ros-humble-desktop ros-dev-tools ros-humble-xacro ros-humble-gazebo-ros-pkgs git -y && pip install --upgrade pip && pip install opencv-python-headless
git clone https://github.com/peytonlynnbarnes/sec_bot.git
cd sec_bot
source /opt/ros/humble/setup.bash
colcon build --symlink-install
source install/setup.bash # make sure to source /opt/run/ros/humble/setup.bashTo run the simulation run the following 4 commands in separate terminals. (Don't forget to bash source install/setup.bash in all terminals)
# runs Gazebo simulation, robot state publisher, and spawn entity for ease in testing.
ros2 launch sec_bot launch_sim.launch.py# launches image_subscriber that directly subscribes to /camera/image_raw
ros2 launch ball_tracker sim_cam.launch.py# runs script that masks processed images and publishes /ball_position topic
ros2 run ball_tracker sim_multi_ball_tracker# runs script that subscribes to /ball_position and publishes to /cmd_vel to follow ball
ros2 launch ball_tracker follow_ball.launch.pyThis project is a robot created using ROS2 by the IEEE SEC 2025 Hardware Competition Team designed to use a camera and motor controllers to track and follow purple dice on a field, as well as pick up 2 boxes to sort the dice into.
This package contains the robot description as well as related launch files.
inertial_macros : This contains inertial macros for the robot_core including inertial_box, inertial_cylinder, and inertial_sphere.
robot_core : This contains the simulated robot's parameters and structure.
gazebo_control This contains differential drive parameters for the robot to move in Gazebo.
camera.xacro This contains the camera specifications for the simulated camera in Gazebo.
rsp.launch.py : Launches robot state publisher
launch_sim.launch.py : Runs Gazebo simulation, robot state publisher, and spawn entity for ease in testing.
This package contains the ball tracking and following files as well as related launch files.
image_publisher : publishes images from camera to ros topic. image_subscriber : subscribes to topic to receive and process images.
multi_ball_tracker : uses OpenCV to mask processed images and publish coordinates of purple objects. Publishes to /ball_position topic and subscribes to camera/image_raw topic.
sim_multi_ball_tracker : uses OpenCV to mask processed images and publish coordinates of purple objects. Publishes to /ball_position topic and subscribes to simulated camera/image_raw topic.
follow_ball : receives ball position from /ball_position topic and publishes robot liner and angular speed to /cmd_vel to follow ball.
camera.launch.py : launches image_publisher and image_subscriber nodes
sim_cam.launch.py : launches image_subscriber that directly subscribes to /camera/image_raw
follow_ball.launch.py: launches follow_ball script