Skip to content

Camera Ball Tracking project done by students during the Hackathon for the MSR program at Northwestern

Notifications You must be signed in to change notification settings

mechwiz/camera_pak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Camera Ball Tracker

Michael Wiznitzer

Northwestern University MSR Hackathon (Fall 2017)

Introduction

Objective

To track a red 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 upper and lower HS bounds for the red color were determined experimentally and can be adjusted using trackbars if need be to take into account different lighting conditions. 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. For smooth motion, each servo position is updated with a small increment or decrement followed by a very small time delay.

Implementation

Launch

camera_trak.launch

Nodes

Ball Tracking Node

camera_pak_node.py

Subscribed Topic: /usb_cam/image_raw

Published Topic: /center_point

Servo Control Node

servotrack_node.py

Subscribed Topic: /center_point

Demo

GIF Video

A video of the ball tracking in action can be seen below.

balltracker.gif

About

Camera Ball Tracking project done by students during the Hackathon for the MSR program at Northwestern

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published