<commit_before>#!/usr/bin/env python
###########################################################
#               WARNING: Generated code!                  #
#              **************************                 #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] tags will be kept.        #
###########################################################

import roslib; roslib.load_manifest('behavior_actionwrapper_guide')
from flexbe_core import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger
from sara_flexbe_states.GetRosParam import GetRosParam
from sara_flexbe_states.set_a_step import Set_a_step
from flexbe_states.calculation_state import CalculationState
from sara_flexbe_states.SetKey import SetKey
from flexbe_states.flexible_calculation_state import FlexibleCalculationState
from flexbe_states.flexible_check_condition_state import FlexibleCheckConditionState
from flexbe_states.log_key_state import LogKeyState
from behavior_action_move.action_move_sm import Action_MoveSM
from flexbe_states.wait_state import WaitState
from sara_flexbe_states.sara_say_key import SaraSayKey
from sara_flexbe_states.sara_set_head_angle import SaraSetHeadAngle
from behavior_action_turn.action_turn_sm import action_turnSM
from sara_flexbe_states.Get_Entity_By_ID import GetEntityByID
from sara_flexbe_states.sara_say import SaraSay
from behavior_wonderlanduniqueenity.wonderlanduniqueenity_sm import WonderlandUniqueEnitySM
# Additional imports can be added inside the following tags
# [MANUAL_IMPORT]

# [/MANUAL_IMPORT]


'''
Created on 05/06/2018
@author: <NAME>
'''
class ActionWrapper_GuideSM(Behavior):
	'''
	action wrapper pour indiquer la route a un operateur.
	'''


	def __init__(self):
		super(ActionWrapper_GuideSM, self).__init__()
		self.name = 'ActionWrapper_Guide'

		# parameters of this behavior

		# references to used behaviors
		self.add_behavior(Action_MoveSM, 'Try to reach/Container/navigate to the point/Action_Move')
		self.add_behavior(action_turnSM, 'Try to reach/check person behind/move head and base/turn around/action_turn')
		self.add_behavior(action_turnSM, 'Try to reach/check person behind/move head and base/turn around/action_turn_2')
		self.add_behavior(WonderlandUniqueEnitySM, 'Try to find area/WonderlandUniqueEnity')
		self.add_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn')
		self.add_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn_2')

		# Additional initialization code can be added inside the following tags
		# [MANUAL_INIT]
        
        # [/MANUAL_INIT]

		# Behavior comments:

		# O 1262 27 
		# Move|n1- Location|n2- Location Container|n3- Location Container

		# O 1260 94 
		# Story|n0- Decompose Command|n1- Find Area|n2- Join Area|n3- END



	def create(self):
		# x:587 y:780, x:781 y:419, x:951 y:679
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed', 'critical_fail'], input_keys=['Action'])
		_state_machine.userdata.Action = ["Guide",'table', 'kitchen']
		_state_machine.userdata.relative = False

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

		# x:30 y:458
		_sm_groupwait_0 = OperatableStateMachine(outcomes=['done'])

		with _sm_groupwait_0:
			# x:30 y:40
			OperatableStateMachine.add('waitwait',
										WaitState(wait_time=20),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off})


		# x:534 y:319
		_sm_move_head_and_base_at_the_end_1 = OperatableStateMachine(outcomes=['failed'])

		with _sm_move_head_and_base_at_the_end_1:
			# x:52 y:31
			OperatableStateMachine.add('setkeyorientation',
										SetKey(Value=1.5),
										transitions={'done': 'action_turn'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'rotation'})

			# x:51 y:114
			OperatableStateMachine.add('action_turn',
										self.use_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn'),
										transitions={'finished': 'turn right head', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'rotation': 'rotation'})

			# x:48 y:272
			OperatableStateMachine.add('wait while head turn',
										WaitState(wait_time=4),
										transitions={'done': 'action_turn_2'},
										autonomy={'done': Autonomy.Off})

			# x:47 y:199
			OperatableStateMachine.add('turn right head',
										SaraSetHeadAngle(pitch=0, yaw=1.57),
										transitions={'done': 'wait while head turn'},
										autonomy={'done': Autonomy.Off})

			# x:45 y:348
			OperatableStateMachine.add('action_turn_2',
										self.use_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn_2'),
										transitions={'finished': 'left to rigth', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'rotation': 'rotation'})

			# x:43 y:592
			OperatableStateMachine.add('left to rigth',
										SaraSetHeadAngle(pitch=0, yaw=-1.57),
										transitions={'done': 'waitwait1'},
										autonomy={'done': Autonomy.Off})

			# x:420 y:602
			OperatableStateMachine.add('right to left',
										SaraSetHeadAngle(pitch=0, yaw=1.57),
										transitions={'done': 'waitwait2'},
										autonomy={'done': Autonomy.Off})

			# x:266 y:541
			OperatableStateMachine.add('waitwait1',
										WaitState(wait_time=8),
										transitions={'done': 'right to left'},
										autonomy={'done': Autonomy.Off})

			# x:236 y:674
			OperatableStateMachine.add('waitwait2',
										WaitState(wait_time=8),
										transitions={'done': 'left to rigth'},
										autonomy={'done': Autonomy.Off})


		# x:231 y:538
		_sm_find_a_human_2 = OperatableStateMachine(outcomes=['finished'], input_keys=['ID'])

		with _sm_find_a_human_2:
			# x:78 y:275
			OperatableStateMachine.add('find the human',
										GetEntityByID(),
										transitions={'found': 'finished', 'not_found': 'find the human'},
										autonomy={'found': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ID': 'ID', 'Entity': 'Entity'})


		# x:446 y:347, x:498 y:126, x:464 y:463
		_sm_move_head_and_base_end__3 = ConcurrencyContainer(outcomes=['failed'], conditions=[
										('finished', [('Groupwait', 'done')]),
										('failed', [('move head and base at the end', 'failed')])
										])

		with _sm_move_head_and_base_end__3:
			# x:132 y:57
			OperatableStateMachine.add('move head and base at the end',
										_sm_move_head_and_base_at_the_end_1,
										transitions={'failed': 'failed'},
										autonomy={'failed': Autonomy.Inherit})

			# x:121 y:218
			OperatableStateMachine.add('Groupwait',
										_sm_groupwait_0,
										transitions={'done': 'finished'},
										autonomy={'done': Autonomy.Inherit})


		# x:67 y:227
		_sm_export_no_waypoint_4 = OperatableStateMachine(outcomes=['done'], output_keys=['waipoint', 'area_name'])

		with _sm_export_no_waypoint_4:
			# x:30 y:40
			OperatableStateMachine.add('noWaypoint',
										SetKey(Value=None),
										transitions={'done': 'NoName'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'waipoint'})

			# x:43 y:129
			OperatableStateMachine.add('NoName',
										SetKey(Value=None),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'area_name'})


		# x:30 y:458
		_sm_export_waypoint_5 = OperatableStateMachine(outcomes=['done'], input_keys=['entity'], output_keys=['waipoint', 'area_name'])<commit_msg>update avec teste il faut parler plus a la fin et moisn au debut<commit_after>#!/usr/bin/env python
###########################################################
#               WARNING: Generated code!                  #
#              **************************                 #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] tags will be kept.        #
###########################################################

import roslib; roslib.load_manifest('behavior_actionwrapper_guide')
from flexbe_core import Behavior, Autonomy, OperatableStateMachine, ConcurrencyContainer, PriorityContainer, Logger
from sara_flexbe_states.GetRosParam import GetRosParam
from sara_flexbe_states.set_a_step import Set_a_step
from flexbe_states.calculation_state import CalculationState
from sara_flexbe_states.SetKey import SetKey
from flexbe_states.flexible_calculation_state import FlexibleCalculationState
from flexbe_states.flexible_check_condition_state import FlexibleCheckConditionState
from flexbe_states.log_key_state import LogKeyState
from behavior_action_move.action_move_sm import Action_MoveSM
from flexbe_states.wait_state import WaitState
from sara_flexbe_states.sara_say_key import SaraSayKey
from sara_flexbe_states.sara_set_head_angle import SaraSetHeadAngle
from behavior_action_turn.action_turn_sm import action_turnSM
from sara_flexbe_states.Get_Entity_By_ID import GetEntityByID
from sara_flexbe_states.sara_say import SaraSay
from behavior_wonderlanduniqueenity.wonderlanduniqueenity_sm import WonderlandUniqueEnitySM
# Additional imports can be added inside the following tags
# [MANUAL_IMPORT]

# [/MANUAL_IMPORT]


'''
Created on 05/06/2018
@author: <NAME>
'''
class ActionWrapper_GuideSM(Behavior):
	'''
	action wrapper pour indiquer la route a un operateur.
	'''


	def __init__(self):
		super(ActionWrapper_GuideSM, self).__init__()
		self.name = 'ActionWrapper_Guide'

		# parameters of this behavior

		# references to used behaviors
		self.add_behavior(Action_MoveSM, 'Try to reach/Container/navigate to the point/Action_Move')
		self.add_behavior(action_turnSM, 'Try to reach/check person behind/move head and base/turn around/action_turn')
		self.add_behavior(action_turnSM, 'Try to reach/check person behind/move head and base/turn around/action_turn_2')
		self.add_behavior(WonderlandUniqueEnitySM, 'Try to find area/WonderlandUniqueEnity')
		self.add_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn')
		self.add_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn_2')

		# Additional initialization code can be added inside the following tags
		# [MANUAL_INIT]
        
        # [/MANUAL_INIT]

		# Behavior comments:

		# O 1262 27 
		# Move|n1- Location|n2- Location Container|n3- Location Container

		# O 1260 94 
		# Story|n0- Decompose Command|n1- Find Area|n2- Join Area|n3- END



	def create(self):
		# x:587 y:780, x:781 y:419, x:951 y:679
		_state_machine = OperatableStateMachine(outcomes=['finished', 'failed', 'critical_fail'], input_keys=['Action'])
		_state_machine.userdata.Action = ["Guide",'table', 'kitchen']
		_state_machine.userdata.relative = False

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

		# x:30 y:458
		_sm_groupwait_0 = OperatableStateMachine(outcomes=['end'])

		with _sm_groupwait_0:
			# x:30 y:40
			OperatableStateMachine.add('waitwait',
										WaitState(wait_time=20),
										transitions={'done': 'end'},
										autonomy={'done': Autonomy.Off})


		# x:534 y:319
		_sm_move_head_and_base_at_the_end_1 = OperatableStateMachine(outcomes=['failed'])

		with _sm_move_head_and_base_at_the_end_1:
			# x:52 y:31
			OperatableStateMachine.add('setkeyorientation',
										SetKey(Value=1.5),
										transitions={'done': 'action_turn'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'rotation'})

			# x:51 y:114
			OperatableStateMachine.add('action_turn',
										self.use_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn'),
										transitions={'finished': 'turn right head', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'rotation': 'rotation'})

			# x:48 y:272
			OperatableStateMachine.add('wait while head turn',
										WaitState(wait_time=4),
										transitions={'done': 'action_turn_2'},
										autonomy={'done': Autonomy.Off})

			# x:47 y:199
			OperatableStateMachine.add('turn right head',
										SaraSetHeadAngle(pitch=0, yaw=1.57),
										transitions={'done': 'wait while head turn'},
										autonomy={'done': Autonomy.Off})

			# x:45 y:348
			OperatableStateMachine.add('action_turn_2',
										self.use_behavior(action_turnSM, 'Container/Move head and base end /move head and base at the end/action_turn_2'),
										transitions={'finished': 'left to rigth', 'failed': 'failed'},
										autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
										remapping={'rotation': 'rotation'})

			# x:43 y:592
			OperatableStateMachine.add('left to rigth',
										SaraSetHeadAngle(pitch=0, yaw=-1.57),
										transitions={'done': 'waitwait1'},
										autonomy={'done': Autonomy.Off})

			# x:420 y:602
			OperatableStateMachine.add('right to left',
										SaraSetHeadAngle(pitch=0, yaw=1.57),
										transitions={'done': 'waitwait2'},
										autonomy={'done': Autonomy.Off})

			# x:266 y:541
			OperatableStateMachine.add('waitwait1',
										WaitState(wait_time=8),
										transitions={'done': 'right to left'},
										autonomy={'done': Autonomy.Off})

			# x:236 y:674
			OperatableStateMachine.add('waitwait2',
										WaitState(wait_time=8),
										transitions={'done': 'left to rigth'},
										autonomy={'done': Autonomy.Off})


		# x:231 y:538
		_sm_find_a_human_2 = OperatableStateMachine(outcomes=['finished'], input_keys=['ID'])

		with _sm_find_a_human_2:
			# x:78 y:275
			OperatableStateMachine.add('find the human',
										GetEntityByID(),
										transitions={'found': 'finished', 'not_found': 'find the human'},
										autonomy={'found': Autonomy.Off, 'not_found': Autonomy.Off},
										remapping={'ID': 'ID', 'Entity': 'Entity'})


		# x:415 y:99, x:318 y:246, x:442 y:295, x:330 y:458, x:530 y:458
		_sm_move_head_and_base_end__3 = ConcurrencyContainer(outcomes=['failed'], conditions=[
										('failed', [('move head and base at the end', 'failed')]),
										('failed', [('Groupwait', 'end')])
										])

		with _sm_move_head_and_base_end__3:
			# x:132 y:57
			OperatableStateMachine.add('move head and base at the end',
										_sm_move_head_and_base_at_the_end_1,
										transitions={'failed': 'failed'},
										autonomy={'failed': Autonomy.Inherit})

			# x:121 y:218
			OperatableStateMachine.add('Groupwait',
										_sm_groupwait_0,
										transitions={'end': 'failed'},
										autonomy={'end': Autonomy.Inherit})


		# x:67 y:227
		_sm_export_no_waypoint_4 = OperatableStateMachine(outcomes=['done'], output_keys=['waipoint', 'area_name'])

		with _sm_export_no_waypoint_4:
			# x:30 y:40
			OperatableStateMachine.add('noWaypoint',
										SetKey(Value=None),
										transitions={'done': 'NoName'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'waipoint'})

			# x:43 y:129
			OperatableStateMachine.add('NoName',
										SetKey(Value=None),
										transitions={'done': 'done'},
										autonomy={'done': Autonomy.Off},
										remapping={'Key': 'area_name'})


		# x:30 y:458
		_sm_export_waypoint_5 = OperatableStateMachine(outcomes=['done'], input_keys=['entity'], output_keys=['waipoint', 'area_name'])
{'fraction_non_alphanumeric': 0.13590120929042165, 'fraction_numerical': 0.027193038582122978, 'mean_word_length': 4.006406149903908, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4159348', 'n_tokens_mistral': 6413, 'n_tokens_neox': 4941, 'n_words': 1054}