CSCI 445 - Capture The Flag

The goal of this lab is to create a robot that can play a simplified game of "Capture the Flag."

Traditional Capture the flag is an outdoor game with 2 teams, who each have a flag located at their base (opposing sides of the field). The goal is to capture the other team's flag by running across the field, grabbing the flag, and running back to their team's area without getting caught by the flag's defenders.

Field Layout

A simplified game of Capture the Flag consists of:


Picture of the Arena


A 'Flag'   


IR Transmitter

Rules of the Simplified Game

In a game of Capture the Flag, you and the robot will do the following:

You will:

The robot will:

  1. Move around until it finds the IR sensor, then head in that direction
  2. Search for a bright orange ball using the camera
  3. Head in the direction of the ball
  4. "Pick up" the ball [this will be discussed later]
  5. Head into the corner marked off by masking tape
  6. Drop the ball
  7. Repeat steps 2-7 based on how many balls are left in the arena
  8. Stop

Robot Subsystems

In order to perform the tasks listed above, you will have to design several robot subsystems.

Communication

Your robot will need to seek the IR sensor placed in the side of the arena.

     

Vision

Your robot will need to track the location of the orange ball and move the robot so that it is facing the ball.

A suggestion is to have the robot move around in a predefined pattern until it sees orange, then head towards the orange until it's area exceeds a predetermined variable. Once this happens, activate the manipulator to grab the ball.

     

Manipulation

Your robot will need to "pick up" the ball so that it can move it to the corner.

This can either be a motor providing backspin to the ball, claws grabbing and holding the ball, a cage which closes on top of the ball, etc...

     

     

Localization

Your robot will need to utilize sonar and compass to move to the taped-off corner, and drop the ball. Note that the back of the room is facing north (this should be helpful in determining robot direction).

You may choose to put the sonar and/or compass on a servo so it may be rotated as needed.

     

Robot Components

This section describes how to use the components of this project. The pictures are only samples; you will probably have to place your components differently based on your design.


Camera

The camera is used to track the position of the orange ball.

Info can be found here: http://www-2.cs.cmu.edu/~cmucam/Publications/iros-2002.pdf

To set up the camera, you will connect the camera into one end of a splitter, the handyboard into the other end. The splitter output will go to your computer. Then, load the CMUCam software.

You will want to set the colorspace (in the 'image modes' option on the left) to: YUV WB On (enabling white balance)

Then, you will download a camera frame to the screen (via 'commands->dump frame' in the menu)

You can select the tracking options (in the 'commands->track color' menu) to search for red, green, and blue values (highlight the orange ball in on your camera output to view the RGB values of the ball)

Once you type in the RGB values you want to search for, click "Set Camera Regs" to save the information.

If you want to test your settings, click 'commands->track window' menu and a green blob will appear where the camera tracks your specified colors.

Then disconnect the camera from the computer, and plug it back into the Handyboard.

IR Sensor

The infrared sensor is used to communicate to find the signal emitted by the IR transmitter located on the side of the arena.

For information on the IR sensor, read sections 6.2.1 and 6.2.6 of your "Robotic Explorations" book.

 

 

 


Compass

The compass can be used to store the current direction of the robot in a variable. The values are between 0-360.

Compass: info, code, library

Sonar

The Devantech sonar device is used to measure distances to obstacles (in our case, the distance between the robot and the wall).

For more information about the sonar device (sample code and Handyboard connection information), visit the webpage.

Servo

The servo is a motor which can be rotated in different angles based on your programming. For this project, you can use the servo to move the sonar, compass, or anything you want.

When connecting the servo to your expansion board, you MUST connect the black wire facing the outside. If you reverse the connection, you risk destroying the servo.

The code for programming the servo is listed here.

(also see section 4.4 of your book).

Hints on using the Sonar:

  • Experiment with the servo motor and position it in different angles (For more information about how to work with servo motor, refer to the Appendix of the Lab Manual).
  • Find out the Maximum and Minimum Values that the servo can have for rotation (remember the this servo motor can only rotate 180 degrees).
  • Find a relationship between the values that the servo takes and the angle in which it rotates (for converting the servo values to angles).
  • Write a program to position the servo motor in different positions using the knob on the Handy Board.
Relay

The relay--basically an electronic switch--is necessary so that the Handyboard can recieve both the sonar and compass outputs. Here is a schematic of how to connect all the devices together. Note that we use a Digital output port to activate it and the relay requires an external battery with and SPST relay to provide enough current. This added complication can be avoided by using an SPDT relay with lower current requirement or by using the current from the motor port.

The type of relay you want to purchase is the following:

SPDT Miniture PC Relay
12 VDC Coil, 10A at 120 Vac/24 DC

Radio Shack Part Number # 275-24

Pictures


Sample Final Robot

Designed Spring 2005: Webmaster: Brian Marquez - Photography: Ryusuke Kodama

The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees