Go to the documentation of this file.00001
00002
00003 import roslib; roslib.load_manifest('zyonz_apps_base')
00004 import rospy
00005 import smach
00006 import smach_ros
00007
00008 from smach import CBState
00009 from iri_common_smach.utils_msg import build_pose_stamped_msg
00010 from iri_wam_smach.sm_wam_move_from_pose import SM_WAM_MoveFromPose
00011
00012 class SM_ZYONZ_GoHome():
00013 """
00014 """
00015 def __init__(self):
00016 self.sm = smach.StateMachine(outcomes=['success','aborted'])
00017
00018 @smach.cb_interface(input_keys = [],
00019 output_keys= ['pose_st'],
00020 outcomes = ['finish'])
00021 def home_pose_cb(ud):
00022 ud.pose_st = build_pose_stamped_msg('/wam_link0',0.5, 0, 0.13, 0.0, 1.0, 0.0, 0.0)
00023 return 'finish'
00024
00025 def build_sm(self):
00026 f_move = SM_WAM_MoveFromPose('/zyonz/wam_wrapper/joints_move',
00027 '/zyonz/iri_wam_tcp_ik/get_wam_ik')
00028 sm_move = f_move.build_sm()
00029
00030 with self.sm:
00031 smach.StateMachine.add('DEFINE_HOME_POSE', CBState(self.home_pose_cb),
00032 transitions = {'finish' : 'MOVE_TO_HOME'},
00033 remapping = {'pose_st' : 'sm_pose_st'})
00034
00035 smach.StateMachine.add('MOVE_TO_HOME', sm_move,
00036 transitions = {'success' : 'success',
00037 'aborted' : 'aborted',
00038 'no_kinematic_solution' : 'aborted'},
00039 remapping = {'pose_st' : 'sm_pose_st'})
00040 return self.sm