Waypoints#

This class implement a task that makes the agent reach a sequence of waypoints, calling Controller.go_to_pose or Controller.go_to_position for the next waypoint after the current has been reached within a tolerance, depending if a goal orientation has been specified using orientations or not.

The task notifies when a new waypoint is set by calling a callback.

Registered properties:

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 from 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 to 0.25, the effective angular tolerances will be 0.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 from tolerance.

For example, if there are three waypoints, the specific tolerances are set to -1, 0.2, and the default tolerance is set to 0.25, the effective tolerances will be 0.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 from wait_time.

Parameters:

index – The index

Returns:

The time in seconds.

Type:

float

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 by angular_tolerances will overwrites this default value.

Type:

list[float]

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 value angular_tolerance. extra items (not paired to waypoints) are also ignored.

Type:

int

The size of the data passed to callbacks when events occur, see TaskCallback and Task.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:

bool

Whether it should start from begin after reaching the last waypoint.

Type:

list[float]

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:

bool

Whether to pick the next waypoint randomly

Type:

float

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 by tolerances will overwrites this default value.

Type:

list[float]

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 value tolerance. extra items (not paired to waypoints) are also ignored.

Type:

float

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 by wait_times will overwrites this default value.

Type:

list[float]

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 value angular_tolerance. extra items (not paired to waypoints) are also ignored.

Type:

list[Vector2]

The waypoints.