Calypso Module 2: Teleoperation
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 ProgramFollow the steps in the previous module to wake up Cozmo and run Calypso. Now you're ready to create your first Calypso program.
Running Your ProgramTo 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 ControlThe "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 MapCozmo 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:
Review and DiscoveryDo the Calypso Module 2 Review and Discovery activity to reinforce what you've learned.
Next ModuleIn 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.