Calypso Module 2: Teleoperation

Learning Goal: In this module you will write your first Cozmo program. You will be using the "Let Me Drive" idiom, which allows you to control Cozmo using the game controller or keyboard.

What's An Idiom?

In human language, an idiom is a phrase that has a non-obvious, culturally-defined meaning. For example, "at the drop of a hat" is an English idiom that means "without hesitation". There aren't really any hats involved. Another example is "raining cats and dogs", which means "raining very heavily". The point is that idioms are understood as whole phrases; you don't need to pick apart the individual words.

In computer programming, an idiom is a familiar sequence of instructions that accomplishes a commonly-occurring task. Learning the idioms of a language makes the programmer's job easier because they can treat those instructions as "whole phrases" without having to think about the details of each word. Programming idioms are also sometimes called design patterns or computational thinking patterns.

Calypso has a set of idioms represented as flash cards for easy reference. Each idiom has a name, a description, and the Calypso rules that implement the idiom. Find the card for the "Let Me Drive" idiom we'll be using in this module. You can see that this idiom consists of a single rule, "WHEN gamepad DO move".


Creating a Program

Follow the steps in the previous module to wake up Cozmo and run Calypso. Now you're ready to create your first Calypso program.

Xbox Game Controller

  1. Calypso should be in editor mode, not execution mode. The screen should look like this:


  2. Pick up the game controller.

  3. You should see a robot icon in the top right corner of the screen (item A in the screen shot above). If you've accidentally switched to a different character (this cannot happen as long as you're in Novice mode) you can use the left and right D-Pad buttons to scroll through the characters and select the robot.

  4. You should be editing page 1 of the program: the number "1" should appear at the top of the screen, and the background should be light blue. See item B in the screen shot above. If you've accidentally switched to a different page (this cannot happen in Novice mode) you can use the left and right shoulder buttons (also called bumpers) to move to page 1.

  5. Use the left stick to move the pencil. Place the pencil on the "+" sign in the WHEN half of the rule, not the DO half. Then press the green A button on the game controller to bring up a tile menu. You can also use the mouse to click on the "+" sign and bring up the tile menu.

  6. Use the left stick to move the pencil to select the "gamepad" menu item, then press the green A button to confirm your selection. Or use the mouse to click on the "gamepad" tile.

  7. If you accidentally selected the wrong item, use the left stick to put the pencil on that tile, then press the green A button to bring up the tile menu again, and you'll be able to replace the tile. To delete a tile, use the blue X button, or the Delete key on the keyboard (Fn+Delete on the Mac).

  8. Move the pencil to the "+" sign in the DO half of the rule. Press the green A button and select the "move" tile from the menu.

  9. Check your rule against the flash card to make sure that it matches.

Running Your Program

To run your program, press the Back button on the controller or the backspace key on the keyboard.

As a safety precaution, Cozmo will not move while he's on his charger. So take him off the charger and place him on the table. You could also run him on the floor if you have a tile or wooden floor. He doesn't do as well on carpet.

Now use the left stick to drive Cozmo around. Notice that whenever the left stick is depressed, the rule you wrote lights up, indicating that the rule is "firing". This rule fires whenever you provide certain types of input via the gamepad, such as by moving the left stick.

Head and Lift Control

The "Let Me Drive" idiom can do more than drive Cozmo around. It also allows you to control his head angle and lift position.

Move the right stick up or down to adjust Cozmo's head angle. This can be useful when you want to look down at the space right in front of the robot, or up at a more distant object.

Move the right stick to the side does nothing, because Cozmo cannot turn his head left or right; he must turn his whole body. You use the left stick for that.

The shoulder buttons control Cozmo's lift. Use the left shoulder button to raise the lift, and the right shoulder button to lower it.

Cube challenge: The lift has hooks on it that can be used to pick up a light cube. See if you can maneuver Cozmo to pick up a cube, carry it somewhere, and put it down again.

Helping Cozmo Build His World Map

Cozmo is an autonomous robot, meaning most of the time he moves on his own; you don't have to drive him. But occasionally he needs a little bit of assistance, and that's what teleoperation is for. For example, we might want to make Cozmo aware of an object so he adds it to his world map. If we turn Cozmo so he sees the object, he will add it.

Try this exercise to help Cozmo build his world map:

  1. If your program is running (Calypso is in execution mode), press the Back button to stop it.

  2. Pick up Cozmo, hide the light cubes, and put him down again.

  3. Lay out the light cubes in various places behind Cozmo, so he can't see them.

  4. Press the Back button to run the program. Notice that the world map only has Cozmo in it.

  5. Now use the left stick to drive Cozmo, and the right stick to adjust his head angle, so that a cube comes into view. Notice that the cube now appears on the world map.

  6. Continue to guide Cozmo until he has added all the cubes to his world map. Now Cozmo knows where everything is, even when he can't see some things.

Congratulations: you've mastered teleoperation!

Review and Discovery

Do the Calypso Module 2 Review and Discovery activity to reinforce what you've learned.

Next Module

In the next module you'll learn how to make Cozmo move on his own to pursue an object.


Back to Calypso Curriculum overview.


Copyright © 2017 Visionary Machines LLC.