Go to the documentation of this file.00001 import roslib; roslib.load_manifest('iri_wam_smach')
00002 import rospy
00003 import smach
00004 import smach_ros
00005
00006 from iri_wam_common_msgs.srv import pose_move
00007
00008 class MoveWamInCartesianPose(smach.State):
00009 """
00010 Move WAM given a cartesian pose (no planning or obstacle avoidance)
00011 It will use the cartesian move by torque implemented by libbarrett since 1.1.0
00012
00013 @type move_service : str
00014 @param move_service : URI of move in joinst wam service
00015 @type velocity: int
00016 @param velocity: velocity for movement (not implemented yet)
00017 @type acc: int
00018 @acc: acceleration for movement (not implemented yet)
00019 """
00020 def __init__(self, move_service, velocity = 0, acc = 0):
00021 smach.State.__init__(self, outcomes = ['success','fail'],
00022 input_keys = ['pose'])
00023 self.move_service = move_service
00024 self.velocity = velocity
00025 self.acc = acc
00026
00027 def execute(self, userdata):
00028 try:
00029 handler = rospy.ServiceProxy(self.move_service, pose_move)
00030 response = handler(userdata.pose, self.velocity, self.acc)
00031
00032 except rospy.ServiceException, e:
00033 return 'fail'
00034
00035 return 'success'