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: Account Setup (Second Step)

You will only have to do this once.
  1. Log in to a lab workstation using your Andrew userid and password.

  2. Open a gnome-terminal by typing alt-control-T.

  3. Run the second account setup script by typing this command in your terminal window:
    $ ~/Class/utils/setup-account2

Part II: 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 III: Running Your Code on the Robot

  1. 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.rel
    or, if you've already done sendtekkotsu once today, use sendmycode:
    > sendmycode 128.2.xxx.yyy

  2. 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.rel". Notice that the prompt on the robot is red, while the prompt on the workstation is green. This helps you tell them apart: "red for robot".
  3. Run Tekkotsu on the robot by typing:
    > cd ~/project > ./tekkotsu-CALLIOPE2SP
  4. In a third tab, start a ControllerGUI by typing, e.g., "ControllerGUI artsi-calliope3.rel". Note that you can just type "Con" and hit the [Tab] key and the shell will auto-complete.

  5. 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.

  6. 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.

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

Part IV: 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 neutral 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 V: 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 30.

Part VI: Troubleshooting