Waypoints#
#include "navground/sim/tasks/waypoints.h"
A sequence of points to reach.
This class implement a task that makes the agent reach a sequence of waypoints, calling navground::core::Controller::go_to_position for the next waypoint after the current has been reached within a tolerance.
The task notifies when a new waypoint is set by calling a callback.
Registered properties:
waypoints
(list of navground::core::Vector2, get_waypoints)loop
(bool, get_loop)random
(bool, get_random)tolerance
(bool, get_tolerance)tolerances
(list[float], get_tolerances)angular_tolerance
(float, get_angular_tolerance)angular_tolerances
(list[float], get_angular_tolerances)orientations
(list[float], get_orientations)
Subclassed by navground::sim::GoToPoseTask
Public Functions
Constructs a new instance.
- Parameters:
waypoints – [in] The waypoints
loop – [in] Whether it should start from begin after reaching the last waypoint
tolerance – [in] The default goal tolerance applied to each waypoint.
random – [in] Whether to pick the next waypoint randomly
tolerances – [in] The goal tolerance applied to individual waypoints.
orientations – [in] The goal orientation at the waypoints.
angular_tolerance – [in] The default goal angular tolerance applied to each waypoint.
angular_tolerance – [in] The goal angular tolerance applied to individual waypoints.
The size of the data passed to callbacks when events occur, see TaskCallback and Task::add_callback.
The data is composed of 4 numbers:
[time, target_x, target_y, target_theta]
- Returns:
4
Sets the waypoints.
- Parameters:
value – [in] The desired waypoints
Sets the goal orientations at the waypoints.
- Parameters:
value – [in] The desired orientations (in radians)
Sets whether it should start from begin after reaching the last waypoint.
- Parameters:
value – [in] The desired value
Gets the waypoints.
- Returns:
The waypoints.
Gets the goal orientations at the waypoints.
- Returns:
The orientations (in radians).
Gets whether it should start from begin after reaching the last waypoint.
- Returns:
True if it should loop.
Gets whether to pick the next waypoint randomly.
- Returns:
True if it should pick randomly.
Sets whether to pick the next waypoint randomly.
- Parameters:
value – [in] The desired value
Returns the spatial tolerance applied to the waypoint at a given index.
If a specific positive value is present at the same index in get_tolerances, it returns it. Else it returns the default value from get_tolerance.
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 – [in] The waypoint index
- Returns:
The tolerance in meters.
Gets the default goal spatial tolerance.
This value is used in get_effective_tolerance to compute the effective tolerance applied to a selected waypoint, where specific (positive) tolerances returned by get_tolerances will overwrites this default value.
- Returns:
The default spatial tolerance in meters.
Gets the specific goal spatial tolerances.
This 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 value get_tolerance. Extra items (not paired to \get_waypoints) are also ignored.
- Returns:
The spatial tolerances of waypoints at specific indices in meters
Sets the default goal spatial tolerance.
This value is used in get_effective_tolerance to compute the effective tolerance applied to a selected waypoint, where specific (positive) tolerances set by set_tolerances will overwrites this default value.
- Parameters:
value – [in] The desired positive value in meters.
Sets the specific goal spatial tolerances.
This 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 value set with set_tolerance. Extra items (not paired to \get_waypoints) are also ignored.
- Parameters:
values – [in] The desired values at specific indices in meters
Returns the angular tolerance applied to the waypoint at a given index.
If a specific positive value is present at the same index in get_angular_tolerances, it returns it. Else it returns the default value from get_angular_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 – [in] The waypoint index
- Returns:
The angular tolerance in radians.
Gets 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, where specific (positive) angular tolerances returned by get_angular_tolerances will overwrites this default value.
- Returns:
The default angular tolerances in meters
Gets the specific goal angular tolerances.
This 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 value get_angular_tolerance. Extra items (not paired to \get_waypoints) are also ignored.
- Returns:
The individual waypoints angular tolerances.
Sets the goal angular tolerance applied to each waypoint.
This value is used in get_effective_angular_tolerance to compute the effective angular tolerance applied to a selected waypoint, where specific (positive) angular tolerances set by set_angular_tolerances will overwrites this default value.
- Parameters:
value – [in] The desired positive value.
Sets the specific goal angular tolerances.
This values are used in get_effective_angular_tolerance to compute the effective angular tolerance applied to a selected waypoint: negative values are ignored and replaced by the default value set with set_angular_tolerance. Extra items (not paired to \get_waypoints) are also ignored.
- Parameters:
values – [in] The desired values at specific indices in radians.
Public Static Attributes
Whether by default the task loops.
The default goal spatial tolerance.
The default goal orientation tolerance.
By default moves in sequence.