def execute(self, userdata): global limb_interface global mode_no_state_trainsition_report if not mode_no_state_trainsition_report: hmm_state_switch_client(self.state) write_exec_hist(self, "Go_back_to_start_position", userdata, False) current_angles = [ limb_interface.joint_angle(joint) for joint in limb_interface.joint_names() ] baxter_r_arm_dmp.main( config.recorded_go_back_to_start_position_path, config.generalized_go_back_to_start_position_path, current_angles) dmp4_traj = dmp_r_joint_trajectory_client.Trajectory() dmp4_traj.parse_file(config.generalized_go_back_to_start_position_path) dmp4_traj.start() dmp4_traj.wait() return 'Succeed'
def execute(self, userdata): global limb_interface global mode_no_state_trainsition_report if not mode_no_state_trainsition_report: hmm_state_switch_client(self.state) write_exec_hist(self, "Go_forward", userdata, True) current_angles = [ limb_interface.joint_angle(joint) for joint in limb_interface.joint_names() ] baxter_r_arm_dmp.main(config.recorded_go_forward_path, config.generalized_go_forward_path, current_angles) dmp3_traj = dmp_r_joint_trajectory_client.Trajectory() dmp3_traj.parse_file(config.generalized_go_forward_path) dmp3_traj.start() if wait_for_motion_and_detect_anomaly(dmp3_traj): return 'NeedRecovery' return 'Succeed'