def __init__(self,minConfidence=90):
        smach.StateMachine.__init__(self, outcomes=['succeeded', 'aborted', 'preempted'],
                                 input_keys=['object_name'], 
                                 output_keys=['standard_error','objectd'])
        
        with self:

            smach.StateMachine.add(
                    'detect_object',
                    detect_object(minConfidence),
                    transitions={'succeeded': 'proces_object', 'aborted': 'aborted', 
                    'preempted': 'preempted'})
            
            smach.StateMachine.add(
                    'proces_object',
                    proces_object(),
                    transitions={'succeeded': 'succeeded', 'aborted': 'aborted', 
                    'preempted': 'preempted'})
Beispiel #2
0
def main():
    rospy.init_node('recognize_obect_test')

    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:
        # smach.StateMachine.add(
        #     'prepare_object',
        #     prepare_detect_object(),
        #     transitions={'succeeded': 'detect_object','aborted' : 'aborted_info'})
        # it call the learn state
        smach.StateMachine.add('detect_object',
                               detect_object(),
                               transitions={
                                   'succeeded': 'detect_print',
                                   'aborted': 'aborted_info'
                               })
        # it prints the standard error
        smach.StateMachine.add('aborted_info',
                               recognize_Object_print(),
                               transitions={
                                   'succeeded': 'succeeded',
                                   'aborted': 'aborted'
                               })
        # it prints the standard error

        sm.userdata.object = None

        smach.StateMachine.add('detect_print',
                               recognize_Object_print(),
                               transitions={
                                   'succeeded': 'aborted_info',
                                   'aborted': 'aborted_info'
                               })

    # This is for the smach_viewer so we can see what is happening, rosrun smach_viewer smach_viewer.py it's cool!
    sis = smach_ros.IntrospectionServer('detect_object_introspection', sm,
                                        '/DFI_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()
def main():
    rospy.init_node('recognize_obect_test')
    
    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:
        # smach.StateMachine.add(
        #     'prepare_object',
        #     prepare_detect_object(),
        #     transitions={'succeeded': 'detect_object','aborted' : 'aborted_info'})
        # it call the learn state
        smach.StateMachine.add(
            'detect_object',
            detect_object(),
            transitions={'succeeded': 'detect_print','aborted' : 'aborted_info'})
        # it prints the standard error
        smach.StateMachine.add(
            'aborted_info',
            recognize_Object_print(),
            transitions={'succeeded': 'succeeded', 'aborted':'aborted'})
         # it prints the standard error
        
        sm.userdata.object=None
        
        smach.StateMachine.add(
            'detect_print',
            recognize_Object_print(),
            transitions={'succeeded': 'aborted_info', 'aborted':'aborted_info'})

    # This is for the smach_viewer so we can see what is happening, rosrun smach_viewer smach_viewer.py it's cool!
    sis = smach_ros.IntrospectionServer(
        'detect_object_introspection', sm, '/DFI_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()
    def __init__(self, minConfidence=90):
        smach.StateMachine.__init__(
            self,
            outcomes=['succeeded', 'aborted', 'preempted'],
            input_keys=['object_name'],
            output_keys=['standard_error', 'objectd'])

        with self:

            smach.StateMachine.add('detect_object',
                                   detect_object(minConfidence),
                                   transitions={
                                       'succeeded': 'proces_object',
                                       'aborted': 'aborted',
                                       'preempted': 'preempted'
                                   })

            smach.StateMachine.add('proces_object',
                                   proces_object(),
                                   transitions={
                                       'succeeded': 'succeeded',
                                       'aborted': 'aborted',
                                       'preempted': 'preempted'
                                   })