(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Head Tracking Example

Description: Shows how to make the head of the PR2 follow the gripper.

Tutorial Level: BEGINNER

Contents

(This example was presented in a Google I/O talk by Ken Conley and Brian Gerkey.)

Create a file, for example, follow_gripper.py, and paste the following code into it:

   1 # Head tracking example using rosh
   2 
   3 # Create goal message: origin of wrist frame 
   4 target = msg.geometry_msgs.PointStamped( header = Header(frame_id = 'r_wrist_roll_link') )
   5 goal = msg.pr2_controllers_msgs.PointHeadGoal(target=target, min_duration=Duration(0.1))
   6 
   7 #publish
   8 rospy.loginfo("Publish loop starting...")
   9 while ok():
  10 
  11     topics.head_traj_controller.point_head_action.goal(goal = goal)
  12     rospy.sleep(0.05)
  13 
  14 rospy.loginfo("Exiting...")

Run this from the command line as follows:

rosrun rosh rosh follow_gripper.py

Move the right arm and you should see the head following the gripper!

Wiki: rosh/head_tracking_example (last edited 2012-05-10 16:08:51 by DanLazewatsky)