0
$\begingroup$

Rosanswers logo

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 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/ros_comm/clients/rospy/src/rospy/client.py", line 101, in spin <type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'core'

Unhandled exception in thread started by

Error in sys.excepthook:

Original exception was:

Exception in thread /r_arm_controller/joint_trajectory_action/status (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/ros_comm/clients/rospy/src/rospy/impl/tcpros_pubsub.py", line 169, in robust_connect_subscriber

File "/opt/ros/electric/stacks/ros_comm/clients/rospy/src/rospy/impl/tcpros_base.py", line 720, in receive_loop

<type 'exceptions.TypeError'>: 'NoneType' object is not callable


On a side note: One other error I noticed was that the manipulation pipeline could not connect to the database because I don't have it installed on my computer (I'm on a public machine and don't have permissions to install the database locally). Is the database necessary? Because the manipulation pipeline seems to run without it. If it is necessary, is there a workaround?


Originally posted by jker on ROS Answers with karma: 115 on 2012-03-31

Post score: 1

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.)


Originally posted by hsiao with karma: 741 on 2012-04-02

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$
0
$\begingroup$

Rosanswers logo

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)


Originally posted by jker with karma: 115 on 2012-04-01

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by jker on 2012-04-09:
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!

Comment by hsiao on 2012-04-09:
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 .

Comment by hsiao on 2012-04-09:
but sure, hacked version is fine as long as it works too. :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.