ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

PR2 Pick and Place Crashes in simple_pick_and_place_example.py

asked 2012-03-31 10:05:37 -0500

jker gravatar image

updated 2014-01-28 17:11:49 -0500

ngrennan gravatar image

Hi I'm new to ROS, I've downloaded and installed Electric, and now I'm trying to get the PR2 to pick up and place objects in the Gazebo simulator. I'm interested in writing my own pick-and-place package using Python, so I've been following the tutorial here. I've downloaded all the relevant packages and I execute the command below in that order.

roslaunch pr2_gazebo pr2_empty_world.launch roslaunch gazebo_worlds table.launch roslaunch gazebo_worlds coffee_cup.launch export ROBOT=sim roslaunch pr2_tabletop_manipulation_launch pr2_tabletop_manipulation.launch stereo:=true rosrun pr2_pick_and_place_demos simple_pick_and_place_example.py

Everything launches fine except for the last command, which gets stuck at the message:

[INFO] [WallTime: 1333224769.117507] [1004.719000] ik_utilities: waiting for IK services to be there

I'm not sure why it can't find IK services (or what they are, since I can't find it in the tutorial), so what is it and how do I get it so the PR2 can grasp objects?

EDIT: For some reason it gets past this line now, but after it moves the arms and head it crashes with the output below (Sorry about the format, but pasting here I can't get the newlines to work properly unless I space it out to every other line):


[INFO] [WallTime: 1333234720.247776] [431.624000] ik_utilities: waiting for IK services to be there

[INFO] [WallTime: 1333234720.370728] [431.630000] ik_utilities: services found

[INFO] [WallTime: 1333234720.388736] [431.631000] getting the IK solver info

[INFO] [WallTime: 1333234720.440548] [431.632000] done getting the IK solver info

[INFO] [WallTime: 1333234720.514891] [431.636000] ik_utilities: done init

[INFO] [WallTime: 1333234720.527255] [431.637000] done creating IKUtilities class objects

Traceback (most recent call last):

File "/opt/ros/electric/stacks/pr2_object_manipulation/applications/pr2_pick_and_place_demos/test/simple_pick_and_place_example.py", line 110, in <module> sppe = SimplePickAndPlaceExample()

File "/opt/ros/electric/stacks/pr2_object_manipulation/applications/pr2_pick_and_place_demos/test/simple_pick_and_place_example.py", line 54, in __init__ self.papm = PickAndPlaceManager()

File "/opt/ros/electric/stacks/pr2_object_manipulation/applications/pr2_pick_and_place_demos/src/pr2_pick_and_place_demos/pick_and_place_manager.py", line 172, in __init__ self.cms[0] = controller_manager.ControllerManager('r', self.tf_listener, use_slip_controller, use_slip_detection)

File "/opt/ros/electric/stacks/pr2_object_manipulation/manipulation/pr2_gripper_reactive_approach/src/pr2_gripper_reactive_approach/controller_manager.py", line 243, in __init__ self.cartesian_desired_pose = self.get_current_wrist_pose_stamped('/base_link')

File "/opt/ros/electric/stacks/pr2_object_manipulation/manipulation/pr2_gripper_reactive_approach/src/pr2_gripper_reactive_approach/controller_manager.py", line 676, in get_current_wrist_pose_stamped (current_trans, current_rot) = self.return_cartesian_pose(frame)

File "/opt/ros/electric/stacks/pr2_object_manipulation/manipulation/pr2_gripper_reactive_approach/src/pr2_gripper_reactive_approach/controller_manager.py", line 1429, in return_cartesian_pose (trans, rot) = self.tf_listener.lookupTransform(frame, self.whicharm+'_wrist_roll_link', rospy.Time(0)) tf.ExtrapolationException: Lookup would require extrapolation into the past. Requested time 431.621000000 but the earliest data is at time 431.960000000, when looking up transform from frame [/r_wrist_roll_link] to frame [/base_link]

Exception in thread Thread-32 (most likely raised during interpreter shutdown): Traceback (most recent call last):

File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner

File "/usr/lib/python2.6/threading.py", line 484, in run

File "/opt/ros/electric/stacks/pr2_object_manipulation/manipulation/pr2_gripper_reactive_approach/src/pr2_gripper_reactive_approach/joint_states_listener.py", line 80, in joint_states_listener

File "/opt/ros/electric/stacks ... (more)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2012-04-02 12:26:58 -0500

hsiao gravatar image

updated 2012-04-07 10:03:14 -0500

hsu gravatar image

Thanks for bringing this issue to my attention--it's been awhile since I updated simple_pick_and_place_example.py . I've updated the tutorial on the wiki here: http://www.ros.org/wiki/pr2_pick_and_place_demos/Tutorials/A%20Simple%20Pick%20And%20Place%20Example%20Using%20The%20Pick%20And%20Place%20Manager

There was also a minor bug in pr2_pick_and_place_manager with updating the place rectangle, which has now been fixed.

If you check out our Electric branch of pr2_object_manipulation:

svn co https://code.ros.org/svn/wg-ros-pkg/stacks/pr2_object_manipulation/branches/0.5-branch pr2_object_manipulation

and then add that directory to your ROS_PACKAGE_PATH, you'll get fixed versions of both simple_pick_and_place_example.py and pr2_pick_and_place_manager.py . (You are indeed right about removing the take_static_collision_map = 1 argument, but you also want update_place_rectangle = 1.) (Those fixes will go out with the next release into debians.)

As for the tf error... erm. Wow. You should really not have to put a half-second sleep in between those two things. I can't replicate that error on my computer; could you please try, instead of adding the 0.5 sec sleep, changing the line just under the lookupTransform that says

except tf.Exception:

and switch it to

except (tf.Exception, tf.ExtrapolationException):

and let me know if that helps?

Also also, you may want to try launching your simulation with

roslaunch manipulation_worlds pr2_table_object.launch

instead of separately doing pr2 + table + coffee cup. (The coke can in that world has our grasping hack on it, which makes it easier for the robot to not drop it once it's picked up.)

edit flag offensive delete link more
1

answered 2012-04-01 11:27:06 -0500

jker gravatar image

I figured it out, the line

tf.ExtrapolationException: Lookup would require extrapolation into the past. Requested time 431.621000000 but the earliest data is at time 431.960000000, when looking up transform from frame [/r_wrist_roll_link] to frame [/base_link]

was causing the error, and I fixed it using the suggestion here where the steps they outlined were:

I ran into this even though I am running a native Ubuntu install. This can be fixed by adding a wait to the start of the call to return_cartesian_pose:

roscd pr2_object_manipulation cd manipulation cd pr2_gripper_reactive_approach cd src cd pr2_gripper_reactive_approach sudo gedit controller_manager.py

Around line 1430, there is the line: (trans, rot) = self.tf_listener.lookupTransform(frame, >self.whicharm+'_wrist_roll_link', rospy.Time(0))

Above this add: rospy.sleep(0.5)

Save, and make the package again rosmake pr2_object_manipulation

Since there's a sleep every time that method is called, the simulation will be a little slower. You can adjust the wait duration to be just larger than the delay that you see on your machine. 0.5 works for me most of the time.

This worked for me, however I also had to edit simple_pick_and_place_example.py around line 35

self.papm.call_tabletop_detection(take_static_collision_map = 1, update_table = 1, clear_attached_objects = 1)

should be

self.papm.call_tabletop_detection(update_table = 1, clear_attached_objects = 1)

edit flag offensive delete link more

Comments

I'm not sure why I can't comment on your post directly Hsiao, so I'll just put it here...

I was unable to install the latest pr2_object_manipulation branch you linked because it requires lots of other packages that I apparently don't have, and I don't have the free time to install all of them and their dependencies (and THEIR dependencies, etc) by hand, so I'm just sticking with my hacked version and am working under the assumption that it will run on our PR2 since it runs in the simulator.

Thanks again!

jker gravatar image jker  ( 2012-04-09 06:48:39 -0500 )edit

You don't have to install everything from source--just the one stack. Check out pr2_object_manipulation and then install the rest from debs (apt-get install ros-electric-pr2-desktop), then set your ROS_PACKAGE_PATH to be something like path_to_pr2_object_manipulation:/opt/ros/electric/stacks .

hsiao gravatar image hsiao  ( 2012-04-09 07:59:18 -0500 )edit

but sure, hacked version is fine as long as it works too. :)

hsiao gravatar image hsiao  ( 2012-04-09 08:00:28 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-03-31 10:05:37 -0500

Seen: 723 times

Last updated: Apr 07 '12