Activity: Cozmo's Shack

Code Materials
 shack_activity.calypso 
  • Cardboard box at least 11x11x6.5 inches   
  • Printouts of template files Wall39.pdf and Wall45.pdf 
  • Ruler about 1.25 inches (35mm) wide
  • Box cutter and scissors
  • Adhesive tape; packing tape; glue stick

Description

In this activity, students construct a shack for Cozmo to play in, and program him to visit various regions in and around the shack.

Learning Goals

This activity teaches students about landmark-based navigation and path planning. The markers on the walls serve as landmarks. The walls and light cubes are obstacles that Cozmo must find his way around using his built-in path planning algorithm. He can plan paths that go through doorways, using the marker above each doorway to fine tune his motion.

Preparation

Each team of students needs a cardboard box at least 11x11x6.5 inches. They will also need wall templates provided in the files Wall39.pdf and Wall45.pdf. There are two pages per file; they must be printed single-sided.

Students should be instructed on the proper handling of box cutters. A "safety" box cutter with enclosed blade is recommended. For younger students, it may be preferable for the teacher to do the cutting. A scissors can be used, with some difficulty, in place of a box cutter.

Construction Steps (Click on Images to Enlarge)

Start with an empty box. It should be at least 11x11x6.5 inches.
When using the box cutter, place another piece of cardboard beneath the piece you're cutting, so you don't cut or scratch the table.
Remove all four of the flaps.
Use the width of the ruler to draw a line along the left and right edges of an interior wall.
Align the ruler with the top and bottom edges of the box to make the third and fourth lines.
The four lines form the boundary of the window you should cut out.
Use the box cutter to cut out the window. Remember to put another piece of cardboard underneath to protect the table.
Draw four more lines on an adjacent wall for the second window.
Cut out the second window the same way you cut the first one.
Draw four more lines on the bottom of the box to create the skylight.
Cut out the skylight.
Reinforce the skylight using packing tape to secure the remnants of the flaps. (Regular adhesive tape will not hold, so packing tape is required.)
Use a paper cutter or scissors to cut off the bottom edge of the wall templates, following the dotted line.
Use adhesive tape or a glue stick to affix the "back" templates to the inside walls. "Wall 45 back" goes on the left, and "Wall 39 back" goes on the right. The sheets should meet at their common corner, and their bottom edges should be aligned with the bottom edge of the box.
Use the box cutters to cut out the first door, keeping another piece of cardboard beneath the box to protect the table.
Cut out the second door as well.
Use a scissors to cut out the doorways from the "Wall 39 front" and "Wall 45 front" templates. Then use a glue stick or adhesive tape to affix them to the outside walls of the box. Wall 39 front goes on the left; Wall 45 front goes on the right.
Decorate your shack according to taste.

Here is a shack decorated as a grocery mart, by Shanshan Jin of ReadyAI:


Map Layout

Walls serve as landmarks that allow Cozmo to accurately determine his location on the world map. Since rooms are defined in world map coordinates, having walls present ensures that rooms can be accurately located even though the rooms themselves have no visible markings.

Start a new program and go to the map layout view. (Press the "down" direction on the D-Pad, or type Control+DownArrow on the PC keyboard or Fn + DownArrow on the Mac).
Drag Wall 39 from the palette onto the map, above the robot. The yellow side is the front of the wall and should be facing the robot.
Drag Wall 45 from the palette onto the map.
Use one of the rotation handles at either end to rotate Wall 45 by 90 degrees counter-clockwise so that the yellow side faces right and the green side faces left.
Click and drag on wall 45 until its bottom connector (red dot) overlaps the right connector on wall 39. The connectors should turn yellow and display concentric circles. If you release the mouse at this point, the walls will snap together. If either wall turns red, then the walls are in collision and will not snap together when the left mouse button is released, so move the mouse until you see only yellow, no red.
When the walls are snapped together, they look like this.
Drag two Wall A panels onto the layout and snap them in place to complete the shack as shown.
Drag a room from the palette into the shack. Use the red resize dots to adjust the size and shape of the room. Right click inside the room and change the room name to "interior".
Add two more rooms as shown. Name them "steps" and "side porch".

Programming

You can use the "visit" action to visit a room. The "visiting" predicate is true whenever the robot's location falls within a room.

To visit each of the three rooms we defined above, use a state machine with three pages. Here is the what the code should look like.


Back to top of page

Back to New Brighton Curriculum