Once you have an appropriately calibrated colorfile, the cmvision blobfinder will be able to detect color blobs. This process can be used to color calibrate a variety of cameras both in real and simulated environments. However, your colorfile will likely work only for cameras and lighting conditions similar to those used at the time of calibration.

Once you have an appropriately calibrated colorfile, the cmvision blobfinder will be able to detect color blobs. This process can be used to color calibrate a variety of cameras both in real and simulated environments. However, your colorfile will likely work only for cameras and lighting conditions similar to those used at the time of calibration.

-

+

* Stop colorgui and use [http://www.ros.org/wiki/roslaunch roslaunch] to start cmvision and see the image stream with recognized blobs:

-

* Stop colorgui and start cmvision to see the image stream with recognized blobs:

Important Dates

Assigned: Sept 18, 12:01am, 2010

Due: Sept 26, 11:59pm, 2010

Description

Building on your Enclosure Escape assignment, you will build a controller in ROS to perform "object seeking". In this seeking task, your robot will perceive and drive to objects that are visually recognizable by a solid color appearance or labeled with an AR tag from the robot's visual sensing (i.e., camera). For this assignment, you will be working primarily with the Create platform and a Sony PlayStation Eye USB video camera. For object recognition in ROS, you will use the cmvision package for color blobfinding and the ar_recog package for AR tag recognition.

Assuming perception of objects salient by color or pattern, you will develop an object seeking package for this assignment that enables a robot to continually drive between these (non-occluded) objects in a sequence given at run-time. Your controller's decision making should take the form a finite state machine (FSM). This FSM should use one state variable to specify the currently sought object. For motion control, you should use proportional-derivative (PD) servoing to center objects in the robot's field of view. As a whole, your controller should put the current object in the center of view, drive as close as possible to an object without hitting it, increment the state variable, and continue the process for the next object.

ROS support packages

Based on the GStreamer multimedia framework, gscam package provides direct access to the robot's camera image and related parameters. support for a variety of cameras, although not as intuitive as other ROS camera interfaces. While laser rangefinders provide more accurate information, cameras are often more practical in terms of their cost, weight, size, and sampling frequency. Cameras have the additional benefit of sensing color, which you will leverage in this assignment.

Based on the CMU CMVision library, the cmvision package performs segmentation of solid colored regions (or "blobs") in an image, reported as bounding boxes. cmvision proxy thresholds and groups pixels in an images based on given YUV color ranges to estimate blobs. To calibrate color ranges, the colorgui node is include within cmvision to build color ranges from selected pixels in published image topics.

Based on the ARToolkit augmented reality library, ar_recog recognizes augmented reality tags in an image. ar_recog publishes various information about recognized tags, such as its corners in image space and relative 6DOF pose in camera space.

Running gscam and image_view

Note: this command only needs to be run after you plug in the camera, not every time you want to run something that uses the camera.

In this class, we will use mode 04 for the PS3 camera to ensure image resolution and frame rate sufficient for object recognition. More information about installing the PS3 cam driver and other camera modes is available from Trevor Jay's rough PS3/Ubuntu guide.

The course staff has already installed PS3 cam support on our robots. run_ps3cam.sh is a simple bash file that communicates video settings to the camera:

guvcview should produce a graphical interface, as shown below. Make sure "whitebalance" and "autogain" settings are turned off. If your camera is mounted upside down, guvcview can set the camera driver to flip the image feed vertically. Close guvcview once you have changed the camera settings, and avoid conflicts with gscam.

Run gscam to start camera driver

> roscd gscam/bin
> rosrun gscam gscam

To view camera's image stream, start the image_view node with this command:

> rosrun image_view image_view image:=/gscam/image_raw

If successful, you should see a new window emerge displaying the image stream from the robot's camera, example below. Stop image_view with the ctrl-c command in the terminal before proceeding

Color Calibration

For color blobfinding, ROS uses the CMVision library to perform color segmentation of an image and find relatively solid colored regions (or "blobs"), as illustrated below. The cmvision package in ROS consists of two nodes: colorgui to specify (or "calibrate") colors to recognize and cmvision to find color blobs at run-time. Both of these nodes receive input from the camera by subscribing to an image topic.

The blobfinder provides a bounding box around each image region containing pixels within a specified color range. These color ranges are specified in a color calibration file, or colorfile, such as in the "colors.txt" example below. cmvision colorfiles contains two sections with the following headers:

"[Colors]" section: a list identifiers for each blob color, as strings and RGB triplets, in sequential order

In this colorfile, the color "Red" has the integer identifier "(255,0,0)" or, in hexidecimal, "0x00FF0000" and YUV thresholds "(25:164,80:120,150:240)". These thresholds are specified as a range in the the Wikipedia YUV color space. Specifically, any pixel with YUV values within this range will be labeled with the given blob color. Note: that YUV and RGB color coordinates are vastly different representations, you can refer to the Wikipedia YUV entry and the Appendix for details.

To calibrate the blobfinder, you will use colorgui to estimate YUV color ranges for objects viewed in the camera's image stream. These color ranges will then be entered into your own colorfile for use by the cmvision node. Start by running colorgui, assuming gscam is publishing images:

> rosrun cmvision colorgui image:=/gscam/image_raw

The result should pop up a window displaying the current camera image stream, just like image_view did.

The colorgui image window can now be used to find the YUV range for a single color of interest.

Using colorgui image window, you can calibrate for the color of specific objects by sampling their pixel colors. Put objects of interest in the robot's view. Mouse click on a pixel in the image window. This action should put the RGB value of the pixel into the left textbox and YUV value in the right textbox. Clicking on another pixel will update the output of the terminal to show the pixel's RGB value and the YUV range encompassing both clicked pixels. Clicking on additional pixels will expand the YUV range to span the color region of interest. Assuming your clicks represent a consistent color, you should see bounding boxes in the colorgui window represented color blobs found with the current YUV range.

As an example, cjenkins calibrated himself as illustrated in the screen capture sequence below. The sequence shows (top row) colorgui when it first starts, after selecting 4 pixels with mouse clicks, and 8 pixels. After 12 mouse clicks (bottom row), he considered the calibration sufficient (although he probably over sampled) and had the blobfinder track him as he moved side to side.

Note: you may not want to click on all pixels of an object due to shadowing and specular ("shiny") artifacts.

Once you have a sufficient calibration for a color, copy the YUV range shown in the colorgui textbox (or output to the terminal) to a separate text buffer temporarily or directly enter this information into your colorfile. You can restart this process to calibrate for another color by selecting "File->Reset" in the colorgui menu bar.

Once you have an appropriately calibrated colorfile, the cmvision blobfinder will be able to detect color blobs. This process can be used to color calibrate a variety of cameras both in real and simulated environments. However, your colorfile will likely work only for cameras and lighting conditions similar to those used at the time of calibration.

Stop colorgui and use roslaunch to start cmvision and see the image stream with recognized blobs:

Disclaimer: The calibration process is not always easy and may take several iterations to get a working calibration. Remember, the real world can be particular and unforgiving. Small variations make a huge difference. So, be consistent and thorough.

Seeking a Individual Objects

Within this package, create "nodes/object_seeking.py" (or similar file in the client library of your choice)

object_seeking.py should subscribe to XX and publish XX topics

write code for object_seeking.py to distinguish and move to the following objects with the following integer order identifiers (Note, these do not necessarily need to be identifiers in the colorfile):

Yellow ball

Green over orange fiducial

Orange over green fiducial

Pink fiducial

Alpha AR tag

...

NOTE: Describe the .msg files, and what their controller should be subscribing to

Given appropriate color calibration, recognizing single solid color and AR tag objects should be straightforward. However, fiducials used in robot soccer to indicate specific locations on the field may have multiple solid colors. For example, the camera image in Figure XX has two solid colors stacked in a vertical order with similar shape dimensions. In such cases, your controller will need to specifically include perception routines to process the output of the blobfinder for multicolor fiducials.

Seeking a Sequence of Objects

Given a specific ordering (via file or command line; rosparam??), your client should drive the robot to visit each of the given objects continuously in this order. For example, the given ordering [3 1 2 4] should direct the robot to visit the green/orange fiducial, orange/green fiducial, yellow ball, pink fiducial, green/orange fiducial, etc. A finite state machine is a good choice for controlling this decision making. A proportional-derivative feedback controller with a form of wandering is a good choice for motion control.

Experiments, Reporting, and Submission

You are expected to conduct least 3 trials for 3 different object sequences with 3 different initial conditions (27 trials total). For each trial, measure total time taken to visit each object and number of collisions with objects, and estimate average distance the robot approaches objects. All of your trials must use the same controller without modification.

Document your controller and experimental results in a written report based on the structure described in the course missive. You are welcome to experiment with additional enclosure escape algorithms and evaluate the relative performance of each. When completed, your report should be committed to the object_seeking/docs/username directory of your repository.

Grading

Your grade for this assignment will be determined by equal weighting of your group's implementation (50%) and your individual written report (50%). The weighted breakdown of grading factors for this assignment are as follows:

Project Implementation

Color calibration 20%

Is your color calibration file suitable for finding objects in the Roomba Lab?

What are the restrictions (camera pose, lighting, etc.) on your color blobfinding?

Seeking a single object 15%

Does your robot find, center, drive to non-occluded objects?

How close does your robot get to sought objects?

Transitioning between objects 8%

Does your robot properly switch to other objects after visiting an object?

Controller Robustness 7%

Does your controller run without interruption?

Written Report

Introduction and Problem Statement 7%

What is your problem?

Why is it interesting?

Approach and Methods 15%

What is your approach to the problem?

How did you implement your approach and algorithms?

Could someone reproduce your algorithms?

Experiments and Results 20%

How did you validate your methods?

Describe your variables, controls, and specific tests.

Could someone reproduce your results?

Conclusion and Discussion 8%

What conclusions can be reached about your problem and approach?

What are the strengths of your approach?

What are the shortcomings of your approach?

Appendix: RGB-YUV Conversions

The color conversion routines used by CMVision for blobfinding are below: