Go to the documentation of this file.
23 : target(INVALID_NUM, INVALID_NUM),
24 target_heading(INVALID_NUM),
25 target_frame_id(
"map"),
26 allowed_distance(INVALID_NUM),
32 double target_x,
double target_y,
double allowed_distance_,
33 bool allow_skip_,
double target_heading_)
34 : target(target_x, target_y),
35 target_heading(target_heading_),
36 target_frame_id(
"map"),
37 allowed_distance(allowed_distance_),
38 allow_skip(allow_skip_)
54 s +=
"target=(**Coordinates not set!!**) ";
59 s +=
" (heading: any) ";
64 s +=
" (**allowed_distance not set!!**) ";
66 s += (
allow_skip ?
" allow_skip: YES" :
" allow_skip: NO ");
78 "List of %u waypoints:\n",
static_cast<unsigned int>(
waypoints.size()));
94 counter_seen_reachable(0)
99 TWaypoint::operator=(wp);
114 final_goal_reached(false),
115 waypoint_index_current_goal(-1),
126 "Status for %u waypoints:\n",
127 static_cast<unsigned int>(
waypoints.size()));
136 " final_goal_reached:%s waypoint_index_current_goal=%d\n",
144 outter_radius_non_skippable(.3),
145 inner_radius_non_skippable(.0),
146 outter_radius_reached(.2),
147 inner_radius_reached(.1),
148 heading_arrow_len(1.0),
149 color_regular(
mrpt::
img::TColor(0x00, 0x00, 0xff)),
150 color_current_goal(
mrpt::
img::TColor(0xff, 0x00, 0x20)),
151 color_reached(
mrpt::
img::TColor(0x00, 0x00, 0xc0, 0xd0)),
161 unsigned int idx = 0;
164 auto gl_pt = mrpt::make_aligned_shared<mrpt::opengl::CDisk>(
165 p.allow_skip ?
params.outter_radius
166 :
params.outter_radius_non_skippable,
167 p.allow_skip ?
params.inner_radius
168 :
params.inner_radius_non_skippable,
170 gl_pt->setLocation(
p.target.x,
p.target.y, 0.01);
171 gl_pt->setColor_u8(
params.color_regular);
175 gl_pt->enableShowName(
true);
181 auto o = mrpt::make_aligned_shared<mrpt::opengl::CArrow>(
182 0, 0, 0,
params.heading_arrow_len, 0.0f, 0.0f);
185 p.target.x,
p.target.y, 0.02,
p.target_heading, 0, 0));
198 unsigned int idx = 0;
204 mrpt::make_aligned_shared<mrpt::opengl::CDisk>(
206 ?
params.outter_radius_reached
207 : (
p.allow_skip ?
params.outter_radius
208 :
params.outter_radius_non_skippable),
210 ?
params.inner_radius_reached
211 : (
p.allow_skip ?
params.inner_radius
212 :
params.inner_radius_non_skippable),
214 gl_pt->setLocation(
p.target.x,
p.target.y, 0.01);
219 "WayPt #%2u Reach:%s", idx,
p.reached ?
"YES" :
"NO"));
220 gl_pt->enableShowName(
true);
223 is_cur_goal ?
params.color_current_goal
224 : (
p.reached ?
params.color_reached
230 auto o = mrpt::make_aligned_shared<mrpt::opengl::CArrow>(
231 0, 0, 0,
params.heading_arrow_len, 0.0f, 0.0f);
234 p.target.x,
p.target.y, 0.02,
p.target_heading, 0, 0));
246 c.write(
s,
"waypoint_count", N);
250 for (
unsigned int i = 0; i < N; i++)
255 s,
mrpt::format(
"wp%03u_allowed_distance", i), wp.allowed_distance,
257 c.write(
s,
mrpt::format(
"wp%03u_allow_skip", i), wp.allow_skip, NP);
261 s,
mrpt::format(
"wp%03u_target_frame_id", i), wp.target_frame_id,
264 s,
mrpt::format(
"wp%03u_target_heading", i), wp.target_heading, NP);
273 const unsigned int N =
c.read_int(
s,
"waypoint_count", 0,
true);
276 for (
unsigned int i = 0; i < N; i++)
280 wp.allowed_distance =
c.read_double(
288 wp.target_frame_id =
c.read_string(
290 double hd =
c.read_double(
static const int INVALID_NUM
The default value of fields (used to detect non-set values)
double target_heading
[Default=any heading] Optionally, set to the desired orientation [radians] of the robot at this waypo...
TWaypoint()
Ctor with default values.
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)
TWaypointsRenderingParams()
bool reached
Whether this waypoint has been reached already (to within the allowed distance as per user specificat...
TWaypointStatusSequence()
Ctor with default values.
#define INVALID_TIMESTAMP
Represents an invalid timestamp, where applicable.
GLsizei GLsizei GLuint * obj
bool isValid() const
Check whether all the minimum mandatory fields have been filled by the user.
TWaypointStatus & operator=(const TWaypoint &wp)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string getAsText() const
Gets navigation params as a human-readable format.
double RAD2DEG(const double x)
Radians to degrees.
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
std::vector< TWaypoint > waypoints
TWaypointSequence()
Ctor with default values.
std::string getAsText() const
Gets navigation params as a human-readable format.
A set of object, which are referenced to the coordinates framework established in this object.
This class allows loading and storing values and vectors of different types from a configuration text...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void load(const mrpt::config::CConfigFileBase &c, const std::string &s)
Loads waypoints to a config file section.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
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)
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
std::string getAsText() const
Gets navigation params as a human-readable format.
A waypoint with an execution status.
used in getAsOpenglVisualization()
double allowed_distance
[Must be set by the user] How close should the robot get to this waypoint for it to be considered rea...
std::shared_ptr< CDisk > Ptr
std::string getAsText() const
get in human-readable format
A single waypoint within TWaypointSequence.
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
GLsizei const GLchar ** string
mrpt::math::TPoint2D target
[Must be set by the user] Coordinates of desired target location (world/global coordinates).
bool allow_skip
[Default=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint in the s...
void save(mrpt::config::CConfigFileBase &c, const std::string &s) const
Saves waypoints to a config file section.
GLenum const GLfloat * params
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at mié 12 jul 2023 10:03:34 CEST | |