2 import clearpath_navigation_msgs.msg
7 """A single waypoint (part of a mission).
9 Contains a name, uuid, latitude, longitude, optional tasks to run
10 at the point, and various other optional parameters related
11 to the specifics at the waypoint.
13 A series of waypoints can be grouped in sequence to build a larger mission.
16 def __init__(self, name, uuid, latitude, longitude, heading=-1, tasks=[],
17 position_tolerance=0.1, yaw_tolerance=0.2):
18 """Creates a Waypoint object from the given parameters.
23 The name or ID of the goal, used for tracking/reporting
26 Unique UUID string for the waypoint
29 Latitude for the waypoint (in degrees)
32 Longitude for the waypoint (in degrees)
34 heading : float64, optional
35 Heading for the waypoint (0-360 degrees)
37 tasks : Task[], optional
38 A list of tasks to run at the waypoint (default is no tasks)
40 position_tolerance : float64, optional
41 The pose (x,y) tolerance, in meters, to apply at the goalpoint (default is 0.1)
43 yaw_tolerance : float64, optional
44 The yaw tolerance, in radians, to apply at the goalpoint (default is 0.2)
55 waypoint_tasks.append(task.getTaskMsg())
61 """Gets the name of the waypoint.
66 the name of the waypoint
72 """Gets the waypoint message.
76 clearpath_navigation_msgs.msg.Waypoint
83 """Converts the waypoint to YAML format, for writing to disk.
88 A YAML-compatible dictionary representation of the object.
96 'action_server_name': task.action_server_name,
97 'version': task.version,
98 'floats': task.floats,
99 'strings': task.strings
115 """Creates a Waypoint object from a YAML-compatible dictionary representation.
120 The YAML-compatible dictionary representation of a Waypoint object
124 name = waypoint_yaml[
'name']
125 uuid = waypoint_yaml[
'uuid']
126 latitude = waypoint_yaml[
'latitude']
127 longitude = waypoint_yaml[
'longitude']
128 heading = waypoint_yaml[
'heading']
129 position_tolerance = waypoint_yaml[
'position_tolerance']
130 yaw_tolerance = waypoint_yaml[
'yaw_tolerance']
132 tasks_yaml = waypoint_yaml[
'tasks']
134 for task_yaml
in tasks_yaml:
136 task.name = task_yaml[
'name']
137 task.uuid = task_yaml[
'uuid']
138 task.action_server_name = task_yaml[
'action_server_name']
139 task.version = task_yaml[
'version']
140 task.floats = task_yaml[
'floats']
141 task.strings = task_yaml[
'strings']
144 return Waypoint(name, uuid, latitude, longitude, heading, tasks,
145 position_tolerance, yaw_tolerance)
147 except KeyError
as e:
148 rospy.logerr(
'Unable to parse yaml for waypoint: %s' % e)