2 import clearpath_navigation_msgs.msg
6 """A single Task (part of a Waypoint).
8 Contains a name, uuid, action_server_name, version, arrays of floats
9 and strings related to the specific Task.
12 def __init__(self, name, uuid, action_server_name, version="",
13 floats=[], strings=[], allow_failure=False):
14 """Creates a Waypoint object from the given parameters.
19 The name or ID of the task, used for tracking/reporting.
22 Unique UUID string for the task.
24 action_server_name : str
25 The ROS action that this task executes.
27 floats : floats[], optional
28 Numerical/boolean data to be passed to the action_server_name
29 The exact meaning of these values is dependent on the underlying service.
31 strings : str[], optional
32 String data to be passed to the action_server_name
33 The exact meaning of these values is dependent on the underlying service.
36 Determines whether a mission using this task can continue if the task
37 execution were to fail.
40 self.
_task_msg = clearpath_navigation_msgs.msg.Task()
43 self.
_task_msg.action_server_name = action_server_name
47 self.
_task_msg.allow_failure = allow_failure
50 """Gets the name of the task.
61 """Gets the task message.
65 clearpath_navigation_msgs.msg.Task
72 """Converts the task to YAML format, for writing to disk.
77 A YAML-compatible dictionary representation of the object.
85 'action_server_name': task.action_server_name,
86 'version': task.version,
87 'floats': task.floats,
88 'strings': task.strings,
89 'allow_failure': task.allow_failure
95 """Creates a Task object from a YAML-compatible dictionary representation.
100 The YAML-compatible dictionary representation of a Task object
104 name = task_yaml[
'name']
105 uuid = task_yaml[
'uuid']
106 action_server_name = task_yaml[
'action_server_name']
107 version = task_yaml[
'version']
108 floats = task_yaml[
'floats']
109 strings = task_yaml[
'strings']
110 allow_failure = task_yaml[
'allow_failure']
111 return Task(name, uuid, action_server_name, version, floats, strings, allow_failure)
113 except KeyError
as e:
114 rospy.logerr(
'Unable to parse yaml for tasks: %s' % e)