コード例 #1
0
    def __init__(self):
        smach.StateMachine.__init__(
            self,
            outcomes=['succeeded', 'failure', 'preempted'],
            input_keys=['goal_pose'])

        self.userdata.n_move_base_fails = 0
        self._move_base_action = MoveBaseActionState()
        self._recover_move_base = RecoverMoveBase()
        with self:
            smach.StateMachine.add('MOVE_BASE',
                                   self._move_base_action,
                                   transitions={
                                       'succeeded': 'succeeded',
                                       'aborted': 'RECOVER_MOVE_BASE',
                                       'preempted': 'preempted'
                                   })
            smach.StateMachine.add('RECOVER_MOVE_BASE',
                                   self._recover_move_base,
                                   transitions={
                                       'succeeded': 'MOVE_BASE',
                                       'failure': 'failure'
                                   })