def shutdown_handler(): """ Allows the Baxter to move to home position and disable its motors once shutdown is called. """ robot = Baxter() print "Exiting system..." if not robot._rs.state().enabled: robot.clean_shutdown() robot._rs.disable() return True
def execute(self, userdata): idle_goal = userdata.goal_from_ui idle_result = userdata.result_for_ui robot = Baxter() if idle_goal.ui_command.command == bdm.GetUserCommand.MOVE_TO_IDLE_MODE: idle_start_time = rospy.Time.now().secs while rospy.Time.now().secs - idle_start_time < 10: if robot._rs.state().enabled: robot.clean_shutdown() rospy.sleep(6) # Wait for the robot to move arms to both sides and set the result field idle_result.sys_result.result = bdm.GetResult.IS_IN_IDLE_MODE return 'in_idle' robot.disable() idle_result.sys_result.result = bdm.GetResult.IS_IN_IDLE_MODE return 'in_idle' idle_result.sys_result.result = bdm.GetResult.IS_ABORTED return 'aborted' else: return 'different_request'