23 : target(INVALID_NUM, INVALID_NUM),
24 target_heading(INVALID_NUM),
25 target_frame_id(
"map"),
26 allowed_distance(INVALID_NUM),
33 double target_x,
double target_y,
double allowed_distance_,
34 bool allow_skip_,
double target_heading_,
double speed_ratio_)
35 : target(target_x, target_y),
36 target_heading(target_heading_),
37 target_frame_id(
"map"),
38 allowed_distance(allowed_distance_),
39 speed_ratio(speed_ratio_),
40 allow_skip(allow_skip_)
56 s +=
"target=(**Coordinates not set!!**) ";
61 s +=
" (heading: any) ";
66 s +=
" (**allowed_distance not set!!**) ";
68 s += (
allow_skip ?
" allow_skip: YES" :
" allow_skip: NO ");
81 "List of %u waypoints:\n", static_cast<unsigned int>(
waypoints.size()));
96 TWaypoint::operator=(wp);
122 "Status for %u waypoints:\n",
123 static_cast<unsigned int>(
waypoints.size()));
132 " final_goal_reached:%s waypoint_index_current_goal=%d\n",
138 : color_regular(
mrpt::img::TColor(0x00, 0x00, 0xff)),
139 color_current_goal(
mrpt::img::TColor(0xff, 0x00, 0x20)),
140 color_reached(
mrpt::img::TColor(0x00, 0x00, 0xc0, 0xd0))
150 unsigned int idx = 0;
154 p.allow_skip ?
params.outter_radius
155 :
params.outter_radius_non_skippable,
156 p.allow_skip ?
params.inner_radius
157 :
params.inner_radius_non_skippable,
159 gl_pt->setLocation(p.target.x, p.target.y, 0.01);
160 gl_pt->setColor_u8(
params.color_regular);
164 gl_pt->enableShowName(
true);
171 0, 0, 0,
params.heading_arrow_len, 0.0f, 0.0f);
173 p.target.x, p.target.y, 0.02, p.target_heading, 0, 0));
186 unsigned int idx = 0;
192 p.reached ?
params.outter_radius_reached
193 : (p.allow_skip ?
params.outter_radius
194 :
params.outter_radius_non_skippable),
195 p.reached ?
params.inner_radius_reached
196 : (p.allow_skip ?
params.inner_radius
197 :
params.inner_radius_non_skippable),
199 gl_pt->setLocation(p.target.x, p.target.y, 0.01);
203 "WayPt #%2u Reach:%s", idx, p.reached ?
"YES" :
"NO"));
204 gl_pt->enableShowName(
true);
207 is_cur_goal ?
params.color_current_goal
208 : (p.reached ?
params.color_reached
215 0, 0, 0,
params.heading_arrow_len, 0.0f, 0.0f);
217 p.target.x, p.target.y, 0.02, p.target_heading, 0, 0));
229 c.
write(s,
"waypoint_count", N);
233 for (
unsigned int i = 0; i < N; i++)
238 s,
mrpt::format(
"wp%03u_allowed_distance", i), wp.allowed_distance,
244 s,
mrpt::format(
"wp%03u_target_frame_id", i), wp.target_frame_id,
247 s,
mrpt::format(
"wp%03u_target_heading", i), wp.target_heading, NP);
257 const unsigned int N = c.
read_int(s,
"waypoint_count", 0,
true);
260 for (
unsigned int i = 0; i < N; i++)
265 s,
mrpt::format(
"wp%03u_allowed_distance", i), 0,
true);
273 s,
mrpt::format(
"wp%03u_target_frame_id", i),
"map",
false);
void clear()
Clear the list of objects in the scene, deleting objects' memory.
bool allow_skip
[Default=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint in the s...
std::string getAsText() const
Gets navigation params as a human-readable format.
std::string read_string(const std::string §ion, const std::string &name, const std::string &defaultValue, bool failIfNotFound=false) const
A set of object, which are referenced to the coordinates framework established in this object...
bool isValid() const
Check whether all the minimum mandatory fields have been filled by the user.
std::string std::string format(std::string_view fmt, ARGS &&... args)
TWaypointSequence()
Ctor with default values.
std::string getAsText() const
get in human-readable format
used in getAsOpenglVisualization()
void getAsOpenglVisualization(mrpt::opengl::CSetOfObjects &obj, const mrpt::nav::TWaypointsRenderingParams ¶ms=mrpt::nav::TWaypointsRenderingParams()) const
Renders the sequence of waypoints (previous contents of obj are cleared)
std::vector< TWaypoint > waypoints
mrpt::vision::TStereoCalibParams params
A single waypoint within TWaypointSequence.
int read_int(const std::string §ion, const std::string &name, int defaultValue, bool failIfNotFound=false) const
bool reached
Whether this waypoint has been reached already (to within the allowed distance as per user specificat...
void load(const mrpt::config::CConfigFileBase &c, const std::string &s)
Loads waypoints to a config file section.
This class allows loading and storing values and vectors of different types from a configuration text...
void save(mrpt::config::CConfigFileBase &c, const std::string &s) const
Saves waypoints to a config file section.
static Ptr Create(Args &&... args)
TWaypoint()
Ctor with default values.
TWaypointsRenderingParams()
A waypoint with an execution status.
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
double read_double(const std::string §ion, const std::string &name, double defaultValue, bool failIfNotFound=false) const
void getAsOpenglVisualization(mrpt::opengl::CSetOfObjects &obj, const mrpt::nav::TWaypointsRenderingParams ¶ms=mrpt::nav::TWaypointsRenderingParams()) const
Renders the sequence of waypoints (previous contents of obj are cleared)
void write(const std::string §ion, const std::string &name, enum_t value, const int name_padding_width=-1, const int value_padding_width=-1, const std::string &comment=std::string())
TWaypointStatus & operator=(const TWaypoint &wp)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TWaypointStatusSequence()
Ctor with default values.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool read_bool(const std::string §ion, const std::string &name, bool defaultValue, bool failIfNotFound=false) const
mrpt::math::TPoint2D target
[Must be set by the user] Coordinates of desired target location (world/global coordinates).
constexpr double RAD2DEG(const double x)
Radians to degrees.
std::string getAsText() const
Gets navigation params as a human-readable format.
double target_heading
[Default=any heading] Optionally, set to the desired orientation [radians] of the robot at this waypo...
double allowed_distance
[Must be set by the user] How close should the robot get to this waypoint for it to be considered rea...
static Ptr Create(Args &&... args)
std::string getAsText() const
Gets navigation params as a human-readable format.
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
static const int INVALID_NUM
The default value of fields (used to detect non-set values)
void insert(const CRenderizable::Ptr &newObject)
Insert a new object to the list.
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
double speed_ratio
(Default=1.0) Desired robot speed at the target, as a ratio of the full robot speed.