Example #1
0
def call_recognize_person(pers):  #TODO  PersonName maybe?

    tosay = "I'm going to recognize " + pers
    speak = speaker(tosay)
    speak.execute()
    rospy.logwarn('call_recognize_person ' + pers)
    #############################################################################
    if SKILLS:
        if (time.time() - TIME_INIT) > 270:
            return "succeeded"

        out = 'aborted'
        tries = 0
        while (out == 'aborted' and tries < 3):
            tries = tries + 1
            sm = recognize_face()
            sm.userdata.name = pers
            out = sm.execute()

        if out == 'succeeded':
            tosay = "I recognized you, " + pers
            speak = speaker(tosay)
            speak.execute()
    #############################################################################
    time.sleep(SLEEP_TIME)
    return "succeeded"
Example #2
0
def call_recognize_person(pers): #TODO  PersonName maybe?

    tosay = "I'm going to recognize " + pers
    speak = speaker(tosay)
    speak.execute()
    rospy.logwarn('call_recognize_person ' + pers)  
    #############################################################################
    if SKILLS :      
        if (time.time()-TIME_INIT) > 270:
            return "succeeded"
        
        out = 'aborted'
        tries = 0
        while(out=='aborted' and tries<3):       
            tries = tries+1
            sm = recognize_face()
            sm.userdata.name = pers
            out = sm.execute()  
               
        if out =='succeeded':
            tosay = "I recognized you, " + pers
            speak = speaker(tosay)
            speak.execute()
    #############################################################################
    time.sleep(SLEEP_TIME)
    return "succeeded" 
def main():
    rospy.init_node('recognize_face_test')

    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:

        # it call the learn state
        smach.StateMachine.add('prepare_face_reconize',
                               prepare_recognize_face(),
                               transitions={
                                   'succeeded': 'detect_face',
                                   'aborted': 'aborted_info'
                               })
        # it call the learn state
        smach.StateMachine.add('detect_face',
                               recognize_face(),
                               transitions={
                                   'succeeded': 'detect_print',
                                   'aborted': 'aborted_info'
                               })
        # it prints the standard error
        smach.StateMachine.add('aborted_info',
                               recognize_Face_error(),
                               transitions={
                                   'succeeded': 'succeeded',
                                   'aborted': 'aborted'
                               })
        # it prints the standard error

        sm.userdata.face = None

        smach.StateMachine.add('detect_print',
                               recognize_Face_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_face_introspection', sm,
                                        '/DFI_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()
def main():
    rospy.init_node('recognize_face_test')
    
    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:
        
        
                # it call the learn state
        smach.StateMachine.add(
            'prepare_face_reconize',
            prepare_recognize_face(),
            transitions={'succeeded': 'detect_face','aborted' : 'aborted_info'})
        # it call the learn state
        smach.StateMachine.add(
            'detect_face',
            recognize_face(),
            transitions={'succeeded': 'detect_print','aborted' : 'aborted_info'})
        # it prints the standard error
        smach.StateMachine.add(
            'aborted_info',
            recognize_Face_error(),
            transitions={'succeeded': 'succeeded', 'aborted':'aborted'})
         # it prints the standard error
        
        sm.userdata.face=None
        
        smach.StateMachine.add(
            'detect_print',
            recognize_Face_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_face_introspection', sm, '/DFI_ROOT')
    sis.start()

    sm.execute()

    rospy.spin()
    sis.stop()