4 from flexbe_core
import EventState, Logger
5 from flexbe_msgs.msg
import BehaviorInputAction, BehaviorInputGoal, BehaviorInputResult
11 Implements a state where the state machine needs an input from the operator. 12 Requests of different types, such as requesting a waypoint, a template, or a pose, can be specified. 14 -- request uint8 One of the custom-defined values to specify the type of request. 15 -- message string Message displayed to the operator to let him know what to do. 17 #> data object The data provided by the operator. The exact type depends on the request. 19 <= received Returned as soon as valid data is available. 20 <= aborted The operator declined to provide the requested data. 21 <= no_connection No request could be sent to the operator. 22 <= data_error Data has been received, but could not be deserialized successfully. 29 super(InputState, self).
__init__(outcomes=[
'received',
'aborted',
'no_connection',
'data_error'],
41 return 'no_connection' 47 if result.result_code != BehaviorInputResult.RESULT_OK:
52 response_data = pickle.loads(result.data)
53 userdata.data = response_data
54 except Exception
as e:
55 Logger.logwarn(
'Was unable to load provided data:\n%s' % str(e))
65 action_goal = BehaviorInputGoal()
66 action_goal.request_type = self.
_request 71 except Exception
as e:
72 Logger.logwarn(
'Was unable to send data request:\n%s' % str(e))