本文整理汇总了Python中flexbe_core.OperatableStateMachine类的典型用法代码示例。如果您正苦于以下问题:Python OperatableStateMachine类的具体用法?Python OperatableStateMachine怎么用?Python OperatableStateMachine使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OperatableStateMachine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
def create(self):
# x:30 y:322, x:130 y:322
_state_machine = OperatableStateMachine(outcomes=['succeeded', 'aborted'], input_keys=['pose', 'params_distance'])
_state_machine.userdata.goalId = ''
_state_machine.userdata.params_distance = 0
_state_machine.userdata.pose = PoseStamped()
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:30 y:40
OperatableStateMachine.add('send_request',
Send_Request_new(useMoveBase=True),
transitions={'succeeded': 'wait'},
autonomy={'succeeded': Autonomy.Off},
remapping={'goalId': 'goalId', 'params_distance': 'params_distance', 'pose': 'pose'})
# x:223 y:96
OperatableStateMachine.add('wait',
Wait_DriveTo_new(useMoveBase=True),
transitions={'succeeded': 'succeeded', 'aborted': 'aborted', 'waiting': 'wait'},
autonomy={'succeeded': Autonomy.Off, 'aborted': Autonomy.Off, 'waiting': Autonomy.Off},
remapping={'goalId': 'goalId'})
return _state_machine
示例2: create
def create(self):
# x:30 y:322, x:130 y:322
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:78 y:62
OperatableStateMachine.add('behavior_exploration',
self.use_behavior(behavior_explorationSM, 'behavior_exploration'),
transitions={'finished': 'GetCloserToVictim'},
autonomy={'finished': Autonomy.Inherit})
# x:89 y:195
OperatableStateMachine.add('GetCloserToVictim',
self.use_behavior(GetCloserToVictimSM, 'GetCloserToVictim'),
transitions={'done': 'behavior_exploration'},
autonomy={'done': Autonomy.Inherit})
return _state_machine
示例3: create
def create(self):
motion_key_1 = stand_up_front_100
motion_key_2 = stand_up_front_200
# x:533 y:194, x:130 y:322
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:30 y:40
OperatableStateMachine.add('Execute_First_Part',
MotionServiceState(motion_key=motion_key_1, time_factor=1),
transitions={'done': 'Execute_Second_Part', 'failed': 'failed'},
autonomy={'done': Autonomy.High, 'failed': Autonomy.Low})
# x:203 y:125
OperatableStateMachine.add('Execute_Second_Part',
MotionServiceState(motion_key=motion_key_2, time_factor=1),
transitions={'done': 'finished', 'failed': 'failed'},
autonomy={'done': Autonomy.High, 'failed': Autonomy.Low})
return _state_machine
示例4: create
def create(self):
# x:83 y:340, x:283 y:190
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:60 y:78
OperatableStateMachine.add('Log_Sweep',
LogState(text='Now performing a short sweep...', severity=Logger.REPORT_INFO),
transitions={'done': 'Perform_Sweep'},
autonomy={'done': Autonomy.Off})
# x:47 y:178
OperatableStateMachine.add('Perform_Sweep',
MetricSweepState(sweep_type='short'),
transitions={'sweeped': 'finished', 'failed': 'failed'},
autonomy={'sweeped': Autonomy.Off, 'failed': Autonomy.Off})
return _state_machine
示例5: create
def create(self):
# x:30 y:365, x:130 y:365
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
_state_machine.userdata.startCheckPosition = PoseStamped()
_state_machine.userdata.startCheckID = ''
_state_machine.userdata.objectType = 'start_check_pipe'
_state_machine.userdata.objectState = 0
_state_machine.userdata.joint_config = [0,0,0,0]
_state_machine.userdata.group_name = 'arm_group'
_state_machine.userdata.armType = 'pipes'
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:30 y:40
OperatableStateMachine.add('DetectObject',
DetectObjectNew(),
transitions={'found': 'MoveArmPipe'},
autonomy={'found': Autonomy.Off},
remapping={'type': 'objectType', 'state': 'objectState', 'pose': 'startCheckPosition', 'object_id': 'startCheckID'})
# x:326 y:64
OperatableStateMachine.add('MoveArmPipe',
MoveArmDynState(),
transitions={'reached': 'finished', 'sampling_failed': 'MoveArmPipe', 'planning_failed': 'MoveArmPipe', 'control_failed': 'MoveArmPipe'},
autonomy={'reached': Autonomy.Off, 'sampling_failed': Autonomy.Off, 'planning_failed': Autonomy.Off, 'control_failed': Autonomy.Off},
remapping={'object_pose': 'startCheckPosition', 'object_type': 'armType', 'object_id': 'startCheckID'})
return _state_machine
示例6: create
def create(self):
hello = "Hello World"
# x:212 y:273, x:130 y:322
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:93 y:66
OperatableStateMachine.add('Initial_Wait',
WaitState(wait_time=self.waiting_time),
transitions={'done': 'Print_Greeting'},
autonomy={'done': Autonomy.Off})
# x:145 y:159
OperatableStateMachine.add('Print_Greeting',
LogState(text=hello, severity=Logger.REPORT_HINT),
transitions={'done': 'finished'},
autonomy={'done': Autonomy.High})
return _state_machine
示例7: create
def create(self):
# x:30 y:365, x:130 y:365
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
_state_machine.userdata.pose = PoseStamped()
_state_machine.userdata.goalId = 'abc'
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:30 y:40
OperatableStateMachine.add('Drive',
Drive_to_new(),
transitions={'succeeded': 'Wait'},
autonomy={'succeeded': Autonomy.Off},
remapping={'pose': 'pose'})
# x:191 y:77
OperatableStateMachine.add('Wait',
Wait_DriveTo_new(useMoveBase=True),
transitions={'succeeded': 'finished', 'aborted': 'failed', 'waiting': 'Wait'},
autonomy={'succeeded': Autonomy.Off, 'aborted': Autonomy.Off, 'waiting': Autonomy.Off},
remapping={'goalId': 'goalId'})
return _state_machine
示例8: create
def create(self):
log_msg = "Hello World!"
# x:83 y:390
_state_machine = OperatableStateMachine(outcomes=['finished'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:52 y:78
OperatableStateMachine.add('Print_Message',
LogState(text=log_msg, severity=Logger.REPORT_HINT),
transitions={'done': 'Wait_After_Logging'},
autonomy={'done': Autonomy.Low})
# x:40 y:228
OperatableStateMachine.add('Wait_After_Logging',
WaitState(wait_time=self.waiting_time),
transitions={'done': 'finished'},
autonomy={'done': Autonomy.Off})
return _state_machine
示例9: create
def create(self):
# x:52 y:481, x:134 y:482
_state_machine = OperatableStateMachine(outcomes=["finished", "failed"])
_state_machine.userdata.pose = PoseStamped()
_state_machine.userdata.startPoint = PoseStamped()
_state_machine.userdata.endPoint = PoseStamped()
_state_machine.userdata.switchFalse = False
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:31 y:51
OperatableStateMachine.add(
"SimpleMissionInitialize",
self.use_behavior(SimpleMissionInitializeSM, "SimpleMissionInitialize"),
transitions={"finished": "SimpleMissionDoAction"},
autonomy={"finished": Autonomy.Inherit},
remapping={"startPoint": "startPoint", "endPoint": "endPoint"},
)
# x:515 y:72
OperatableStateMachine.add(
"SimpleMissionDoAction",
self.use_behavior(SimpleMissionDoActionSM, "SimpleMissionDoAction"),
transitions={"finished": "DriveToStart", "failed": "SimpleMissionError"},
autonomy={"finished": Autonomy.Inherit, "failed": Autonomy.Inherit},
)
# x:818 y:222
OperatableStateMachine.add(
"DriveToEnd",
self.use_behavior(SimpleMissionDriveToSM, "DriveToEnd"),
transitions={"finished": "SimpleMissionDoAction", "failed": "SimpleMissionError"},
autonomy={"finished": Autonomy.Inherit, "failed": Autonomy.Inherit},
remapping={"pose": "endPoint"},
)
# x:218 y:222
OperatableStateMachine.add(
"DriveToStart",
self.use_behavior(SimpleMissionDriveToSM, "DriveToStart"),
transitions={"finished": "DriveToEnd", "failed": "SimpleMissionError"},
autonomy={"finished": Autonomy.Inherit, "failed": Autonomy.Inherit},
remapping={"pose": "startPoint"},
)
# x:524 y:372
OperatableStateMachine.add(
"SimpleMissionError",
self.use_behavior(SimpleMissionErrorSM, "SimpleMissionError"),
transitions={"failed": "failed", "toStart": "DriveToStart", "toEnd": "DriveToEnd"},
autonomy={"failed": Autonomy.Inherit, "toStart": Autonomy.Inherit, "toEnd": Autonomy.Inherit},
remapping={"startPoint": "startPoint", "endPoint": "endPoint"},
)
return _state_machine
示例10: create
def create(self):
# x:52 y:481, x:134 y:482
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
_state_machine.userdata.pose = PoseStamped()
_state_machine.userdata.startPoint = PoseStamped()
_state_machine.userdata.endPoint = PoseStamped()
_state_machine.userdata.switchFalse = False
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:31 y:51
OperatableStateMachine.add('SimpleMissionInitialize',
self.use_behavior(SimpleMissionInitializeSM, 'SimpleMissionInitialize'),
transitions={'finished': 'SimpleMissionDoAction'},
autonomy={'finished': Autonomy.Inherit},
remapping={'startPoint': 'startPoint', 'endPoint': 'endPoint'})
# x:515 y:72
OperatableStateMachine.add('SimpleMissionDoAction',
self.use_behavior(SimpleMissionDoActionSM, 'SimpleMissionDoAction'),
transitions={'finished': 'DriveToStart', 'failed': 'SimpleMissionError'},
autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit})
# x:818 y:222
OperatableStateMachine.add('DriveToEnd',
self.use_behavior(SimpleMissionDriveToSM, 'DriveToEnd'),
transitions={'finished': 'SimpleMissionDoAction', 'failed': 'SimpleMissionError'},
autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
remapping={'pose': 'endPoint'})
# x:218 y:222
OperatableStateMachine.add('DriveToStart',
self.use_behavior(SimpleMissionDriveToSM, 'DriveToStart'),
transitions={'finished': 'DriveToEnd', 'failed': 'SimpleMissionError'},
autonomy={'finished': Autonomy.Inherit, 'failed': Autonomy.Inherit},
remapping={'pose': 'startPoint'})
# x:524 y:372
OperatableStateMachine.add('SimpleMissionError',
self.use_behavior(SimpleMissionErrorSM, 'SimpleMissionError'),
transitions={'failed': 'failed', 'toStart': 'DriveToStart', 'toEnd': 'DriveToEnd'},
autonomy={'failed': Autonomy.Inherit, 'toStart': Autonomy.Inherit, 'toEnd': Autonomy.Inherit},
remapping={'startPoint': 'startPoint', 'endPoint': 'endPoint'})
return _state_machine
示例11: create
def create(self):
pcl_topic = '/local_metric_map/metaroom'
object_name = 'teabox'
# x:183 y:440, x:383 y:190
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
_state_machine.userdata.text_found = 'I found %s' % object_name
_state_machine.userdata.text_not_found = 'I will continue my search'
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:47 y:28
OperatableStateMachine.add('Perform_Sweep',
MetricSweepState(sweep_type=MetricSweepState.SHORT),
transitions={'sweeped': 'Store_Pointcloud', 'failed': 'failed'},
autonomy={'sweeped': Autonomy.Off, 'failed': Autonomy.Off})
# x:38 y:228
OperatableStateMachine.add('Recognize_Object',
RecognizeObjectState(object_name=object_name),
transitions={'detected': 'Say_Found', 'not_detected': 'Say_Not_Found', 'failed': 'failed'},
autonomy={'detected': Autonomy.Low, 'not_detected': Autonomy.Low, 'failed': Autonomy.Full},
remapping={'pointcloud': 'pointcloud'})
# x:44 y:328
OperatableStateMachine.add('Say_Found',
SpeechOutputState(),
transitions={'done': 'finished', 'failed': 'failed'},
autonomy={'done': Autonomy.Off, 'failed': Autonomy.Full},
remapping={'text': 'text_found'})
# x:244 y:278
OperatableStateMachine.add('Say_Not_Found',
SpeechOutputState(),
transitions={'done': 'finished', 'failed': 'failed'},
autonomy={'done': Autonomy.Off, 'failed': Autonomy.Full},
remapping={'text': 'text_not_found'})
# x:41 y:128
OperatableStateMachine.add('Store_Pointcloud',
StorePointcloudState(topic=pcl_topic),
transitions={'done': 'Recognize_Object'},
autonomy={'done': Autonomy.Off},
remapping={'pointcloud': 'pointcloud'})
return _state_machine
示例12: create
def create(self):
# x:833 y:90, x:583 y:490
_state_machine = OperatableStateMachine(outcomes=['finished', 'failed'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:37 y:78
OperatableStateMachine.add('Ask_If_Wide_Stance',
OperatorDecisionState(outcomes=['wide_stance', 'just_stand'], hint="Do you want to go to wide stance?", suggestion='wide_stance'),
transitions={'wide_stance': 'Plan_To_Wide_Stance', 'just_stand': 'Set_Manipulate'},
autonomy={'wide_stance': Autonomy.Low, 'just_stand': Autonomy.Full})
# x:274 y:278
OperatableStateMachine.add('Go_To_Wide_Stance',
ExecuteStepPlanActionState(),
transitions={'finished': 'Wait_For_Stand', 'failed': 'failed'},
autonomy={'finished': Autonomy.Low, 'failed': Autonomy.Low},
remapping={'footstep_plan': 'plan_wide_stance'})
# x:19 y:278
OperatableStateMachine.add('Plan_To_Wide_Stance',
FootstepPlanWideStanceState(),
transitions={'planned': 'Go_To_Wide_Stance', 'failed': 'failed'},
autonomy={'planned': Autonomy.Low, 'failed': Autonomy.Low},
remapping={'footstep_plan': 'plan_wide_stance'})
# x:566 y:78
OperatableStateMachine.add('Set_Manipulate',
ChangeControlModeActionState(target_mode=ChangeControlModeActionState.MANIPULATE),
transitions={'changed': 'finished', 'failed': 'failed'},
autonomy={'changed': Autonomy.Low, 'failed': Autonomy.Low})
# x:266 y:178
OperatableStateMachine.add('Wait_For_Stand',
CheckCurrentControlModeState(target_mode=CheckCurrentControlModeState.STAND, wait=True),
transitions={'correct': 'Set_Manipulate', 'incorrect': 'failed'},
autonomy={'correct': Autonomy.Low, 'incorrect': Autonomy.Full},
remapping={'control_mode': 'control_mode'})
return _state_machine
示例13: create
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:30 y:40
OperatableStateMachine.add('abc',
ExampleState(target_time=1),
transitions={'continue': 'finished', 'failed': 'failed'},
autonomy={'continue': Autonomy.Off, 'failed': Autonomy.Off})
return _state_machine
示例14: create
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:30 y:40
OperatableStateMachine.add('Test',
DrivepathTest(),
transitions={'reached': 'finished', 'failed': 'failed'},
autonomy={'reached': Autonomy.Off, 'failed': Autonomy.Off})
return _state_machine
示例15: create
def create(self):
# x:30 y:365
_state_machine = OperatableStateMachine(outcomes=['finished'])
# Additional creation code can be added inside the following tags
# [MANUAL_CREATE]
# [/MANUAL_CREATE]
with _state_machine:
# x:66 y:154
OperatableStateMachine.add('Print_Msg',
LogState(text="My param is: " + self.msg, severity=Logger.REPORT_HINT),
transitions={'done': 'finished'},
autonomy={'done': Autonomy.Off})
return _state_machine