def execute(self, userdata): global p c_goal = userdata.goal_from_ui c_result = userdata.result_for_ui robot = Baxter() if c_goal.ui_command.command == bdm.GetUserCommand.CANCEL_DEMO: if p is not None: nxr.terminate_process_and_children(p) p = None robot.set_neutral() c_result.sys_result.result = bdm.GetResult.DEMO_TERMINATED return 'demo_terminated' else: return 'different_request'
def execute(self, userdata): hp_goal = userdata.goal_from_ui hp_result = userdata.result_for_ui robot = Baxter() if hp_goal.ui_command.command == bdm.GetUserCommand.MOVE_TO_HOME_POSITION: hp_start_time = rospy.Time.now().secs while rospy.Time.now().secs - hp_start_time < 10: if robot.set_neutral(): hp_result.sys_result.result = bdm.GetResult.IS_IN_HOME_POSE return 'in_home' hp_result.sys_result.result = bdm.GetResult.IS_ABORTED return 'aborted' else: return 'different_request'