Calypso Module 3: Pursuit
The Pursue RuleA pursue rule looks for an object and causes motion towards that object. In the example below, Cozmo is pursuing cubes using the action "move toward". The cube tile with the question mark means he's not looking for a specific cube; any cube will do.
![]() Let's try it out and see how it works.
Choosing Among CubesWhen you started the program, Cozmo saw two cubes. How did he decide which one to pursue?Try setting up the experiment again, placing two cubes in front of Cozmo and then running the program. Vary the starting positions of the cubes and see if you can figure out how Cozmo chooses a cube to pursue. The First Law of CalypsoThe behavior of Cozmo programs is governed by the laws of Calypso, just as the behavior of objects in the real world is governed by the laws of physics. The First Law of Calypso is that each rule that looks for an object will pick the closest one that matches what it's looking for. So if we have a pursue rule that is looking for cubes, it will pick the closest cube.Here is a graphic illustrating the First Law:
![]() Now that you know the First Law, you can predict what Cozmo will do when he's told to pursue something.
Guided PursuitLet's combine the Let Me Drive idiom from the previous module with the pursue rule:
![]() This is your first two-line program. To try it out, follow these steps:
Simulator ModeIt can be more convenient to experiment with guided pursuit in simulator mode instead of using a real robot. Simply unplug the Fire tablet from your computer, quit Calypso, and start Calypso again. Calypso will warn you that it could not find the robot, and offer the option of continuing in simulator mode.In simulator mode the world map always starts out with all three cubes present, in fixed positions. You can use the pursue rule to take your simulated Cozmo to the nearest cube, and the Let Me Drive idiom to guide him to a different cube.
Rules That Run and Rules That Don'tWhen you run the two line program above, you'll notice that most of the time the Let Me Drive rule is dimmed while the pursue rule is at full brightness. This indicates that the pursue rule is "running", while the Let Me Drive rule is not.A rule "runs" whenever its WHEN part is true. Since Cozmo is continuously seeing a cube, the pursue rule's WHEN part is true all the time, so it is constantly running. But the Let Me Drive rule's WHEN part only becomes true when you press one of the gamepad controls. When you're not touching the gamepad, "WHEN gamepad" is false, so the Let Me Drive rule cannot run. When you press one of the sticks you'll see the rule brighten because it's running. When you let go, it dims again.
Pursuing Red CubesYou can do this exercise either in simulator mode or with the real robot.
(To Be Added): FleeReview and DiscoveryDo the Module 3 Review and Discovery activity to review what you've learned.
Next ModuleIn the next module you'll learn the rest of the Pursue and Consume idiom, and how to reason about Pursue and Consume programs.
Back to Calypso Curriculum overview.
Copyright © 2017 Visionary Machines LLC. |