15-494 Cognitive Robotics
Spring 2012
 Course Links:  Main Lectures Labs Homeworks Tekkotsu Links:   Wiki Tutorial Resources Bugs CVS Reference:

# Cognitive Robotics: Lab 3 & Homework 2

## Part I: The Pilot and Odometry

Remember at the start of every lab to do a "make" on your workstation and then do "sendtekkotsu" so your robot is running the latest version of the software. We will do this lab using tekkotsu-CREATE. Please finish this part using the robot instead of Mirage.
1. Write a three-state state machine called StarLeg that causes the robot to first travel forward by 750 mm, then turn right by 144°, and then post a completion event using a PostMachineCompletion node. You will need this completion event for the next step.

2. Write a state machine Star5 that calls the StarLeg state machine (nested inside it) five times, causing the robot to execute a trajectory in the shape of a five-pointed star. Make Star5 a child of PilotDemo, and name your first state node rundemo so it shows up in the PilotDemo menu.

3. Start the Star5 behavior, then bring up the world map by clicking on "W" in the Sketch row of the ControllerGUI. Note that the Agent shape (the robot) starts out at (0,0) with heading 0.

4. Note the initial position and heading of your robot. Type "msg rundemo" to start the robot on its trajectory. If the robot moves perfectly, it should end up back at its starting pose. Where does the robot actually end up?

5. Hit the Refresh button in the SketchGUI and record the Agent's estimated position and heading. How closely do they match the robot's actual pose? How far have the localization particles dispersed?

6. Double click on Star5 to stop the behavior. When you start it again, the robot's pose will again be initialized to (0,0) with heading 0°. Run the behavior four more times and record the robot's estimated position and heading at the end of each run. Report the values for all five runs in a table and also give the mean and the standard deviation. Hand in this table as part of your lab report, along with your code.

## Part II: Mirage and the VeeTags Demo

1. Run Mirage by following the instructions on the wiki's Running Mirage page, but use the VeeTags world instead of the tic-tac-toe world.

2. Try flying around in the world using various commands from the Mirage Command Summary page.

3. Run the VeeTags demo in Root Control > Framework Demos > Navigation Demos > VeeTags. Drive the robot around for a bit and then use the PilotDemo's "loc" command to localize. Watch what the particles do. Note: the Pilot wants to see at least two landmarks in order to localize. If you leave the robot in a position where two landmarks are not in view, the Pilot will turn the robot to try to find more landmarks.

4. Write a behavior that uses a series of walk requests to circumnavigate the vee-shaped barrier. You don't have to use any vision for this; just assume that the robot starts at (0,0) facing north, and code up a trajectory to get the robot around the barrier and back to its starting position. Have the behavior print out the robot's estimated position and heading at the end of this trajectory. Then your behavior should use the Pilot's localize operation to update its position and heading estimates, and print out the updated values. How does localization affect the estimates? Manually calculate the distance between the robot's position estimate before and after localization. Run your behavior five times and hand in a table of your results showing the initial position and heading estimates, the updated estimates, and the differences between them.

## Part III: The Mirage World Builder

If you have time, you should start this part in the lab. Finish it for homework. Your answers should be turned in as Homework 2, due Friday, February 10.

1. Visit the web page for the 2012 ARTSI Robotics Competition and scroll down to the description of the Object Pushing Event. In this part of the lab you are going to contribute something to help the students working on this event.

2. Construct a Mirage world that will allow students to solve this event using the Mirage simulator. You world must contain a square drawn with blue lines, and five red cylinders randomly positioned outside the square. Be sure to set appropriate vallues for the collision and mass attributes.

3. Do a cd to ~/project/ms/config and rename the file Create.kin to Create.kin.original. Then download the file CreatePusherBar.kin and rename it to ~/project/ms/config/Create.kin. Run Tekkotsu with Mirage and notice that your simulated robot now has a pusher bar attached to it.

4. One of the Create robots in the lab has a set of aluminum paddles bolted to it, like the ones shown on the competition web page. Edit the Create.kin file to change the pusher bar to a pair of paddles, matching the size and position of the physical paddles as best you can. You do not have to model the entire 3D paddle structure, just the one big rectangular segment that does all the work. Note: search for "pusher" in the .kin file to find where the pusher bar is defined.

5. Try driving the robot around in your competition world (you can use the Walk Controller for this since we don't care about good odometry) and use the paddles to push the red cylinders into the square.

6. The robot always starts in Mirage at location(0,0), facing north. Using the PilotDemo commands to preserve odometry, you could drive the robot until it is positioned with a red cylinder in its paddles. Now, since you know where the center of the blue square is located, all the robot needs to do is turn towards the square and then move forward for an appropriate distance. Since odometry tells us the robot's present position (see the Pilot lecture notes for how to retrieve this information), it is easy to calculate in the doStart() method of a PilotNode the turn angle and distance required to reach the center of the square. Write a behavior to do this. You start the behavior with the robot in its initial position (use the Mirage "r" command to reset the world if necessary). You use PilotDemo commands to guide the robot to a red cylinder. Then you give the "rundemo" command to start your state machine and it should push the cylinder into the square.

## What to Hand In

Hand in your source code for all the above problems, plus the two tables of statistics, the .ian file for your Mirage world, your modified Create.kin file, and a screen shot showing your robot with its simulated paddles.

Dave Touretzky and Ethan Tira-Thompson