15-494/694 Cognitive Robotics: Lab 2

Learning Goal: This lab will teach you how to compile a Tekkotsu state machine on the workstation, transfer it to the robot, and execute it there.

Part I: Compiling a State Machine

  1. Enter the code from the first example in the State Machines Lab on the Tekkotsu wiki. Put this code in your ~/project directory under the name Example1.cc.fsm.

  2. Compile the code by typing "make" in your ~/project directory.

  3. Visit the State Machines wiki page when you want to learn more about state machine syntax and programming techniques.

Part II: Running Your Code on the Robot

  1. Unplug the robot from the charger and power it up.

  2. Each day when you use the robot, you should begin by uploading a fresh copy of the Tekkotsu libraries using the sendtekkotsu script, in case there have been any overnight additions or bug fixes. The script also uploads your executable file tekkotsu-CALLIOPE2SP. Once you've done this, if you update your code and need to ship it to the robot again, you can use the sendmycode script, which is much faster. With either script, you must supply the name or IP address of the robot: Example:
    > sendtekkotsu artsi-calliope3
    or, if you've already done sendtekkotsu once today, use sendmycode:
    > sendmycode artsi-calliope3

  3. Type control-shift-T in the terminal window to open a new tab. Then ssh into the robot by typing, e.g., "ssh user@artsi-calliope3". Notice that the shell prompt on the robot is red, while the prompt on the workstation is green. This helps you tell them apart: "red for robot".

  4. Run Tekkotsu on the robot by typing:
    > cd ~/project > ./tekkotsu-CALLIOPE2SP
  5. In a third tab, start a ControllerGUI by typing, e.g., "ControllerGUI artsi-calliope3". Note that you can just type "Con" and hit the [Tab] key and the shell will auto-complete.

  6. Make sure the volume on the robot's netbook is turned up all the way.

  7. In the ControllerGUI, go to Root Control > User Behaviors > Example1. Double click on the behavior to run it. Try pressing the bump switch or the play button in response to the bark sound. Also try not pressing it. What happens in each case? Click on the behavior name again to deactivate it.

  8. Go to Root Control > Status Reports > Event Logger and select buttonEGID, stateMachineEGID, and stateTransitionEGID. Run the behavior and look on the Tekkotsu console to see the events scroll by.

  9. Now compile and run the Example2 behavior from the State Machines Lab.

Part IIII: Powering Down

  1. Stop Tekkotsu by typing control-D or "quit" in the terminal window.

  2. Press the power button on the Create and the LEDs should all go out.

  3. Move the slide switch on the servo controller board back to the off position, shutting off servo power and extinguishing the system power light. (This is because we don't want to energize the robot's servos while it's on the charger.)

  4. You can leave the netbook powered up; make sure it is plugged in to its charger, then close the lid.

  5. Plug in the Create's charger cable.

Part IV: Homework (Start It In Class)

  1. Read the Storyboard Lab to learn how to use the Storyboard tool.

  2. Do the three State Machine Exercises on the Tekkotsu wiki. You may do these alone, or in teams of 2, your choice.

  3. Collect your fsm files, Storyboard files, and screenshots of your Storyboard displays into a zip file, and send it to dst@cs.cmu.edu. (You can use gnome-screenshot or gimp to take a screenshot.) If you worked as a team, include the names of both team members in your code. Due: Friday, January 29.

Part V: Troubleshooting