This repository contains the Go Chase It project from the Udacity Robotics Software Engineer Nanodegree.
In this project, a differential-drive robot is spawned in Gazebo with a camera and lidar. A C++ perception node analyzes camera images to detect a white ball and commands the robot to chase it through a ROS service.
chase-it.mov
- Added perimeter boundary walls in the active world to keep the simulation fully enclosed.
- Lowered white-ball detection threshold from 255 to 200 for more reliable detection under varied lighting.
- Improved
process_imagecontrol logic to use centroid-based steering and smoother velocity commands while approaching the ball.
The workspace includes these ROS packages under catkin_ws/src:
my_robotball_chaser
The my_robot package contains the robot model and simulation world setup.
Completed work:
- Built a differential-drive robot using URDF/Xacro.
- Added two sensors: camera and lidar.
- Added Gazebo plugins for:
- Differential drive control
- Lidar sensor
- Camera sensor
- Added launch files to load the robot description and start Gazebo world simulation.
The ball_chaser package contains service definitions and C++ nodes for chasing behavior.
Completed work:
- Created
DriveToTarget.srvservice. - Implemented
drive_botnode:- Provides
/ball_chaser/command_robotservice. - Receives requested
linear_xandangular_zvalues. - Publishes velocity commands to
/cmd_vel. - Returns feedback with commanded values.
- Provides
- Implemented
process_imagenode:- Subscribes to
/camera/rgb/image_raw. - Detects white pixels corresponding to the white ball.
- Determines whether the ball is left, center, or right in the image.
- Calls the service client to steer robot toward the ball.
- Subscribes to
- Added
ball_chaser.launchto run both nodes:drive_botprocess_image
go-chase-it/
catkin_ws/
src/
my_robot/
ball_chaser/
From the project root:
cd catkin_ws
catkin_makeSource the workspace:
source devel/setup.bashOpen terminal 1 and launch the world and robot:
cd catkin_ws
source devel/setup.bash
roslaunch my_robot world.launchOpen terminal 2 and start ball-chasing nodes:
cd catkin_ws
source devel/setup.bash
roslaunch ball_chaser ball_chaser.launch- The robot camera detects the white ball.
- The
process_imagenode detects bright ball pixels (threshold 200) and computes the ball centroid in the image. - The node requests
/ball_chaser/command_robotservice. - The
drive_botnode publishes smooth linear and angular commands to/cmd_vel. - The robot steers proportionally toward the ball, slows while turning, and stops if the ball is not visible.