This project implements an object tracking system for a Turtlebot3 robot using the YOLO (You Only Look Once) algorithm. The system can detect and track objects of interest in real-time using a camera mounted on the robot. The project consists of two main components: image_processor and controller.
- Ubuntu OS
- ROS (Robot Operating System) installed
- Python 3
-
Clone the project repository:
git clone https://github.com/PouriaAzadehR/Object-Trakcer-Robot.git -
Install the required dependencies:
pip install numpy cv2 rosnumpy ultralytics torch -
Build the project:
cd turtlebot3_object_tracker catkin_make
The image_processor node is responsible for processing the camera images and performing object detection using the YOLO algorithm. It subscribes to the robot's camera topic and publishes the processed images with bounding box annotations. To run the image_processor node, execute the following command:
rosrun turtlebot3_object_tracker image_processor.py
The controller node is responsible for controlling the robot based on the detected objects. It uses a proportional controller to adjust the robot's angular velocity and follows the detected object. To run the controller node, execute the following command:
rosrun turtlebot3_object_tracker controller.py
The detection service is used to request object detection information from the image_processor node. It takes a label string as input and returns a response message containing information about the detected object. The response message includes the following fields:
exists(bool): Indicates whether an object with the specified label exists in the image.pos_x_in_pic(float64): X-coordinate of the object's center in the image.pos_y_in_pic(float64): Y-coordinate of the object's center in the image.bb_width(float64): Width of the bounding box around the object.bb_height(float64): Height of the bounding box around the object.pic_width(float64): Width of the image.pic_height(float64): Height of the image.
To request object detection information, you can call the detection service using the provided service client.
You can customize the project according to your specific requirements. Some possible modifications include:
- Modifying the YOLO model: You can use a different pre-trained YOLO model or train your own model for object detection.
- Changing the subscribed camera topic: Update the
camera_subscriberin theImageProcessorclass to subscribe to the desired camera topic. - Adjusting the control parameters: You can modify the angular velocity coefficient (
angular_vel_coef) and the tolerance value (e_l) in theControllerclass to achieve the desired tracking behavior.
Feel free to explore and adapt the project to meet your specific needs.
Contributions to this project are welcome. You can contribute by submitting bug reports, feature requests, or pull requests on the project repository.
- Ultralytics YOLO: The Ultralytics YOLO library is used for object detection and tracking.
- ROS: The Robot Operating System provides the framework for communication and control in this project.
For any inquiries or questions, please contact pouriazadeh81@gmail.com.
