Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('estirabot_apps')
00004 import rospy
00005 import smach
00006 import smach_ros
00007 import threading
00008 import time
00009 import tf
00010 import geometry_msgs
00011 import numpy
00012
00013 from sensor_msgs.msg import PointCloud2
00014 from iri_wam_common_msgs.srv import pose_move,pose_moveRequest,wamInverseKinematics,joints_move
00015 from object_manipulation_msgs.msg import Grasp, PickupGoal
00016 from geometry_msgs.msg import Pose, PoseStamped, Transform, TransformStamped
00017
00018 from pprint import pprint
00019
00020
00021 def build_home_pose():
00022 return build_pose_stamped_msg('/wam_fk/wam0',0.5, 0, 0.13, 0.0, 1.0, 0.0, 0.0)
00023
00024
00025 def build_simple_pickup_goal(grasp_joint_state, pre_grasp_joint_state, fingers_config):
00026
00027 rospy.set_param('/estirabot/skills/grasp/fingers_configuration', fingers_config)
00028
00029 g = Grasp()
00030 g.grasp_posture = grasp_joint_state
00031 g.pre_grasp_posture = pre_grasp_joint_state
00032
00033 r = PickupGoal()
00034 r.desired_grasps.append(g)
00035
00036 return r
00037
00038
00039 def build_test_pickup_goal():
00040 g = Grasp()
00041 g.pre_grasp_posture.name.append('my_pre_grasp')
00042
00043 g.pre_grasp_posture.position.append(0.0);
00044 g.pre_grasp_posture.position.append(0.0);
00045 g.pre_grasp_posture.position.append(0.0);
00046 g.pre_grasp_posture.position.append(2.0);
00047 g.pre_grasp_posture.position.append(0.0);
00048 g.pre_grasp_posture.position.append(0.0);
00049 g.pre_grasp_posture.position.append(0.0);
00050
00051 g.grasp_posture.position.append(0.1);
00052 g.grasp_posture.position.append(0.0);
00053 g.grasp_posture.position.append(0.0);
00054 g.grasp_posture.position.append(2.0);
00055 g.grasp_posture.position.append(0.0);
00056 g.grasp_posture.position.append(0.0);
00057 g.grasp_posture.position.append(0.0);
00058
00059 r = PickupGoal()
00060 r.desired_grasps.append(g)
00061
00062 return r
00063
00064
00065 class EstirabotGoHome(smach.State):
00066 def __init__(self):
00067 smach.State.__init__(self, outcomes=['success','fail'])
00068
00069 def execute(self, userdata):
00070 try:
00071 return wam_cartesian_move(build_home_pose())
00072 except rospy.ServiceException, e:
00073 print "Service call failed: %s"%e
00074
00075 return 'fail'
00076
00077 class EstirabotGetPCL(iri_common_smach.GetPCL):
00078 pass