Skip to content

Latest commit

 

History

History
37 lines (23 loc) · 1.67 KB

README.md

File metadata and controls

37 lines (23 loc) · 1.67 KB

ball_tracker_project

MSR Hackathon project

Introduction

In this project, Python, ROS, and OpenCV were used to program a servo-controlled pan-tilt camera system that can track target objects.

Objective

To track a blue ball with a camera mounted on 2 servos that are commanded to move such that the ball stays in the center of the camera frame.

Ball Tracking

The ROS camera driver used to get a live video feed is supported by the usb_cam package. Once a feed is obtained, each image is converted to the HSV color space for better color segmentation using OpenCV. The centroid of the largest contour in each filtered image is determined and is passed along to the servo node.

Servo Control

With the centroid information passed to this node, the servos can be controlled such that the centroid is always in the center of the camera frame. The servos are mounted on a pan-tilt mechanism and are controlled through the Pololu Micro Maestro servo controller.

Implementation

Launch

launch.launch

Nodes

Ball Tracking Node

ball_tracker.py

Subscribed Topic: /camera_driver/image_raw

Published Topic: /center_position

Servo Control Node

motor_control.py

Subscribed Topic: /center_position

Click below to see a test in action. A blue ball is detected from the system.

IMAGE ALT TEXT