Пример #1
0
 def transition_cb(self, goal, handler):
     '''
     When a task "transitions" (canceled, started, aborted, succeded), update
     the log and result pane
     '''
     status = handler.get_goal_status()
     if status == GoalStatus.ACTIVE:
         if self.current_task and goal.id != self.current_task:
             pass
             # Another active goal happened, clear Feedback and stuff
         self.result_label.clear()
         self.current_task = goal.id
         self.current_task_task = handler.comm_state_machine.action_goal.goal.task
         self.current_task_status = 'In progress'
         self.current_task_status_label.setText(self.current_task_status)
         self.current_task_result = ''
         self.current_task_label.setText(self.current_task_task)
         self.ui_log('STARTING: new task {}'.format(self.current_task_task))
     if goal.id == self.current_task:
         terminal_state = TerminalState.to_string(status)
         if terminal_state == 'NO_SUCH_STATE_1':
             return
         result = handler.get_result()
         if result and result.result != self.current_task_result:
             self.result_label.setText(result.result)
             self.ui_log('RESULT: {}'.format(result.result))
         if terminal_state != self.current_task_status:
             self.current_task_status = terminal_state
             self.current_task_status_label.setText(
                 self.current_task_status)
             self.ui_log('FINISHED: task finished ({})'.format(
                 self.current_task_status))
Пример #2
0
 def transition_cb(self, goal, handler):
     '''
     When a mission "transitions" (canceled, started, aborted, succeded), update
     the log and result pane
     '''
     status = handler.get_goal_status()
     if status == GoalStatus.ACTIVE:
         if self.current_mission and goal.id != self.current_mission:
             pass
             # Another active goal happened, clear Feedback and stuff
         self.result_label.clear()
         self.current_mission = goal.id
         self.current_mission_mission = handler.comm_state_machine.action_goal.goal.mission
         self.current_mission_status = 'In progress'
         self.current_mission_status_label.setText(self.current_mission_status)
         self.current_mission_result = ''
         self.current_mission_label.setText(self.current_mission_mission)
         self.ui_log('STARTING: new mission {}'.format(self.current_mission_mission))
     if goal.id == self.current_mission:
         terminal_state = TerminalState.to_string(status)
         if terminal_state == 'NO_SUCH_STATE_1':
             return
         result = handler.get_result()
         if result and result.result != self.current_mission_result:
             self.result_label.setText(result.result)
             self.ui_log('RESULT: {}'.format(result.result))
         if terminal_state != self.current_mission_status:
             self.current_mission_status = terminal_state
             self.current_mission_status_label.setText(self.current_mission_status)
             self.ui_log('FINISHED: mission finished ({})'.format(self.current_mission_status))
Пример #3
0
 def _client_cb(self, terminal_state, result):
     if terminal_state != 3:
         rospy.logwarn('Station hold goal failed (Status={}, Result={})'.format(
             TerminalState.to_string(terminal_state), result.result))
         return
     rospy.loginfo('Station holding!')
     self.broadcaster.clear_alarm()
Пример #4
0
 def _client_cb(self, terminal_state, result):
     if terminal_state != 3:
         rospy.logwarn(
             'Station hold goal failed (Status={}, Result={})'.format(
                 TerminalState.to_string(terminal_state), result.result))
         return
     rospy.loginfo('Station holding!')
     self.broadcaster.clear_alarm()
Пример #5
0
 def cb(terminal_state, result):
     if terminal_state == 3:
         rospy.loginfo('Thrusters Retracted!')
     else:
         rospy.logwarn(
             'Error rectracting thrusters: {}, status: {}'.format(
                 TerminalState.to_string(terminal_state),
                 result.status))
Пример #6
0
 def _client_cb(self, terminal_state, result):
     if terminal_state != 3:
         rospy.logwarn('Station hold goal failed (Status={}, Result={})'.format(
             TerminalState.to_string(terminal_state), result))
         return
     try:
         self.change_wrench('autonomous')
         rospy.loginfo('Now station holding')
         self.broadcaster.clear_alarm()
     except rospy.ServiceException as e:
         rospy.logwarn('Station hold changing wrench failed: {}'.format(e))
Пример #7
0
 def _client_cb(self, terminal_state, result):
     if terminal_state != 3:
         rospy.logwarn(
             'Station hold goal failed (Status={}, Result={})'.format(
                 TerminalState.to_string(terminal_state), result))
         return
     try:
         self.change_wrench('autonomous')
         rospy.loginfo('Now station holding')
         self.broadcaster.clear_alarm()
     except rospy.ServiceException as e:
         rospy.logwarn('Station hold changing wrench failed: {}'.format(e))
Пример #8
0
 def bag(self, timeout=rospy.Duration(0)):
     self.client.wait_for_server()
     self.result = None
     self.total_it = 0
     self.bar = tqdm(desc='Writing bag', unit=' percent', total=100,
                     bar_format='{desc} {bar} {percentage:3.0f}%')
     self.client.send_goal(self.goal, done_cb=self._done_cb,
                           feedback_cb=self._feedback_cb)
     while self.result is None and not rospy.is_shutdown():
         rospy.sleep(0.1)
     self.bar.refresh()
     self.bar.close()
     (status, result) = self.result
     if status == 3:
         print 'Bag successful'
     else:
         print 'Bag {}: {}'.format(TerminalState.to_string(status), result.status)
Пример #9
0
 def bag(self, timeout=rospy.Duration(0)):
     self.client.wait_for_server()
     self.result = None
     self.total_it = 0
     self.bar = tqdm(desc='Writing bag',
                     unit=' percent',
                     total=100,
                     bar_format='{desc} {bar} {percentage:3.0f}%')
     self.client.send_goal(self.goal,
                           done_cb=self._done_cb,
                           feedback_cb=self._feedback_cb)
     while self.result is None and not rospy.is_shutdown():
         rospy.sleep(0.1)
     self.bar.refresh()
     self.bar.close()
     (status, result) = self.result
     if status == 3:
         print 'Bag successful'
     else:
         print 'Bag {}: {}'.format(TerminalState.to_string(status),
                                   result.status)
Пример #10
0
 def _bag_done_cb(self, status, result):
     if status == 3:
         rospy.loginfo('KILL BAG WRITTEN TO {}'.format(result.filename))
     else:
         rospy.logwarn('KILL BAG {}, status: {}'.format(
             TerminalState.to_string(status), result.status))
Пример #11
0
 def _bag_done_cb(self, status, result):
     if status == 3:
         rospy.loginfo('KILL BAG WRITTEN TO {}'.format(result.filename))
     else:
         rospy.logwarn('KILL BAG {}, status: {}'.format(TerminalState.to_string(status), result.status))
Пример #12
0
Файл: kill.py Проект: uf-mil/mil
 def _kill_task_cb(self, status, result):
     if status == 3:
         rospy.loginfo('Killed task success!')
         return
     rospy.logwarn('Killed task failed ({}): {}'.format(TerminalState.to_string(status), result.result))
Пример #13
0
 def _kill_task_cb(self, status, result):
     if status == 3:
         rospy.loginfo('Killed task success!')
         return
     rospy.logwarn('Killed task failed ({}): {}'.format(TerminalState.to_string(status), result.result))