Exemple #1
0
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_GRIPPER_FIRST',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted',
                                   'arrived': 'GOTO_GRIPPER_FIRST'
                               })
        smach.StateMachine.add('GOTO_GRIPPER_FIRST',
                               getGoToGripperMachine(1),
                               transitions={
                                   'succeeded': 'WAIT_HELLO2',
                                   'error': 'aborted'
                               })
        smach.StateMachine.add('WAIT_HELLO2',
                               WaitTopicState('butia_speech/bhd/detected'),
                               transitions={
                                   'succeeded': 'GOTO_2',
                                   'error': 'GOTO_GRIPPER_FIRST'
                               })
        sm2 = getGoToFixedMachine('living_room')
        smach.StateMachine.add('GOTO_2',
                               sm2,
                               transitions={
                                   'succeeded': 'succeeded',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted',
                                   'arrived': 'arrived'
                               })

    outcome = sm.execute()
Exemple #2
0
#!/usr/bin/env python
import rospy
import smach

from butia_behavior.states import SetFixedTargetState
from butia_behavior.machines import getGoToFixedMachine, getGoToMachine

if __name__ == '__main__':
    rospy.init_node('goto_two_points')
    sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
    with sm:
        ###
        sm1 = getGoToFixedMachine('nautec')
        smach.StateMachine.add('GOTO_1',
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_2',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
        ###
        sm2 = getGoToFixedMachine('fbot')
        smach.StateMachine.add('GOTO_2',
                               sm2,
                               transitions={
                                   'succeeded': 'GOTO_1',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
    outcome = sm.execute()
from butia_behavior.machines import getWaitDoorMachine, getGoToFixedMachine, getPickUpMachine, getHandOverMachine
from butia_behavior.states import SaySomethingState

def average(counts):
  return reduce(operator.add, counts) / len(counts)

if __name__ == '__main__':
  rospy.init_node('manipulation_task')
  sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
  with sm:
    sm1 = getWaitDoorMachine()
    smach.StateMachine.add('WAIT_DOOR', sm1, transitions={
      'succeeded': 'GOTO_1',
      'error': 'aborted',
    })
    sm2 = getGoToFixedMachine('pickup')
    smach.StateMachine.add('GOTO_1', sm2, transitions={
      'succeeded': 'PICKUP',
      'aborted': 'aborted',
      'preempted': 'preempted'
    })
    sm3 = getPickUpMachine()
    smach.StateMachine.add('PICKUP', sm3, transitions={
      'succeeded': 'GOTO_2',
      'error': 'aborted'
    })
    sm4 = getGoToFixedMachine('handover')
    smach.StateMachine.add('GOTO_2', sm4, transitions={
      'succeeded': 'HANDOVER',
      'aborted': 'aborted',
      'preempted': 'preempted'
Exemple #4
0
def average(counts):
    return reduce(operator.add, counts) / len(counts)


if __name__ == '__main__':
    rospy.init_node('object_counter')
    sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
    with sm:
        sm1 = getWaitDoorMachine()
        smach.StateMachine.add('WAIT_DOOR',
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_X',
                                   'error': 'aborted',
                               })
        smx = getGoToFixedMachine('pass')
        smach.StateMachine.add('GOTO_X',
                               smx,
                               transitions={
                                   'succeeded': 'GOTO_1',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
        sm2 = getGoToFixedMachine('observation')
        smach.StateMachine.add('GOTO_1',
                               sm2,
                               transitions={
                                   'succeeded': 'COUNT_OBJECTS',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
Exemple #5
0
from butia_behavior.machines import getWaitDoorMachine, getGoToFixedMachine
from butia_behavior.states import SaySomethingState
from butia_behavior.states import WaitTopicState

if __name__ == '__main__':
    rospy.init_node('inspection')
    sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
    with sm:
        sm1 = getWaitDoorMachine()
        smach.StateMachine.add('WAIT_DOOR',
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_1',
                                   'error': 'aborted',
                               })
        sm2 = getGoToFixedMachine('examination')
        smach.StateMachine.add('GOTO_1',
                               sm2,
                               transitions={
                                   'succeeded': 'WAIT_HELLO',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
        smach.StateMachine.add('WAIT_HELLO',
                               WaitTopicState('butia_speech/bhd/detected'),
                               transitions={
                                   'succeeded': 'GOTO_2',
                                   'error': 'aborted'
                               })
        sm3 = getGoToFixedMachine('exit')
        smach.StateMachine.add('GOTO_2',
import rospy
import smach
from butia_behavior.machines import getWaitDoorMachine, getGoToFixedMachine, getGoToGripperMachine, getOpenGripperMachine, getCloseGripperMachine
from butia_behavior.states import WaitTopicState, WaitTimeState, SaySomethingState

if __name__ == '__main__':
    rospy.init_node('garbage_node')
    sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
    with sm:
        smach.StateMachine.add('WAIT_DOOR',
                               getWaitDoorMachine(),
                               transitions={
                                   'succeeded': 'GOTO_1',
                                   'error': 'aborted'
                               })
        sm1 = getGoToFixedMachine('garbage1')
        smach.StateMachine.add('GOTO_1',
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_GRIPPER_INITIAL',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
        smach.StateMachine.add('GOTO_GRIPPER_INITIAL',
                               getGoToGripperMachine(0),
                               transitions={
                                   'succeeded': 'OPEN_GRIPPER',
                                   'error': 'aborted'
                               })
        smach.StateMachine.add('OPEN_GRIPPER',
                               getOpenGripperMachine(),
Exemple #7
0
def average(counts):
    return reduce(operator.add, counts) / len(counts)


if __name__ == '__main__':
    rospy.init_node('object_counter')
    sm = smach.StateMachine(outcomes=['succeeded', 'aborted', 'preempted'])
    with sm:
        sm1 = getWaitDoorMachine()
        smach.StateMachine.add('WAIT_DOOR',
                               sm1,
                               transitions={
                                   'succeeded': 'GOTO_1',
                                   'error': 'aborted',
                               })
        sm2 = getGoToFixedMachine('shelf')
        smach.StateMachine.add('GOTO_1',
                               sm2,
                               transitions={
                                   'succeeded': 'COUNT_OBJECTS',
                                   'aborted': 'aborted',
                                   'preempted': 'preempted'
                               })
        sm3 = getClassesCountMachine('butia_vision/or/object_recognition', 20,
                                     max)
        smach.StateMachine.add('COUNT_OBJECTS',
                               sm3,
                               transitions={
                                   'succeeded': 'PREPARE_SPEECH',
                                   'error': 'aborted'
                               })