struct mrpt::nav::TWaypoint

A single waypoint within TWaypointSequence.

#include <mrpt/nav/reactive/TWaypoint.h>

struct TWaypoint
{
    //
fields

    mrpt::math::TPoint2D target {INVALID_NUM, INVALID_NUM};
    std::optional<double> target_heading;
    std::string target_frame_id = "map";
    double allowed_distance {INVALID_NUM};
    double speed_ratio = 1.0;
    bool allow_skip = true;
    std::any user_data;
    static constexpr int INVALID_NUM {-100000};

    // construction

    TWaypoint();

    TWaypoint(
        double target_x,
        double target_y,
        double allowed_distance,
        bool allow_skip = true,
        std::optional<double> target_heading_ = std::nullopt,
        double speed_ratio_ = 1.0
        );

    //
methods

    bool isValid() const;
    std::string getAsText() const;
};

// direct descendants

struct TWaypointStatus;

Fields

mrpt::math::TPoint2D target {INVALID_NUM, INVALID_NUM}

[Must be set by the user] Coordinates of desired target location (world/global coordinates).

See also:

target_heading

std::optional<double> target_heading

[Default=any heading] Optionally, set to the desired orientation [radians] of the robot at this waypoint.

Some navigator implementations may ignore this preferred heading anyway, read the docs of each implementation to find it out.

std::string target_frame_id = "map"

(Default=”map”) Frame ID in which target is given.

Optional, use only for submapping applications.

double allowed_distance {INVALID_NUM}

[Must be set by the user] How close should the robot get to this waypoint for it to be considered reached.

double speed_ratio = 1.0

(Default=1.0) Desired robot speed at the target, as a ratio of the full robot speed.

That is: speed_ratio=1 means that the user wants the robot to navigate to the target and smoothly continue to the next one when reached. speed_ratio=0 on the other hand means that the robot should approach this waypoint slowing down and end up totally stopped.

bool allow_skip = true

[Default=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint in the sequence if it determines that it is easier to skip this one (e.g.

it seems blocked by dynamic obstacles). This value is ignored for the last waypoint in a sequence, since it is always considered to be the ultimate goal and hence not subject to be skipped.

std::any user_data

Any user-stored custom data.

static constexpr int INVALID_NUM {-100000}

The default value of fields (used to detect non-set values)

Construction

TWaypoint()

Ctor with default values.

Methods

bool isValid() const

Check whether all the minimum mandatory fields have been filled by the user.

std::string getAsText() const

get in human-readable format