Example #1
0
    def __init__(self,Time=30,bucle=True,calibrate=False,Time_calibrate=12):
        smach.StateMachine.__init__(self, outcomes=['succeeded', 'preempted', 'aborted'],
                    input_keys=[],
                    output_keys=['asr_userSaid', 'standard_error', 'asr_userSaid_tags'])
        
        if calibrate :
            print "Calibrate is true"
            Time=Time_calibrate
        else:
            print "Calibrate is FALSE"
        with self:
            self.userdata.asr_userSaid=None
            self.userdata.standard_error="OK"
            self.userdata.asr_userSaid_tags=None
           
#             # topic reader state
#             smach.StateMachine.add('topicReader',
#                     topic_reader_state(Time,calibrate),
#                     transitions={'succeeded': 'Process', 'aborted': 'check_bucle', 'preempted': 'preempted'})

             # topic reader state
            smach.StateMachine.add('topicReader',
                     topic_reader(Time,calibrate),
                     transitions={'succeeded': 'Process', 'aborted': 'check_bucle', 'preempted': 'preempted'})
            
                        # Process asr_event -> asr_userSaid state       
            smach.StateMachine.add('check_bucle',
                    check_bucle(bucle),
                    transitions={'succeeded': 'topicReader', 'aborted': 'aborted'})
            
            # Process asr_event -> asr_userSaid state       
            smach.StateMachine.add('Process',
                    Extraction_cb(),
                    transitions={'succeeded': 'succeeded'})
Example #2
0
    def __init__(self,
                 Time=30,
                 bucle=True,
                 calibrate=False,
                 Time_calibrate=12):
        smach.StateMachine.__init__(
            self,
            outcomes=['succeeded', 'preempted', 'aborted'],
            input_keys=[],
            output_keys=[
                'asr_userSaid', 'standard_error', 'asr_userSaid_tags'
            ])

        if calibrate:
            print "Calibrate is true"
            Time = Time_calibrate
        else:
            print "Calibrate is FALSE"
        with self:
            self.userdata.asr_userSaid = None
            self.userdata.standard_error = "OK"
            self.userdata.asr_userSaid_tags = None

            #             # topic reader state
            #             smach.StateMachine.add('topicReader',
            #                     topic_reader_state(Time,calibrate),
            #                     transitions={'succeeded': 'Process', 'aborted': 'check_bucle', 'preempted': 'preempted'})

            # topic reader state
            smach.StateMachine.add('topicReader',
                                   topic_reader(Time, calibrate),
                                   transitions={
                                       'succeeded': 'Process',
                                       'aborted': 'check_bucle',
                                       'preempted': 'preempted'
                                   })

            # Process asr_event -> asr_userSaid state
            smach.StateMachine.add('check_bucle',
                                   check_bucle(bucle),
                                   transitions={
                                       'succeeded': 'topicReader',
                                       'aborted': 'aborted'
                                   })

            # Process asr_event -> asr_userSaid state
            smach.StateMachine.add('Process',
                                   Extraction_cb(),
                                   transitions={'succeeded': 'succeeded'})
def main():
    rospy.init_node('asr_topic_reader_testing')
    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:
        
        topic_time_out = 30
        
        smach.StateMachine.add(
            'dummy_state',
            topic_reader(topic_time_out),
            transitions={'succeeded': 'Printing','preempted':'preempted', 'aborted':'aborted'})
        smach.StateMachine.add(
            'Printing',
            PrintUserdataPose(),
            transitions={'succeeded': 'succeeded','preempted':'preempted', 'aborted':'aborted'})

    sm.execute()
    rospy.spin()
def main():
    rospy.init_node('asr_topic_reader_testing')
    sm = smach.StateMachine(outcomes=['succeeded', 'preempted', 'aborted'])
    with sm:

        topic_time_out = 30

        smach.StateMachine.add('dummy_state',
                               topic_reader(topic_time_out),
                               transitions={
                                   'succeeded': 'Printing',
                                   'preempted': 'preempted',
                                   'aborted': 'aborted'
                               })
        smach.StateMachine.add('Printing',
                               PrintUserdataPose(),
                               transitions={
                                   'succeeded': 'succeeded',
                                   'preempted': 'preempted',
                                   'aborted': 'aborted'
                               })

    sm.execute()
    rospy.spin()