Waypoints#
This class implement a task that makes the agent reach a sequence of waypoints, calling
Controller.go_to_pose
orController.go_to_position
for the next waypoint after the current has been reached within a tolerance, depending if a goal orientation has been specified usingorientations
or not.The task notifies when a new waypoint is set by calling a callback.
Registered properties:
loop (bool,
loop
)random (bool,
random
)tolerance (bool,
tolerance
)tolerances (list of float,
tolerances
)angular_tolerance (float,
angular_tolerance
)angular_tolerances (list of float,
angular_tolerances
)orientations (list of float,
orientations
)wait_time (float,
wait_time
)wait_times (list of float,
wait_times
)
Constructs a new instance.
- Parameters:
waypoints – The waypoints
loop – Whether it should start from begin after reaching the last waypoint
tolerance – The default goal tolerance applied to each waypoint.
random – Whether to pick the next waypoint randomly
tolerances – The goal tolerance applied to specific waypoints.
orientations – The goal orientation at the waypoints.
angular_tolerance – The default goal angular tolerance applied to each waypoint.
angular_tolerances – The goal angular tolerances applied to specific waypoints.
wait_time – The time to wait at each waypoint.
wait_times – The time to wait at specific waypoint.
Returns the angular tolerance applied to the waypoint at a given index.
If a specific positive value is present at the same index in
angular_tolerances
, it returns it. Else it returns the default value fromangular_tolerance
.For example, if there are three waypoints, the specific angular tolerances are set to
-1, 0.2
, and the default angular tolerance is set to0.25
, the effective angular tolerances will be0.25, 0.2, 0.25
.- Parameters:
index – The waypoint index
- Returns:
The angular tolerance in radians.
Returns the spatial tolerance applied to the waypoint at a given index.
If a specific positive value is present at the same index in
tolerances
, it returns it. Else it returns the default value fromtolerance
.For example, if there are three waypoints, the specific tolerances are set to
-1, 0.2
, and the default tolerance is set to0.25
, the effective tolerances will be0.25, 0.2, 0.25
.- Parameters:
index – The waypoint index
- Returns:
The tolerance in meters.
Gets the effective wait time before moving towards the waypoint at given index.
If a specific positive value is present at the same index in
wait_times
, it returns it. Else it returns the default value fromwait_time
.- Parameters:
index – The index
- Returns:
The time in seconds.
- Type:
The default goal angular tolerance
this value is used in
get_effective_angular_tolerance()
to compute the effective angular tolerance applied to a selected waypoint: specific (positive) angular tolerances returned byangular_tolerances
will overwrites this default value.
-
The specific goal angular tolerances.
these values are used in
get_effective_angular_tolerance()
to compute the effective tolerance applied to a selected waypoint: negative values are ignored and replaced by the default valueangular_tolerance
. extra items (not paired towaypoints
) are also ignored.
- Type:
The size of the data passed to callbacks when events occur, see
TaskCallback
andTask.add_callback()
.The data is composed of 7 numbers
[time, action_id, data_1, ..., data_5]
:idle:
[time, 0, 0, 0, 0, 0, 0]
start waiting for t seconds:
[time, 1, t, 0, 0, 0, 0]
start moving towards pose (x, y, theta):
[time, 2, x, y, theta, tolerance, angular tolerance]
start moving towards point (x, y):
[time, 3, x, y, 0, tolerance, 0]
- Type:
Whether it should start from begin after reaching the last waypoint.
-
The goal orientations at the waypoints.
if there are more orientations specified than waypoints, those extra orientation are ignore.
if there are less orientations specified than waypoints, the missing orientation are effectively filled with the last orientation during control.
- Type:
Whether to pick the next waypoint randomly
- Type:
The default goal spatial tolerance.
this value is used in
get_effective_tolerance()
to compute the effective tolerance applied to a selected waypoint: specific (positive) tolerances returned bytolerances
will overwrites this default value.
-
The specific goal spatial tolerances.
these values are used in
get_effective_tolerance()
to compute the effective tolerance applied to a selected waypoint: negative values are ignored and replaced by the default valuetolerance
. extra items (not paired towaypoints
) are also ignored.
- Type:
The default wait time before moving towards a waypoint.
this value is used in
get_effective_wait_time()
to compute the effective wait time applied to a selected waypoint: specific (positive) wait times returned bywait_times
will overwrites this default value.
-
The wait times before moving towards specific waypoints.
these values are used in
get_effective_angular_tolerance()
to compute the effective tolerance applied to a selected waypoint: negative values are ignored and replaced by the default valueangular_tolerance
. extra items (not paired towaypoints
) are also ignored.