Waypoints#

#include "navground/sim/tasks/waypoints.h"
using navground::sim::Waypoints = std::vector<core::Vector2>#

A sequence of points to reach.

struct WaypointsTask : public navground::sim::Task#

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:

Public Functions

inline explicit WaypointsTask(Waypoints waypoints = {}, bool loop = default_loop, ng_float_t tolerance = default_tolerance, bool random = default_random)#

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 goal tolerance applied to each waypoint.

  • random[in] Whether to pick the next waypoint randomly

inline virtual size_t get_log_size() const override#

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

inline void set_waypoints(const Waypoints &value)#

Sets the waypoints.

Parameters:

value[in] The desired waypoints

inline void set_tolerance(ng_float_t value)#

Sets the goal tolerance applied to each waypoint.

Parameters:

value[in] The desired value

inline void set_loop(bool value)#

Sets whether it should start from begin after reaching the last waypoint.

Parameters:

value[in] The desired value

inline Waypoints get_waypoints() const#

Gets the waypoints.

Returns:

The waypoints.

inline ng_float_t get_tolerance() const#

Gets the goal tolerance applied to each waypoint.

Returns:

The tolerance.

inline bool get_loop() const#

Gets whether it should start from begin after reaching the last waypoint.

Returns:

True if it should loop.

inline bool get_random() const#

Gets whether to pick the next waypoint randomly.

Returns:

True if it should pick randomly.

inline void set_random(bool value)#

Sets whether to pick the next waypoint randomly.

Parameters:

value[in] The desired value

Public Static Attributes

static const bool default_loop = true#

Whether by default the task loops.

static const ng_float_t default_tolerance = 1#

The default goal tolerance.

static const bool default_random = false#

By default moves in sequence.