grasp_demo.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 import actionlib
00005 from play_motion_msgs.msg import PlayMotionAction, PlayMotionGoal
00006 from sensor_msgs.msg import JointState
00007 
00008 if __name__ == "__main__":
00009   rospy.init_node("grasp_demo")
00010   rospy.loginfo("Waiting for play_motion...")
00011   client = actionlib.SimpleActionClient("/play_motion", PlayMotionAction)
00012   client.wait_for_server()
00013   rospy.loginfo("...connected.")
00014 
00015   rospy.wait_for_message("/joint_states", JointState)
00016   rospy.sleep(3.0)
00017 
00018   rospy.loginfo("Grasping demo...")
00019   goal = PlayMotionGoal()
00020 
00021   goal.motion_name = 'look_at_object_demo'
00022   goal.skip_planning = True
00023   client.send_goal(goal)
00024   client.wait_for_result(rospy.Duration(5.0))
00025 
00026   goal.motion_name = 'pregrasp_demo'
00027   goal.skip_planning = False
00028   client.send_goal(goal)
00029   client.wait_for_result(rospy.Duration(40.0))
00030 
00031   goal.motion_name = 'grasp_demo'
00032   goal.skip_planning = True
00033   client.send_goal(goal)
00034   client.wait_for_result(rospy.Duration(10.0))
00035 
00036   rospy.sleep(1.0) 
00037 
00038   goal.motion_name = 'pick_demo'
00039   goal.skip_planning = False
00040   client.send_goal(goal)
00041   client.wait_for_result(rospy.Duration(30.0))
00042 
00043   rospy.loginfo("Grasping demo OK.")


tiago_gazebo
Author(s): Bence Magyar , Sammy Pfeiffer , Jordi Pages
autogenerated on Thu Sep 22 2016 03:45:20