示例#1
0
    def create(self):
        # x:260 y:496, x:32 y:439
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:65 y:30
            OperatableStateMachine.add(
                'hsr_SpeechRecognition',
                hsr_SpeechRecognition(topic="julius"),
                transitions={'recognition': 'hsr_SpcofTraining'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'recognition'})

            # x:472 y:346
            OperatableStateMachine.add('hsr_SpcofMove',
                                       hsr_SpcofMove(),
                                       transitions={
                                           'move': 'tts2',
                                           'failed': 'hsr_SpcofMove'
                                       },
                                       autonomy={
                                           'move': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_name': 'recognition',
                                           'move_text': 'move_text',
                                           'move_pose': 'move_pose',
                                           'arrive_text': 'arrive_text'
                                       })

            # x:630 y:463
            OperatableStateMachine.add('hsr_MoveBase',
                                       hsr_MoveBase(),
                                       transitions={
                                           'succeeded': 'tts3',
                                           'failed': 'hsr_MoveBase'
                                       },
                                       autonomy={
                                           'succeeded': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'request': 'move_pose'})

            # x:498 y:122
            OperatableStateMachine.add(
                'tts1',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'spcof_text'})

            # x:634 y:376
            OperatableStateMachine.add(
                'tts2',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_MoveBase'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'move_text'})

            # x:631 y:560
            OperatableStateMachine.add(
                'tts3',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'arrive_text'})

            # x:483 y:27
            OperatableStateMachine.add('hsr_SpcofTraining',
                                       hsr_SpcofTraining(),
                                       transitions={'completed': 'tts1'},
                                       autonomy={'completed': Autonomy.Off},
                                       remapping={
                                           'request': 'recognition',
                                           'spcof_text': 'spcof_text'
                                       })

        return _state_machine
示例#2
0
	def create(self):
		# x:1111 y:187, x:1077 y:300
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]
		
		# [/MANUAL_CREATE]

		# x:30 y:365
		_sm_follow_me_0 = OperatableStateMachine(outcomes=['completed'], input_keys=['tts_text', 'follow_me'])

		with _sm_follow_me_0:
			# x:43 y:153
			OperatableStateMachine.add('hsr_FollowMe',
										hsr_FollowMe(),
										transitions={'continue': 'tts_Followme'},
										autonomy={'continue': Autonomy.Off},
										remapping={'request': 'follow_me'})

			# x:204 y:150
			OperatableStateMachine.add('tts_Followme',
										hsr_TtsInputKey(),
										transitions={'completed': 'completed'},
										autonomy={'completed': Autonomy.Off},
										remapping={'tts_text': 'tts_text'})


		# x:575 y:100, x:568 y:39
		_sm_taketheobject_1 = OperatableStateMachine(outcomes=['continue', 'failed'])

		with _sm_taketheobject_1:
			# x:209 y:40
			OperatableStateMachine.add('tts_AllRight',
										hsr_TtsInputParameter(text="All right.", language="en", delay=2),
										transitions={'completed': 'CloseTheHand'},
										autonomy={'completed': Autonomy.Off})

			# x:385 y:38
			OperatableStateMachine.add('CloseTheHand',
										hsr_GrippingObject(grasp_force=0.7, mode=True),
										transitions={'continue': 'continue', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'grasp_success': 'grasp_success'})


		# x:1077 y:108
		_sm_goto_2 = OperatableStateMachine(outcomes=['completed'], input_keys=['move'])

		with _sm_goto_2:
			# x:43 y:31
			OperatableStateMachine.add('SpcoMoveEntrance',
										hsr_SpcofMove(),
										transitions={'move': 'tts_GoTo', 'failed': 'SpcoMoveEntrance'},
										autonomy={'move': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'move_name': 'move', 'move_text': 'move_text', 'move_pose': 'move_pose', 'arrive_text': 'arrive_text'})

			# x:221 y:31
			OperatableStateMachine.add('tts_GoTo',
										hsr_TtsInputKey(),
										transitions={'completed': 'Move'},
										autonomy={'completed': Autonomy.Off},
										remapping={'tts_text': 'move_text'})

			# x:406 y:29
			OperatableStateMachine.add('Move',
										hsr_MoveBase(),
										transitions={'succeeded': 'tts_Arrived', 'failed': 'Limit_checker'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})

			# x:232 y:161
			OperatableStateMachine.add('tts_FailedMove',
										hsr_TtsInputParameter(text="I failed to make the planning. I will try again.", language="en", delay=2),
										transitions={'completed': 'SpcoMoveEntrance'},
										autonomy={'completed': Autonomy.Off})

			# x:615 y:28
			OperatableStateMachine.add('tts_Arrived',
										hsr_TtsInputKey(),
										transitions={'completed': 'completed'},
										autonomy={'completed': Autonomy.Off},
										remapping={'tts_text': 'arrive_text'})

			# x:480 y:168
			OperatableStateMachine.add('Limit_checker',
										hsr_try_limit(),
										transitions={'give_up': 'tts_GiveupMove', 'try_again': 'tts_FailedMove'},
										autonomy={'give_up': Autonomy.Off, 'try_again': Autonomy.Off})

			# x:634 y:164
			OperatableStateMachine.add('tts_GiveupMove',
										hsr_TtsInputParameter(text="Sorry. I gave up.", language="en", delay=2),
										transitions={'completed': 'completed'},
										autonomy={'completed': Autonomy.Off})


		# x:30 y:365
		_sm_learnspatialconcept_3 = OperatableStateMachine(outcomes=['completed'], input_keys=['training'])

		with _sm_learnspatialconcept_3:
			# x:180 y:40
			OperatableStateMachine.add('hsr_SpcofTraining',
										hsr_SpcofTraining(),
										transitions={'completed': 'tts_Spco_Result'},
										autonomy={'completed': Autonomy.Off},
										remapping={'request': 'training', 'spcof_text': 'spcof_text'})

			# x:30 y:42
			OperatableStateMachine.add('tts_Spco_Result',
										hsr_TtsInputKey(),
										transitions={'completed': 'completed'},
										autonomy={'completed': Autonomy.Off},
										remapping={'tts_text': 'spcof_text'})


		# x:373 y:54
		_sm_start_4 = OperatableStateMachine(outcomes=['completed'])

		with _sm_start_4:
			# x:30 y:43
			OperatableStateMachine.add('hsr_MoveNeutral',
										hsr_MoveNeutral(),
										transitions={'continue': 'completed'},
										autonomy={'continue': Autonomy.Off})



		with _state_machine:
			# x:60 y:42
			OperatableStateMachine.add('Start',
										_sm_start_4,
										transitions={'completed': 'hsr_SpeechRecognition'},
										autonomy={'completed': Autonomy.Inherit})

			# x:442 y:223
			OperatableStateMachine.add('LearnSpatialConcept',
										_sm_learnspatialconcept_3,
										transitions={'completed': 'hsr_SpeechRecognition'},
										autonomy={'completed': Autonomy.Inherit},
										remapping={'training': 'training'})

			# x:464 y:310
			OperatableStateMachine.add('GoTo',
										_sm_goto_2,
										transitions={'completed': 'tts_next_command'},
										autonomy={'completed': Autonomy.Inherit},
										remapping={'move': 'move'})

			# x:885 y:279
			OperatableStateMachine.add('tts_FinishDemonstration',
										hsr_TtsInputParameter(text="本日はオープンキャンパスにご来場いただきありがとうございました。ぜひ立命館に来てくださいね!", language="ja", delay=0),
										transitions={'completed': 'finished'},
										autonomy={'completed': Autonomy.Off})

			# x:228 y:173
			OperatableStateMachine.add('tts_next_command',
										hsr_TtsInputParameter(text="Please give me the next command", language="en", delay=2),
										transitions={'completed': 'hsr_SpeechRecognition'},
										autonomy={'completed': Autonomy.Off})

			# x:746 y:176
			OperatableStateMachine.add('hsr_CourseDemo',
										hsr_CourseDemo(),
										transitions={'follow_me': 'Follow Me', 'retry_recognition': 'tts_RetryRecognition', 'data': 'tts_RetryRecognition', 'learn': 'LearnSpatialConcept', 'goto': 'GoTo', 'finish': 'tts_FinishDemonstration', 'start_position': 'tts_RetryRecognition', 'take_this': 'TakeTheObject'},
										autonomy={'follow_me': Autonomy.Off, 'retry_recognition': Autonomy.Off, 'data': Autonomy.Off, 'learn': Autonomy.Off, 'goto': Autonomy.Off, 'finish': Autonomy.Off, 'start_position': Autonomy.Off, 'take_this': Autonomy.Off},
										remapping={'recognition': 'recognition', 'follow_me': 'follow_me', 'training': 'training', 'tts_text': 'tts_text', 'move': 'move'})

			# x:55 y:167
			OperatableStateMachine.add('hsr_SpeechRecognition',
										hsr_SpeechRecognition(topic="/julius/speech2text/en"),
										transitions={'recognition': 'hsr_CourseDemo'},
										autonomy={'recognition': Autonomy.Off},
										remapping={'recognition': 'recognition'})

			# x:237 y:417
			OperatableStateMachine.add('hsr_MoveNeutralAgain',
										hsr_MoveNeutral(),
										transitions={'continue': 'hsr_SpeechRecognition'},
										autonomy={'continue': Autonomy.Off})

			# x:463 y:415
			OperatableStateMachine.add('TakeTheObject',
										_sm_taketheobject_1,
										transitions={'continue': 'hsr_MoveNeutralAgain', 'failed': 'hsr_SpeechRecognition'},
										autonomy={'continue': Autonomy.Inherit, 'failed': Autonomy.Inherit})

			# x:446 y:106
			OperatableStateMachine.add('tts_RetryRecognition',
										hsr_TtsInputParameter(text="Could you speak again?", language="en", delay=2),
										transitions={'completed': 'tts_next_command'},
										autonomy={'completed': Autonomy.Off})

			# x:503 y:3
			OperatableStateMachine.add('Follow Me',
										_sm_follow_me_0,
										transitions={'completed': 'hsr_SpeechRecognition'},
										autonomy={'completed': Autonomy.Inherit},
										remapping={'tts_text': 'tts_text', 'follow_me': 'follow_me'})


		return _state_machine
    def create(self):
        # x:1258 y:287, x:1255 y:399
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:54 y:72
            OperatableStateMachine.add(
                'hsr_JointPose_FindObject',
                hsr_JointPose(arm_lift_joint=0.0,
                              arm_flex_joint=0.0,
                              arm_roll_joint=0.0,
                              wrist_flex_joint=-3.14 / 2,
                              wrist_roll_joint=0.0,
                              head_pan_joint=-1.3,
                              head_tilt_joint=-0.8),
                transitions={'continue': 'hsr_SpeechRecognition'},
                autonomy={'continue': Autonomy.Off})

            # x:1046 y:79
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_1',
                hsr_ViewMarkerArray(),
                transitions={'continue': 'hsr_ImageCapture'},
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'greeeedy'})

            # x:272 y:163
            OperatableStateMachine.add('hsr_SetObjectState_1',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_1',
                                           'failed': 'hsr_SetObjectState_1'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_order',
                                           'object_pose': 'tidy_pose'
                                       })

            # x:1046 y:332
            OperatableStateMachine.add(
                'hsr_SpaCoTyInstruction',
                hsr_SpaCoTyInstruction(save_folder="sim_st1"),
                transitions={
                    'datadata': 'finished',
                    'training': 'finished',
                    'tidy_baseline_nearly': 'hsr_MakeFile_Near',
                    'tidy_baseline_randomly': 'hsr_MakeFile_Random',
                    'tidy_greedy': 'hsr_MakeFile_Greedy',
                    'failed': 'failed',
                    'end': 'finished'
                },
                autonomy={
                    'datadata': Autonomy.Off,
                    'training': Autonomy.Off,
                    'tidy_baseline_nearly': Autonomy.Off,
                    'tidy_baseline_randomly': Autonomy.Off,
                    'tidy_greedy': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'end': Autonomy.Off
                },
                remapping={
                    'sentence': 'sentence',
                    'move_name': 'move_name',
                    'save_folder': 'save_folder'
                })

            # x:914 y:483
            OperatableStateMachine.add(
                'hsr_GetObjectState_2',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_2',
                    'failed': 'hsr_GetObjectState_2'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'neaaaar',
                    'object_states_init': 'init_neaaar'
                })

            # x:1055 y:644
            OperatableStateMachine.add(
                'hsr_GetObjectState_3',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_3',
                    'failed': 'hsr_GetObjectState_3'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'randommmm',
                    'object_states_init': 'init_randommm'
                })

            # x:723 y:482
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_2',
                hsr_ViewMarkerArray(),
                transitions={
                    'continue': 'hsr_SelectTidyObjectandPosefromDatasetUltra'
                },
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'neaaaar'})

            # x:805 y:644
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_3',
                hsr_ViewMarkerArray(),
                transitions={
                    'continue': 'hsr_SelectTidyObjectandPoseRandomlyUltra'
                },
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'randommmm'})

            # x:254 y:478
            OperatableStateMachine.add('hsr_SetObjectState_2',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_2',
                                           'failed': 'hsr_SetObjectState_2'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_name_db',
                                           'object_pose': 'tidy_pose_db'
                                       })

            # x:316 y:642
            OperatableStateMachine.add('hsr_SetObjectState_3',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_3',
                                           'failed': 'hsr_SetObjectState_3'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_name_random',
                                           'object_pose': 'tidy_pose_random'
                                       })

            # x:1051 y:157
            OperatableStateMachine.add(
                'hsr_GetObjectState_1',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_1',
                    'failed': 'hsr_GetObjectState_1'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'greeeedy',
                    'object_states_init': 'init_greeedy'
                })

            # x:510 y:643
            OperatableStateMachine.add(
                'hsr_SelectTidyObjectandPoseRandomlyUltra',
                hsr_SelectTidyObjectandPoseRandomlyUltra(),
                transitions={'completed': 'hsr_SetObjectState_3'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'randommmm',
                    'tidy_name_random': 'tidy_name_random',
                    'tidy_pose_random': 'tidy_pose_random'
                })

            # x:424 y:481
            OperatableStateMachine.add(
                'hsr_SelectTidyObjectandPosefromDatasetUltra',
                hsr_SelectTidyObjectandPosefromDatasetUltra(),
                transitions={'completed': 'hsr_SetObjectState_2'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'neaaaar',
                    'tidy_name_db': 'tidy_name_db',
                    'tidy_pose_db': 'tidy_pose_db'
                })

            # x:523 y:163
            OperatableStateMachine.add('hsr_Switcher',
                                       hsr_Switcher(),
                                       transitions={
                                           'true_load': 'hsr_SetObjectState_1',
                                           'false_load': 'hsr_SetObjectState_1'
                                       },
                                       autonomy={
                                           'true_load': Autonomy.Off,
                                           'false_load': Autonomy.Off
                                       },
                                       remapping={'switch': 'name2place'})

            # x:258 y:83
            OperatableStateMachine.add('hsr_SpaCoTyUpdateTidyPose',
                                       hsr_SpaCoTyUpdateTidyPose(),
                                       transitions={
                                           'completed': 'hsr_SetObjectState_1',
                                           'failed':
                                           'hsr_SpaCoTyUpdateTidyPose'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_order',
                                           'tidy_pose_bef': 'tidy_pose',
                                           'tidy_pose_aft': 'tidy_pose'
                                       })

            # x:579 y:329
            OperatableStateMachine.add(
                'hsr_OutputNum',
                hsr_OutputNum(num=0),
                transitions={'end': 'hsr_SpaCoTyInstruction'},
                autonomy={'end': Autonomy.Off},
                remapping={'count_num': 'init_num'})

            # x:707 y:247
            OperatableStateMachine.add('hsr_CountingAddReset_1',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_1',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_1'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:583 y:401
            OperatableStateMachine.add('hsr_CountingAddReset_2',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_2',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_2'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:308 y:553
            OperatableStateMachine.add('hsr_CountingAddReset_3',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_3',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_3'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:44 y:642
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_3',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_3'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_randommm'})

            # x:211 y:399
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_2',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_2'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_neaaar'})

            # x:256 y:244
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_1',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_1'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_greeedy'})

            # x:58 y:326
            OperatableStateMachine.add(
                'hsr_SpeechRecognition',
                hsr_SpeechRecognition(topic="julius/speech2text/en"),
                transitions={'recognition': 'hsr_OutputNum'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'sentence'})

            # x:921 y:403
            OperatableStateMachine.add(
                'hsr_MakeFile_Near',
                hsr_MakeFile(save_file="sim_near_ultra"),
                transitions={'completed': 'hsr_GetObjectState_2'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:1051 y:553
            OperatableStateMachine.add(
                'hsr_MakeFile_Random',
                hsr_MakeFile(save_file="sim_random_ultra"),
                transitions={'completed': 'hsr_GetObjectState_3'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:1054 y:235
            OperatableStateMachine.add(
                'hsr_MakeFile_Greedy',
                hsr_MakeFile(save_file="plus_sim_greedy_ultra"),
                transitions={'completed': 'hsr_GetObjectState_1'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:900 y:79
            OperatableStateMachine.add(
                'hsr_ImageCapture',
                hsr_ImageCapture(
                    rgb_topic="/hsrb/head_rgbd_sensor/rgb/image_rect_color",
                    depth_topic=
                    "/hsrb/head_rgbd_sensor/depth_registered/image_rect_raw",
                    camera_info_topic="/hsrb/head_rgbd_sensor/rgb/camera_info"
                ),
                transitions={
                    'completed': 'hsr_GraspingPointDetectIsbPlus',
                    'failed': 'hsr_CaptureTime'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'rgb_image': 'rgb_image',
                    'depth_image': 'depth_image',
                    'camera_info': 'camera_info'
                })

            # x:902 y:15
            OperatableStateMachine.add('hsr_CaptureTime',
                                       hsr_Counting(max_count=2),
                                       transitions={
                                           'repetition': 'hsr_CaptureTime',
                                           'end': 'hsr_ImageCapture'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={'count_num': 'capture_num'})

            # x:689 y:13
            OperatableStateMachine.add('hsr_DetectErrorIgnoreOnce',
                                       hsr_Counting(max_count=2),
                                       transitions={
                                           'repetition':
                                           'hsr_DetectErrorIgnoreOnce',
                                           'end':
                                           'hsr_GraspingPointDetectIsbPlus'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={'count_num': '_num'})

            # x:679 y:83
            OperatableStateMachine.add(
                'hsr_GraspingPointDetectIsbPlus',
                hsr_GraspingPointDetectIsbPlus(
                    output_topic="/bounding_box_2d_monitor",
                    resnet_model="resnet50",
                    save=True),
                transitions={
                    'completed': 'hsr_SpaCoTyPlanningPlus',
                    'failed': 'hsr_GraspingPointDetectIsbPlus',
                    'yolo_failed': 'hsr_DetectErrorIgnoreOnce'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'yolo_failed': Autonomy.Off
                },
                remapping={
                    'rgb_image': 'rgb_image',
                    'depth_image': 'depth_image',
                    'camera_info': 'camera_info',
                    'grasping_point': 'grasping_point',
                    'grasping_point_feature': 'grasping_point_feature'
                })

            # x:496 y:83
            OperatableStateMachine.add(
                'hsr_SpaCoTyPlanningPlus',
                hsr_SpaCoTyPlanningPlus(),
                transitions={'completed': 'hsr_Switcher'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'greeeedy',
                    'detect_objects_feature': 'grasping_point_feature',
                    'tidy_pose': 'tidy_pose',
                    'tidy_order': 'tidy_order',
                    'name2place': 'name2place'
                })

        return _state_machine
    def create(self):
        # x:30 y:365, x:130 y:365
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:412 y:45
            OperatableStateMachine.add(
                'hsr_SpeechRecognition',
                hsr_SpeechRecognition(topic="/julius/speech2text/en"),
                transitions={'recognition': 'hsr_SpcofInstruction'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'recognition'})

            # x:148 y:287
            OperatableStateMachine.add(
                'hsr_SpcofTraining',
                hsr_SpcofTraining(),
                transitions={'completed': 'hsr_training'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'request': 'output',
                    'spcof_text': 'spcof_text'
                })

            # x:414 y:291
            OperatableStateMachine.add('hsr_SpcofInstruction',
                                       hsr_SpcofInstruction(),
                                       transitions={
                                           'training': 'hsr_SpcofTraining',
                                           'move': 'hsr_SpcofMove'
                                       },
                                       autonomy={
                                           'training': Autonomy.Off,
                                           'move': Autonomy.Off
                                       },
                                       remapping={
                                           'input': 'recognition',
                                           'output': 'output'
                                       })

            # x:710 y:289
            OperatableStateMachine.add('hsr_SpcofMove',
                                       hsr_SpcofMove(),
                                       transitions={
                                           'move': 'tts_move',
                                           'failed': 'tts_cannot_move_2'
                                       },
                                       autonomy={
                                           'move': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'move_name': 'output',
                                           'move_text': 'move_text',
                                           'move_pose': 'move_pose',
                                           'arrive_text': 'arrive_text'
                                       })

            # x:174 y:167
            OperatableStateMachine.add(
                'hsr_training',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'spcof_text'})

            # x:821 y:198
            OperatableStateMachine.add(
                'tts_move',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_MoveBase'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'move_text'})

            # x:826 y:85
            OperatableStateMachine.add('hsr_MoveBase',
                                       hsr_MoveBase(),
                                       transitions={
                                           'succeeded': 'tts_arrive',
                                           'failed': 'tts_cannot_move_1'
                                       },
                                       autonomy={
                                           'succeeded': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={'request': 'move_pose'})

            # x:630 y:17
            OperatableStateMachine.add(
                'tts_arrive',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'arrive_text'})

            # x:633 y:192
            OperatableStateMachine.add(
                'tts_cannot_move_2',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'move_text'})

            # x:626 y:101
            OperatableStateMachine.add(
                'tts_cannot_move_1',
                hsr_TtsInputParameter(text="I cannot move there.",
                                      language="en"),
                transitions={'completed': 'hsr_SpeechRecognition'},
                autonomy={'completed': Autonomy.Off})

        return _state_machine
    def create(self):
        # x:1242 y:251, x:1219 y:335
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:70 y:29
            OperatableStateMachine.add(
                'hsr_JointPose_FindObject',
                hsr_JointPose(arm_lift_joint=0.0,
                              arm_flex_joint=0.0,
                              arm_roll_joint=-3.14 / 2,
                              wrist_flex_joint=-3.14 / 2,
                              wrist_roll_joint=0.0,
                              head_pan_joint=-1.3,
                              head_tilt_joint=-0.8),
                transitions={'continue': 'hsr_SpeechRecognition'},
                autonomy={'continue': Autonomy.Off})

            # x:949 y:83
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_1',
                hsr_ViewMarkerArray(),
                transitions={'continue': 'hsr_SpaCoTyPlanning'},
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'greeeedy'})

            # x:285 y:75
            OperatableStateMachine.add('hsr_SetObjectState_1',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_1',
                                           'failed': 'hsr_SetObjectState_1'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_order',
                                           'object_pose': 'tidy_pose'
                                       })

            # x:1047 y:240
            OperatableStateMachine.add(
                'hsr_SpaCoTyInstruction',
                hsr_SpaCoTyInstruction(save_folder="sim_st1"),
                transitions={
                    'datadata': 'finished',
                    'training': 'finished',
                    'tidy_baseline_nearly': 'hsr_MakeFile_Near',
                    'tidy_baseline_randomly': 'hsr_MakeFile_Random',
                    'tidy_greedy': 'hsr_MakeFile_Greedy',
                    'failed': 'failed',
                    'end': 'finished'
                },
                autonomy={
                    'datadata': Autonomy.Off,
                    'training': Autonomy.Off,
                    'tidy_baseline_nearly': Autonomy.Off,
                    'tidy_baseline_randomly': Autonomy.Off,
                    'tidy_greedy': Autonomy.Off,
                    'failed': Autonomy.Off,
                    'end': Autonomy.Off
                },
                remapping={
                    'sentence': 'sentence',
                    'move_name': 'move_name',
                    'save_folder': 'save_folder'
                })

            # x:914 y:409
            OperatableStateMachine.add(
                'hsr_GetObjectState_2',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_2',
                    'failed': 'hsr_GetObjectState_2'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'neaaaar',
                    'object_states_init': 'init_neaaar'
                })

            # x:999 y:616
            OperatableStateMachine.add(
                'hsr_GetObjectState_3',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_3',
                    'failed': 'hsr_GetObjectState_3'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'randommmm',
                    'object_states_init': 'init_randommm'
                })

            # x:723 y:407
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_2',
                hsr_ViewMarkerArray(),
                transitions={
                    'continue': 'hsr_SelectTidyObjectandPosefromDatasetUltra'
                },
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'neaaaar'})

            # x:739 y:615
            OperatableStateMachine.add(
                'hsr_ViewMarkerArray_3',
                hsr_ViewMarkerArray(),
                transitions={
                    'continue': 'hsr_SelectTidyObjectandPoseRandomlyUltra'
                },
                autonomy={'continue': Autonomy.Off},
                remapping={'object_points': 'randommmm'})

            # x:251 y:400
            OperatableStateMachine.add('hsr_SetObjectState_2',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_2',
                                           'failed': 'hsr_SetObjectState_2'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_name_db',
                                           'object_pose': 'tidy_pose_db'
                                       })

            # x:265 y:612
            OperatableStateMachine.add('hsr_SetObjectState_3',
                                       hsr_SetObjectState(),
                                       transitions={
                                           'completed':
                                           'hsr_CountingAddReset_3',
                                           'failed': 'hsr_SetObjectState_3'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_name_random',
                                           'object_pose': 'tidy_pose_random'
                                       })

            # x:953 y:152
            OperatableStateMachine.add(
                'hsr_GetObjectState_1',
                hsr_GetObjectState(yolo_yaml="yolov3-isb-tidy.json"),
                transitions={
                    'completed': 'hsr_ViewMarkerArray_1',
                    'failed': 'hsr_GetObjectState_1'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={
                    'load_file': 'load_file',
                    'object_states': 'greeeedy',
                    'object_states_init': 'init_greeedy'
                })

            # x:441 y:614
            OperatableStateMachine.add(
                'hsr_SelectTidyObjectandPoseRandomlyUltra',
                hsr_SelectTidyObjectandPoseRandomlyUltra(),
                transitions={'completed': 'hsr_SetObjectState_3'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'randommmm',
                    'tidy_name_random': 'tidy_name_random',
                    'tidy_pose_random': 'tidy_pose_random'
                })

            # x:421 y:405
            OperatableStateMachine.add(
                'hsr_SelectTidyObjectandPosefromDatasetUltra',
                hsr_SelectTidyObjectandPosefromDatasetUltra(),
                transitions={'completed': 'hsr_SetObjectState_2'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'neaaaar',
                    'tidy_name_db': 'tidy_name_db',
                    'tidy_pose_db': 'tidy_pose_db'
                })

            # x:659 y:82
            OperatableStateMachine.add('hsr_Switcher',
                                       hsr_Switcher(),
                                       transitions={
                                           'true_load':
                                           'hsr_SpaCoTyUpdateTidyPose',
                                           'false_load': 'hsr_SetObjectState_1'
                                       },
                                       autonomy={
                                           'true_load': Autonomy.Off,
                                           'false_load': Autonomy.Off
                                       },
                                       remapping={'switch': 'name2place'})

            # x:464 y:80
            OperatableStateMachine.add('hsr_SpaCoTyUpdateTidyPose',
                                       hsr_SpaCoTyUpdateTidyPose(),
                                       transitions={
                                           'completed': 'hsr_SetObjectState_1',
                                           'failed':
                                           'hsr_SpaCoTyUpdateTidyPose'
                                       },
                                       autonomy={
                                           'completed': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'object_name': 'tidy_order',
                                           'tidy_pose_bef': 'tidy_pose',
                                           'tidy_pose_aft': 'tidy_pose'
                                       })

            # x:581 y:238
            OperatableStateMachine.add(
                'hsr_OutputNum',
                hsr_OutputNum(num=0),
                transitions={'end': 'hsr_SpaCoTyInstruction'},
                autonomy={'end': Autonomy.Off},
                remapping={'count_num': 'init_num'})

            # x:584 y:160
            OperatableStateMachine.add('hsr_CountingAddReset_1',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_1',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_1'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:581 y:311
            OperatableStateMachine.add('hsr_CountingAddReset_2',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_2',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_2'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:465 y:506
            OperatableStateMachine.add('hsr_CountingAddReset_3',
                                       hsr_CountingAddReset(max_count=10),
                                       transitions={
                                           'repetition':
                                           'hsr_GetObjectState_3',
                                           'end':
                                           'hsr_ResetObjectStateRandomly_3'
                                       },
                                       autonomy={
                                           'repetition': Autonomy.Off,
                                           'end': Autonomy.Off
                                       },
                                       remapping={
                                           'start_num': 'init_num',
                                           'count_num': 'count_num'
                                       })

            # x:26 y:609
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_3',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_3'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_randommm'})

            # x:221 y:314
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_2',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_2'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_neaaar'})

            # x:254 y:158
            OperatableStateMachine.add(
                'hsr_ResetObjectStateRandomly_1',
                hsr_ResetObjectStateRandomly(),
                transitions={
                    'completed': 'hsr_SpeechRecognition',
                    'failed': 'hsr_ResetObjectStateRandomly_1'
                },
                autonomy={
                    'completed': Autonomy.Off,
                    'failed': Autonomy.Off
                },
                remapping={'object_states': 'init_greeedy'})

            # x:71 y:239
            OperatableStateMachine.add(
                'hsr_SpeechRecognition',
                hsr_SpeechRecognition(topic="julius/speech2text/en"),
                transitions={'recognition': 'hsr_OutputNum'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'sentence'})

            # x:934 y:317
            OperatableStateMachine.add(
                'hsr_MakeFile_Near',
                hsr_MakeFile(save_file="sim_near_ultra"),
                transitions={'completed': 'hsr_GetObjectState_2'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:995 y:512
            OperatableStateMachine.add(
                'hsr_MakeFile_Random',
                hsr_MakeFile(save_file="sim_random_ultra"),
                transitions={'completed': 'hsr_GetObjectState_3'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:1096 y:151
            OperatableStateMachine.add(
                'hsr_MakeFile_Greedy',
                hsr_MakeFile(save_file="sim_greedy_ultra"),
                transitions={'completed': 'hsr_GetObjectState_1'},
                autonomy={'completed': Autonomy.Off},
                remapping={'load_file': 'load_file'})

            # x:794 y:82
            OperatableStateMachine.add(
                'hsr_SpaCoTyPlanning',
                hsr_SpaCoTyPlanning(),
                transitions={'completed': 'hsr_Switcher'},
                autonomy={'completed': Autonomy.Off},
                remapping={
                    'load_file': 'load_file',
                    'detect_objects': 'greeeedy',
                    'tidy_pose': 'tidy_pose',
                    'tidy_order': 'tidy_order',
                    'name2place': 'name2place'
                })

        return _state_machine
	def create(self):
		# x:686 y:318, x:620 y:319
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])

		# Additional creation code can be added inside the following tags
		# [MANUAL_CREATE]

		# [/MANUAL_CREATE]

		# x:30 y:514, x:130 y:514, x:230 y:514, x:330 y:514
		_sm_grasp_phase_0 = OperatableStateMachine(outcomes=['succeeded', 'failed', 'planning_failed', 'control_failed'], input_keys=['move_pose', 'xtion_point', 'object', 'failed_objects'], output_keys=['selected_object_name', 'selected_object_status'])

		with _sm_grasp_phase_0:
			# x:57 y:44
			OperatableStateMachine.add('hsr_MoveBase_grasp',
										hsr_MoveBase(),
										transitions={'succeeded': 'hsr_JointPose_xtion', 'failed': 'hsr_MoveBase_grasp'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})

			# x:397 y:44
			OperatableStateMachine.add('hsr_XtionPoint_grasp',
										hsr_XtionPoint(ref_frame_id="map"),
										transitions={'finish': 'hsr_ImageCapture'},
										autonomy={'finish': Autonomy.Off},
										remapping={'xtion_point': 'xtion_point'})

			# x:776 y:42
			OperatableStateMachine.add('hsr_ImageCapture',
										hsr_ImageCapture(rgb_topic="/hsrb/head_rgbd_sensor/rgb/image_rect_color", depth_topic="/hsrb/head_rgbd_sensor/depth_registered/image_rect_raw", camera_info_topic="/hsrb/head_rgbd_sensor/rgb/camera_info"),
										transitions={'completed': 'hsr_BoundingBox2D', 'failed': 'hsr_ImageCapture'},
										autonomy={'completed': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'rgb_image': 'rgb_image', 'depth_image': 'depth_image', 'camera_info': 'camera_info'})

			# x:935 y:41
			OperatableStateMachine.add('hsr_BoundingBox2D',
										hsr_BoundingBox2D(output_topic="/bounding_box_2d_monitor"),
										transitions={'completed': 'hsr_GraspingPointDetect', 'failed': 'hsr_BoundingBox2D'},
										autonomy={'completed': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'rgb_image': 'rgb_image', 'depth_image': 'depth_image', 'camera_info': 'camera_info', 'detection': 'detection', 'grasping_point': 'grasping_point'})

			# x:1107 y:40
			OperatableStateMachine.add('hsr_GraspingPointDetect',
										hsr_GraspingPointDetect(output_topic="/bounding_box_2d_monitor"),
										transitions={'completed': 'hsr_Tf2', 'failed': 'hsr_GraspingPointDetect'},
										autonomy={'completed': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'rgb_image': 'rgb_image', 'depth_image': 'depth_image', 'camera_info': 'camera_info', 'detection': 'detection', 'grasping_point': 'grasping_point'})

			# x:1289 y:40
			OperatableStateMachine.add('hsr_Tf2',
										hsr_Tf2(before="head_rgbd_sensor_rgb_frame", after="map"),
										transitions={'continue': 'hsr_PoseDecision', 'failed': 'hsr_Tf2'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'before_pose': 'grasping_point', 'after_pose': 'after_pose'})

			# x:1261 y:139
			OperatableStateMachine.add('hsr_PoseDecision',
										hsr_PoseDecision(offset=None),
										transitions={'continue': 'hsr_ViewMarker', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'target_poses': 'after_pose', 'category': 'object', 'failed_objects': 'failed_objects', 'selected_pose_approach': 'selected_pose_approach', 'selected_pose_grasp': 'selected_pose_grasp', 'selected_object_name': 'selected_object_name', 'selected_object_status': 'selected_object_status'})

			# x:931 y:140
			OperatableStateMachine.add('hsr_OpenHand_grasp',
										hsr_GrippingObject(grasp_force=0.7, mode=False),
										transitions={'continue': 'hsr_JointPose_OpenHand', 'failed': 'hsr_OpenHand_grasp'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'grasp_success': 'grasp_success'})

			# x:514 y:140
			OperatableStateMachine.add('hsr_MoveitToPoseGoalAction_grasp',
										hsr_MoveitToPoseGoalAction(move_group='whole_body', action_topic='/move_group'),
										transitions={'reached': 'hsr_CloseHand', 'planning_failed': 'planning_failed', 'control_failed': 'control_failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'pose_goal': 'selected_pose_grasp', 'move_status': 'selected_object_status'})

			# x:318 y:142
			OperatableStateMachine.add('hsr_CloseHand',
										hsr_GrippingObject(grasp_force=0.7, mode=True),
										transitions={'continue': 'hsr_MoveBase_grasp_back', 'failed': 'failed'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'grasp_success': 'selected_object_status'})

			# x:243 y:43
			OperatableStateMachine.add('hsr_JointPose_xtion',
										hsr_JointPose(arm_lift_joint=0.4, arm_flex_joint=-2.619, arm_roll_joint=0.0, wrist_flex_joint=-3.14/2, wrist_roll_joint=0.0, head_pan_joint=0.0, head_tilt_joint=0.0),
										transitions={'continue': 'hsr_XtionPoint_grasp'},
										autonomy={'continue': Autonomy.Off})

			# x:743 y:140
			OperatableStateMachine.add('hsr_JointPose_OpenHand',
										hsr_JointPose(arm_lift_joint=0.4, arm_flex_joint=-3.14/4, arm_roll_joint=0.0, wrist_flex_joint=-3.14/4, wrist_roll_joint=0.0, head_pan_joint=0.0, head_tilt_joint=0.0),
										transitions={'continue': 'hsr_MoveitToPoseGoalAction_grasp'},
										autonomy={'continue': Autonomy.Off})

			# x:1110 y:139
			OperatableStateMachine.add('hsr_ViewMarker',
										hsr_ViewMarker(),
										transitions={'continue': 'hsr_OpenHand_grasp', 'failed': 'hsr_ViewMarker'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'view_pose': 'selected_pose_grasp'})

			# x:30 y:144
			OperatableStateMachine.add('hsr_MoveBase_grasp_back',
										hsr_MoveBase(),
										transitions={'succeeded': 'succeeded', 'failed': 'failed'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})


		# x:30 y:514, x:130 y:514, x:230 y:514
		_sm_put_phase_1 = OperatableStateMachine(outcomes=['control_failed', 'succeeded', 'failed'], input_keys=['move_pose', 'xtion_point', 'arm_pose'], output_keys=['selected_object_name'])

		with _sm_put_phase_1:
			# x:30 y:152
			OperatableStateMachine.add('hsr_MoveBase_put',
										hsr_MoveBase(),
										transitions={'succeeded': 'hsr_XtionPoint_put', 'failed': 'hsr_MoveBase_put'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})

			# x:233 y:151
			OperatableStateMachine.add('hsr_XtionPoint_put',
										hsr_XtionPoint(ref_frame_id="map"),
										transitions={'finish': 'hsr_MoveitToPoseGoalAction_put'},
										autonomy={'finish': Autonomy.Off},
										remapping={'xtion_point': 'xtion_point'})

			# x:445 y:40
			OperatableStateMachine.add('hsr_MoveitToPoseGoalAction_put',
										hsr_MoveitToPoseGoalAction(move_group='whole_body', action_topic='/move_group'),
										transitions={'reached': 'hsr_OpenHand_put', 'planning_failed': 'hsr_MoveitToPoseGoalAction_put', 'control_failed': 'control_failed'},
										autonomy={'reached': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
										remapping={'pose_goal': 'arm_pose', 'move_status': 'selected_object_name'})

			# x:233 y:43
			OperatableStateMachine.add('hsr_OpenHand_put',
										hsr_GrippingObject(grasp_force=0.7, mode=False),
										transitions={'continue': 'hsr_MoveBase_put_back', 'failed': 'hsr_OpenHand_put'},
										autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'grasp_success': 'grasp_success'})

			# x:30 y:43
			OperatableStateMachine.add('hsr_MoveBase_put_back',
										hsr_MoveBase(),
										transitions={'succeeded': 'succeeded', 'failed': 'failed'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})



		with _state_machine:
			# x:30 y:26
			OperatableStateMachine.add('hsr_SpeechRecognition',
										hsr_SpeechRecognition(topic="/test"),
										transitions={'recognition': 'hsr_TidyUpDummy'},
										autonomy={'recognition': Autonomy.Off},
										remapping={'recognition': 'recognition'})

			# x:37 y:237
			OperatableStateMachine.add('hsr_TidyUpStage2',
										hsr_TidyUpStage2(),
										transitions={'retry': 'hsr_SpeechRecognition', 'grasp': 'grasp_phase', 'put': 'put_phase', 'kitchen': 'hsr_MoveBase_kitchen'},
										autonomy={'retry': Autonomy.Off, 'grasp': Autonomy.Off, 'put': Autonomy.Off, 'kitchen': Autonomy.Off},
										remapping={'recognition': 'recognition', 'grasp_object': 'selected_object_name', 'grasp_status': 'selected_object_status', 'move_pose': 'move_pose', 'xtion_point': 'xtion_point', 'arm_pose': 'arm_pose', 'object': 'object', 'failed_objects': 'failed_objects'})

			# x:453 y:24
			OperatableStateMachine.add('hsr_MoveBase_kitchen',
										hsr_MoveBase(),
										transitions={'succeeded': 'hsr_TtsInputParameter', 'failed': 'hsr_MoveBase_kitchen'},
										autonomy={'succeeded': Autonomy.Off, 'failed': Autonomy.Off},
										remapping={'request': 'move_pose'})

			# x:241 y:25
			OperatableStateMachine.add('hsr_TtsInputParameter',
										hsr_TtsInputParameter(text="discard or tidy up?", language="en"),
										transitions={'completed': 'hsr_SpeechRecognition'},
										autonomy={'completed': Autonomy.Off})

			# x:140 y:119
			OperatableStateMachine.add('hsr_TidyUpDummy',
										hsr_TidyUpDummy(),
										transitions={'continue': 'hsr_TidyUpStage2'},
										autonomy={'continue': Autonomy.Off},
										remapping={'dummy1': 'selected_object_name', 'dummy2': 'selected_object_status'})

			# x:336 y:425
			OperatableStateMachine.add('put_phase',
										_sm_put_phase_1,
										transitions={'control_failed': 'failed', 'succeeded': 'hsr_TidyUpStage2', 'failed': 'hsr_TidyUpStage2'},
										autonomy={'control_failed': Autonomy.Inherit, 'succeeded': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'move_pose': 'move_pose', 'xtion_point': 'xtion_point', 'arm_pose': 'arm_pose', 'selected_object_name': 'selected_object_name'})

			# x:333 y:189
			OperatableStateMachine.add('grasp_phase',
										_sm_grasp_phase_0,
										transitions={'succeeded': 'hsr_TidyUpStage2', 'failed': 'hsr_TidyUpStage2', 'planning_failed': 'hsr_TidyUpStage2', 'control_failed': 'failed'},
										autonomy={'succeeded': Autonomy.Inherit, 'failed': Autonomy.Inherit, 'planning_failed': Autonomy.Inherit, 'control_failed': Autonomy.Inherit},
										remapping={'move_pose': 'move_pose', 'xtion_point': 'xtion_point', 'object': 'object', 'failed_objects': 'failed_objects', 'selected_object_name': 'selected_object_name', 'selected_object_status': 'selected_object_status'})


		return _state_machine
    def create(self):
        # x:745 y:443, x:130 y:478
        _state_machine = OperatableStateMachine(
            outcomes=['finished', 'failed'])

        # Additional creation code can be added inside the following tags
        # [MANUAL_CREATE]

        # [/MANUAL_CREATE]

        with _state_machine:
            # x:67 y:42
            OperatableStateMachine.add(
                'hsr_AskPlace',
                hsr_AskPlace(),
                transitions={'continue': 'tts_ask_place'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'place_name': 'place_name',
                    'question': 'question',
                    'place_number': 'place_number'
                })

            # x:284 y:43
            OperatableStateMachine.add(
                'tts_ask_place',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition3'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'question'})

            # x:447 y:38
            OperatableStateMachine.add(
                'hsr_SpeechRecognition3',
                hsr_SpeechRecognition(topic="/julius/speech2text/en"),
                transitions={'recognition': 'hsr_YesNoAsk'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'recognition'})

            # x:283 y:158
            OperatableStateMachine.add(
                'hsr_YesNoAsk',
                hsr_YesNoAsk(),
                transitions={
                    'yes': 'hsr_ReadTask',
                    'no': 'hsr_AskPlace'
                },
                autonomy={
                    'yes': Autonomy.Off,
                    'no': Autonomy.Off
                },
                remapping={'recognition': 'recognition'})

            # x:687 y:217
            OperatableStateMachine.add(
                'hsr_AskObject',
                hsr_AskObject(),
                transitions={'continue': 'tts_AskObject'},
                autonomy={'continue': Autonomy.Off},
                remapping={
                    'object_list': 'target_list',
                    'object_name': 'object_name',
                    'question': 'question'
                })

            # x:507 y:218
            OperatableStateMachine.add('hsr_ReadTask',
                                       hsr_ReadTask(),
                                       transitions={
                                           'continue': 'hsr_AskObject',
                                           'failed': 'failed'
                                       },
                                       autonomy={
                                           'continue': Autonomy.Off,
                                           'failed': Autonomy.Off
                                       },
                                       remapping={
                                           'place_num': 'place_number',
                                           'target_list': 'target_list'
                                       })

            # x:836 y:212
            OperatableStateMachine.add(
                'tts_AskObject',
                hsr_TtsInputKey(),
                transitions={'completed': 'hsr_SpeechRecognition4'},
                autonomy={'completed': Autonomy.Off},
                remapping={'tts_text': 'question'})

            # x:994 y:209
            OperatableStateMachine.add(
                'hsr_SpeechRecognition4',
                hsr_SpeechRecognition(topic="/julius/speech2text/en"),
                transitions={'recognition': 'hsr_YesNoAsk_2'},
                autonomy={'recognition': Autonomy.Off},
                remapping={'recognition': 'recognition'})

            # x:700 y:327
            OperatableStateMachine.add(
                'hsr_YesNoAsk_2',
                hsr_YesNoAsk(),
                transitions={
                    'yes': 'finished',
                    'no': 'hsr_AskObject'
                },
                autonomy={
                    'yes': Autonomy.Off,
                    'no': Autonomy.Off
                },
                remapping={'recognition': 'recognition'})

        return _state_machine