15-494/694 Cognitive Robotics: Lab 7

Learning Goal: This lab you will experiment with inverse kinematics calculations.

Part 1: Camera Track Gripper Demo

  1. Do this exercise on the robot. Power up the robot and make sure the pan/tilt and arm are working properly.

  2. Go to Root Control > Framework Demos > Kinematics Demos > CameraTrackGripper.

  3. Turn on the RawCam viewer and the Arm Controller. Move the arm and note that the center of the gripper (located between the two fingers) remains centered in the camera image.

  4. Type "msg" to the Tekkotsu console a few times to display the finger-to-base transformation matrix and observe how it changes as you move the arm.

  5. Press the "Play" button on the Create to relax the arm. Then gently move the arm back and forth and observe how well the camera tracks it.

Part 2: Gripper Track Camera Demo

  1. Do this exercise in Mirage. We will be using the Calliope5KP robot because it has a more complex arm.

  2. In your ~/project directory, type "make tekkotsu-CALLIOPE5KP" to compile for this robot.

  3. Run tekkotsu-CALLIOPE5KP using Mirage.

  4. Go to Root Control > Framework Demos > Kinematics Demos > GripperTrackCamera.

  5. Use the head controller to move the camera, and observe how the arm moves to keep the gripper 300 mm in front of the camera.

Part 3: Safe Arm Behavior

  1. In the GripperTrackCamera demo on the Calliope5KP, you should notice that when the demo starts up, the arm moves to its initial position at a high rate of speed. This is dangerous. The robot could hurt itself or a person. To experiment with this, stop the demo behavior, use the Arm Controller to move the gripper to a position far from the camera, shut down the Arm Controller, and run the demo behavior again. Think about what could happen if someone's face was close to the arm when the demo started up.

  2. Copy the demo to your project directory, and rename it GripperTrackCamera2.cc.fsm. Also edit the class name where it appears twice in the file: once in the $nodeclass and once in the REGISTER_BEHAVIOR.

  3. We're going to make the demo safe by checking the distance that the arm needs to travel to reach its target position. To figure out how far the arm needs to travel, you will need to get the current gripper position in base frame coordinates. Review the kinematics lecture notes if you need help with this.

  4. We'll use the setMaxSpeed method of PostureMC to adjust the arm speed. If the distance is large (as on startup), the arm will move gently to its initial position. Once there, it can move at high speed as long as it's only making small corrections. Implement this change and test it in Mirage to make sure the arm behaves safely.

Part 4: Continuous Trajectories

  1. Write a behavior that moves the gripper to a point slightly in front of the robot, and then moves it, at a low speed, to a point a bit a good bit further ahead, i.e., farther in the x direction but with the y and z coordinates the same. You can do this with a series of two PostureNodes.

  2. Run your behavior, and look carefully at the trajectory of the gripper. Although the start and end points should have the same y and z values, the gripper's height above the ground will not remain constant throughout the trajectory. Why not?

  3. Let's try a different approach: we can divide the trajectory into small steps and do a separate IK calculation for each step. This way we can get the trajectory to approximate a straight line. Use a DynamicMotionSequenceNode for this. Inside the doStart, create a PostureEngine instance. You can call its solveLinkPosition method to calculate a set of arm joint angles, and then call the MotionSequenceEngine's setPose method (which DynamicMotionSequence inherits) to copy this posture into the motion sequence. Do this in a loop as you interpolate the target position from the start to the end point. When you've calculated the complete motion sequence and returned from the doStart, the DynamicMotionSequence node will play the sequence. What does the trajectory look like?

What to Hand In

Finish the lab for homework.
  • For Parts 1 and 2 there is nothing to hand in.

  • For Parts 3 and 4, hand in your source code.

Due Friday, March 25, 2016.