We programmed a turtlebot to identify and follow (at a respectful distance) the object of its affection: a simple yellow disk.

We used the following in our project:

Hardware

  • Turtlebot
  • Astra Camera
  • Target object

Software

  • ROS Noetic
  • OpenCV (with ROS bridge)
Our equipment

Using Simultaneous Localization and Mapping

To complete the process, a ROS node subscribed to the image topic being published that contained video from the Astra camera. The feed was converted to be compatible with OpenCV so that it could be analyzed using computer vision.

Our workflow
In OpenCV we isolated the object by filtering the object for a narrow band of RGB values representing the colour of the disk, and then applying a mask to filter out any other colours. This allowed us to find and follow the object in real time.

To determine the appropriate RGB range we created a script that would output the upper and lower bounds of a colour that we selected in the image by clicking on it.

Determining the RGB range

A bounding box was placed around the image, the properties of which we used as a simple indicator to determine the object’s position relative to the robot.

Following the object visually with OpenCV

We used the properties of the bounding box (dimensions and center) to determine the relative distance and thus the required linear and angular commands for the robot.

Determining movement commands from bounding box

Using this process we were able to control the movement of the turtlebot by moving the yellow disc around. The turtlebot would approach the disk until a specific distance where it would stop, and would back up if the disc got too close.

However, the allure of a giant yellow garbage can proved to be too great and turtlebot was haplessly seduced. Tisk tisk, turtelbot, tisk tisk…