15-494/694 Cognitive Robotics Lab 10:
Collision Detection

I. Software Update, SDK Update, and Initial Setup

Note: You can do this lab either individually, or in teams of two.

At the beginning of every lab you should update your copy of the cozmo-tools package. Do this:

$ cd ~/cozmo-tools
$ git pull

II. Collision Detection

A recent upgrade to the Cozmo SDK introduced an attempt at collision detection by comparing what the wheels are doing with what the accelerometer is sensing. If the robot isn't moving the way it's supposed to, the SDK signals EvtUnexpectedMovement. In cozmo-tools this is turned into an UnexpectedMovementEvent object. Run the Lab10Demo.fsm demo and then use Forward(100).now() to drive Cozmo into an obstacle, which should generate some unexpected movement events.

Now read the documentation for the SDK's EvtUnexpectedMovement class to understand what information is available.

Unfortunately, the movement_side event parameter will always be "unknown". Why? See the documentation for cozmo.robot.UnexpectedMovementSide.

III. Reaction Triggers

Do robot.enable_all_reaction_triggers(True) to enable reaction triggers. Now driving the robot into an obstacle with Forward(100) will show the movement side as "Front".

  • What sort of motion will generate events where the movement side is "Back"? Try your idea and see if it works.

  • How can you generate events where the movement side is "Left" or "Right"? Try your idea and see if it works.

  • Can something like Turn(90).now() ever generate unexpected movement events?

  • You can use a DriveArc node (defined in nodes.py) to make Cozmo drive in an arc. What unexpected movements are detectable when driving in an arc?

IV. Gyro and Accelerometer

Cozmo's 3-axis accelerometer detects the gravity vector, from which pitch, roll, and yaw angles can be inferred. His gyro detects angular acceleration. The variables robot.accelerometer and robot.gyro give the current readings of these sensors.

Run the ShowAccelGyro.fsm demo and see how these values change as you move the robot.

  • What are normal values for these sensors when the robot is standing still?

  • What are normal values when the robot is driving forward at a steady rate?

  • What are normal values when the robot is turning at a steady rate?

V. Practical Collision Detection

Develop a simple demonstration of a situation where collision detection is useful. Here are some scenarios to consider:
  • Cozmo is presented with a wall with two doorways. The doorways have swinging panels like the entrance to a saloon in an old Western movie. (You can make these panels from paper taped to each side of the doorway.) Behind one door is an obstacle, so the panels won't swing to let Cozmo through. Behind the other door is nothing, so Cozmo can push the panels aside and go through the door. But he doesn't know which door is which. You could use collision detection to determine if Cozmo makes it through a door successfully.

  • Cozmo goes to pick up a cube, but there is an obstacle he doesn't visually detect. When the effects of this obstacle are felt, he could attempt a recovery by moving to a different location, turning toward the cube to accurately locate it again, and repeating the pick up attempt.

Hand In

Hand in the code you wrote in part V.


Dave Touretzky
Last modified: Wed Mar 8 01:47:37 EST 2017