Activity: First Law
In this exercise, students will be exploring Cozmo's visual
perception/recognition and the First Law of Calypso.
Part 1: Basic Vision
Run Calypso. Start out with an empty program.
Make the camera viewer as big as possible (size 2X) and move
it to a convenient location. (To adjust the camera viewer, use
the mouse to put the cursor into the camera viewer window to
make the title bar appear; then click and drag on the title
bar. See video.)
Show the robot one cube and note its presence in the camera viewer.
If you cover part of the cube with your finger, Cozmo can no
longer recognize it: the yellow outline disappears. How much
of the cube can you cover before Cozmo can't recognize it? Do
some parts matter more than others?
Cozmo is a bit near-sighted. If the cube is too far away, he
won't recognize it. Try moving the cube back until Cozmo can
no longer see it. If you move it a little closer, he should be
able to see it again.
Using a ruler or tape measure, figure out how far the cube can
be before Cozmo loses sight of it.
Part 2: The World Map
Enter execution mode (press the Back button on the controller).
Show Cozmo a cube and notice that it appears on the world map.
Slide the cube around and note how it moves on the world
map. Make sure your fingers don't cover the front of the cube;
you want Cozmo to always be able to see it.
Rotate the cube and note how it rotates on the world map.
Put your hand in front of Cozmo's face to block his view. Notice that the cube goes gray, indicating that he cannot see it. But he still knows it's there, because it's on his map.
Gently move or rotate the cube slightly while the robot's view is blocked. Then remove your hand and notice that the world map updates automatically.
Tap on a cube and notice that it "bounces" in the world map.
Pick up the cube and put it down outside of Cozmo's field of view. Notice that the cube disappears from the world map and goes into the "dock" in the top right corner of the screen.
Put the cube back in front of Cozmo and it will reappear on the world map.
Part 3: Seeing Cubes
Set up the two FirstLaw pages as shown in the figure and tape them to the table.
Put Cozmo on his charger.
Run the FirstLaw demo. (If you are reading this page in a web browser and have Calypso running, you can click on the
and the program will be automatically be loaded into Calypso.) The program starts out with a single rule: "WHEN see cube DO".
Put a cube in square A.
In the world map you will see a red line called an Line of Sight (LOS) indicator. It shows you which cube Cozmo is paying attention to.
Put another cube in square E.
The "WHEN see cube DO" rule will pick one of the cubes, so only one cube will have the LOS indicator pointing to it. Which one? Have students discuss this.
- The rule sticks with whichever cube it saw first.
- The rule always picks the rightmost cube.
- The rule always picks the closest cube.
- The rule picks a cube at random, but sticks with it.
Try moving the cubes to different squares and see what the LOS indicator does. For example, if you have cubes in squares A and E, and you move the square A cube to square H, the LOS indicator will switch to the other cube.
You've just discovered the First Law of Calypso: each rule picks the closest matching object. What if we have more than one rule?
Add a second rule to the program, so it looks like this:
Run the program, and put a cube in square A. Remove any other cubes. The first rule can run, and it has an LOS indicator pointing to the cube. The second rule cannot run because the cube is not red.
With the FirstLaw program, tapping on cubes changes their color.
Tap on the cube to turn it red.
Now both rules can run, and you should see two LOS indicators pointing to the same cube.
Place a second cube in square E.
Cozmo sees both cubes, but both rules still choose the cube in square A.
If you tap on the cube in square A so it changes to some color other than red, what will happen? Try it. You should see the second rule go gray again.
If you now tap on the cube in square E so it turns red, what will the LOS indicators look like? Try it and see. The first rule will pick the cube in square A, but the second rule will pick the cube in square E, so both cubes will have LOS indicators pointing to them.
Now tap on the cube A until it's red again. Now both cubes are red. What do the LOS indicators do?
In-class exercise: write down some combination of "WHEN see" rules, give students a configuration of cube positions and colors (red, blue, green, or none), and ask them to predict the LOS indicators.
Back to top of page
Back to New Brighton Curriculum
Part 4: Finding the Limits of Cozmo's Visual Field
Using a magic marker and keeping an eye on Cozmo's camera view, draw a series of dots on the printed pages at the edges of his sight (ie. where he can just barely see the marker).
Connect the dots to form two diagonal lines spreading out from Cozmo. These lines show Cozmo's field of view, meaning that a cube must lie within these lines in order for him to see it.
If you remove the charger, you can extend the two lines until they cross. Students can then use a protractor to measure the angle between the two lines to estimate Cozmo's field of view in degrees. (You should get a value around 60 degrees.)