Main MRPT website > C++ reference for MRPT 1.9.9
TWaypoint.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 #include <mrpt/system/datetime.h>
14 #include <mrpt/img/TColor.h>
16 #include <vector>
17 #include <string>
18 
19 namespace mrpt
20 {
21 namespace nav
22 {
23 /** A single waypoint within TWaypointSequence. \ingroup nav_reactive */
24 struct TWaypoint
25 {
26  /** [Must be set by the user] Coordinates of desired target location
27  * (world/global coordinates).
28  * \sa target_heading */
30  /** [Default=any heading] Optionally, set to the desired orientation
31  * [radians]
32  * of the robot at this waypoint. Some navigator implementations may ignore
33  * this preferred heading anyway, read the docs of each implementation to
34  * find it out. */
36 
37  /** (Default="map") Frame ID in which target is given. Optional, use only
38  * for submapping applications. */
40 
41  /** [Must be set by the user] How close should the robot get to this
42  * waypoint for it to be considered reached. */
44 
45  /** [Default=true] Whether it is allowed to the navigator to proceed to a
46  * more advanced waypoint
47  * in the sequence if it determines that it is easier to skip this one
48  * (e.g. it seems blocked by dynamic obstacles).
49  * This value is ignored for the last waypoint in a sequence, since it is
50  * always considered to be the
51  * ultimate goal and hence not subject to be skipped.
52  */
53  bool allow_skip;
54 
55  /** Check whether all the minimum mandatory fields have been filled by the
56  * user. */
57  bool isValid() const;
58  /** Ctor with default values */
59  TWaypoint();
60  TWaypoint(
61  double target_x, double target_y, double allowed_distance,
62  bool allow_skip = true, double target_heading_ = INVALID_NUM);
63  /** get in human-readable format */
64  std::string getAsText() const;
65 
66  /** The default value of fields (used to detect non-set values) */
67  static const int INVALID_NUM{-100000};
68 };
69 
70 /** used in getAsOpenglVisualization() */
72 {
74 
81 };
82 
83 /** The struct for requesting navigation requests for a sequence of waypoints.
84  * Used in CWaypointsNavigator::navigateWaypoints().
85  * Users can directly fill in the list of waypoints manipulating the public
86  * field `waypoints`.
87  * \ingroup nav_reactive */
89 {
90  std::vector<TWaypoint> waypoints;
91 
92  void clear() { waypoints.clear(); }
93  /** Ctor with default values */
95  /** Gets navigation params as a human-readable format */
96  std::string getAsText() const;
97  /** Renders the sequence of waypoints (previous contents of `obj` are
98  * cleared) */
103  /** Saves waypoints to a config file section */
104  void save(mrpt::config::CConfigFileBase& c, const std::string& s) const;
105  /** Loads waypoints to a config file section */
106  void load(const mrpt::config::CConfigFileBase& c, const std::string& s);
107 };
108 
109 /** A waypoint with an execution status. \ingroup nav_reactive */
110 struct TWaypointStatus : public TWaypoint
111 {
112  /** Whether this waypoint has been reached already (to within the allowed
113  * distance as per user specifications) or skipped. */
114  bool reached;
115  /** If `reached==true` this boolean tells whether the waypoint was
116  * physically reached (false) or marked as reached because it was skipped
117  * (true). */
118  bool skipped;
119  /** Timestamp of when this waypoint was reached. (Default=INVALID_TIMESTAMP
120  * means not reached so far) */
122  /** (Initialized to 0 automatically) How many times this waypoint has been
123  * seen as "reachable" before it being the current active waypoint. */
125 
126  TWaypointStatus();
127  TWaypointStatus& operator=(const TWaypoint& wp);
128  /** Gets navigation params as a human-readable format */
129  std::string getAsText() const;
130 };
131 
132 /** The struct for querying the status of waypoints navigation. Used in
133  * CWaypointsNavigator::getWaypointNavStatus().
134  * \ingroup nav_reactive */
136 {
137  /** Waypoints parameters and status (reached, skipped, etc.) */
138  std::vector<TWaypointStatus> waypoints;
139  /** Timestamp of user navigation command. */
141  /** Whether the final waypoint has been reached successfuly. */
143  /** Index in `waypoints` of the waypoint the navigator is currently trying
144  * to reach.
145  * This will point to the last waypoint after navigation ends successfully.
146  * Its value is `-1` if navigation has not started yet */
148 
149  /** Robot pose at last time step (has INVALID_NUM fields upon
150  * initialization) */
152 
153  /** Ctor with default values */
155  /** Gets navigation params as a human-readable format */
156  std::string getAsText() const;
157 
158  /** Renders the sequence of waypoints (previous contents of `obj` are
159  * cleared) */
164 };
165 } // namespace nav
166 } // namespace mrpt
mrpt::nav::TWaypointsRenderingParams::inner_radius_reached
double inner_radius_reached
Definition: TWaypoint.h:77
mrpt::nav::TWaypoint::INVALID_NUM
static const int INVALID_NUM
The default value of fields (used to detect non-set values)
Definition: TWaypoint.h:67
mrpt::nav::TWaypointsRenderingParams::heading_arrow_len
double heading_arrow_len
Definition: TWaypoint.h:78
mrpt::nav::TWaypointsRenderingParams::outter_radius_non_skippable
double outter_radius_non_skippable
Definition: TWaypoint.h:76
mrpt::nav::TWaypoint::target_heading
double target_heading
[Default=any heading] Optionally, set to the desired orientation [radians] of the robot at this waypo...
Definition: TWaypoint.h:35
mrpt::nav::TWaypointStatus::timestamp_reach
mrpt::system::TTimeStamp timestamp_reach
Timestamp of when this waypoint was reached.
Definition: TWaypoint.h:121
mrpt::nav::TWaypoint::TWaypoint
TWaypoint()
Ctor with default values.
Definition: TWaypoint.cpp:22
mrpt::nav::TWaypointStatusSequence::getAsOpenglVisualization
void getAsOpenglVisualization(mrpt::opengl::CSetOfObjects &obj, const mrpt::nav::TWaypointsRenderingParams &params=mrpt::nav::TWaypointsRenderingParams()) const
Renders the sequence of waypoints (previous contents of obj are cleared)
Definition: TWaypoint.cpp:192
s
GLdouble s
Definition: glext.h:3676
opengl_frwds.h
mrpt::nav::TWaypointsRenderingParams::outter_radius_reached
double outter_radius_reached
Definition: TWaypoint.h:77
mrpt::nav::TWaypointsRenderingParams::TWaypointsRenderingParams
TWaypointsRenderingParams()
Definition: TWaypoint.cpp:141
c
const GLubyte * c
Definition: glext.h:6313
mrpt::nav::TWaypointStatus::reached
bool reached
Whether this waypoint has been reached already (to within the allowed distance as per user specificat...
Definition: TWaypoint.h:114
mrpt::nav::TWaypointStatusSequence::TWaypointStatusSequence
TWaypointStatusSequence()
Ctor with default values.
Definition: TWaypoint.cpp:111
obj
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
mrpt::nav::TWaypoint::isValid
bool isValid() const
Check whether all the minimum mandatory fields have been filled by the user.
Definition: TWaypoint.cpp:42
mrpt::nav::TWaypointStatus::operator=
TWaypointStatus & operator=(const TWaypoint &wp)
Definition: TWaypoint.cpp:97
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::nav::TWaypointsRenderingParams::inner_radius
double inner_radius
Definition: TWaypoint.h:75
mrpt::nav::TWaypointSequence::getAsText
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:74
mrpt::nav::TWaypointStatusSequence::waypoint_index_current_goal
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
Definition: TWaypoint.h:147
mrpt::nav::TWaypointSequence::waypoints
std::vector< TWaypoint > waypoints
Definition: TWaypoint.h:90
mrpt::system::TTimeStamp
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1,...
Definition: datetime.h:31
mrpt::nav::TWaypointSequence::TWaypointSequence
TWaypointSequence()
Ctor with default values.
Definition: TWaypoint.cpp:72
lightweight_geom_data.h
CConfigFileBase.h
mrpt::nav::TWaypointStatusSequence::getAsText
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:122
mrpt::opengl::CSetOfObjects
A set of object, which are referenced to the coordinates framework established in this object.
Definition: CSetOfObjects.h:28
mrpt::nav::TWaypointStatus::counter_seen_reachable
int counter_seen_reachable
(Initialized to 0 automatically) How many times this waypoint has been seen as "reachable" before it ...
Definition: TWaypoint.h:124
mrpt::nav::TWaypointsRenderingParams::show_labels
bool show_labels
Definition: TWaypoint.h:80
mrpt::nav::TWaypointsRenderingParams::color_regular
mrpt::img::TColor color_regular
Definition: TWaypoint.h:79
mrpt::config::CConfigFileBase
This class allows loading and storing values and vectors of different types from a configuration text...
Definition: config/CConfigFileBase.h:44
mrpt::nav::TWaypointStatus::TWaypointStatus
TWaypointStatus()
Definition: TWaypoint.cpp:90
mrpt::nav::TWaypointStatusSequence::timestamp_nav_started
mrpt::system::TTimeStamp timestamp_nav_started
Timestamp of user navigation command.
Definition: TWaypoint.h:140
mrpt::nav::TWaypointSequence::load
void load(const mrpt::config::CConfigFileBase &c, const std::string &s)
Loads waypoints to a config file section.
Definition: TWaypoint.cpp:268
mrpt::nav::TWaypointStatus::skipped
bool skipped
If reached==true this boolean tells whether the waypoint was physically reached (false) or marked as ...
Definition: TWaypoint.h:118
mrpt::nav::TWaypointSequence::getAsOpenglVisualization
void getAsOpenglVisualization(mrpt::opengl::CSetOfObjects &obj, const mrpt::nav::TWaypointsRenderingParams &params=mrpt::nav::TWaypointsRenderingParams()) const
Renders the sequence of waypoints (previous contents of obj are cleared)
Definition: TWaypoint.cpp:156
mrpt::nav::TWaypointsRenderingParams::color_reached
mrpt::img::TColor color_reached
Definition: TWaypoint.h:79
mrpt::nav::TWaypointStatusSequence::final_goal_reached
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
Definition: TWaypoint.h:142
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::math::TPose2D
Lightweight 2D pose.
Definition: lightweight_geom_data.h:186
mrpt::math::TPoint2D
Lightweight 2D point.
Definition: lightweight_geom_data.h:42
mrpt::nav::TWaypointsRenderingParams::outter_radius
double outter_radius
Definition: TWaypoint.h:75
mrpt::nav::TWaypointStatus::getAsText
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:102
mrpt::nav::TWaypointSequence::clear
void clear()
Definition: TWaypoint.h:92
mrpt::nav::TWaypointStatus
A waypoint with an execution status.
Definition: TWaypoint.h:110
mrpt::nav::TWaypointsRenderingParams
used in getAsOpenglVisualization()
Definition: TWaypoint.h:71
mrpt::nav::TWaypointSequence
The struct for requesting navigation requests for a sequence of waypoints.
Definition: TWaypoint.h:88
mrpt::nav::TWaypoint::allowed_distance
double allowed_distance
[Must be set by the user] How close should the robot get to this waypoint for it to be considered rea...
Definition: TWaypoint.h:43
mrpt::nav::TWaypointStatusSequence::last_robot_pose
mrpt::math::TPose2D last_robot_pose
Robot pose at last time step (has INVALID_NUM fields upon initialization)
Definition: TWaypoint.h:151
mrpt::nav::TWaypoint::target_frame_id
std::string target_frame_id
(Default="map") Frame ID in which target is given.
Definition: TWaypoint.h:39
mrpt::nav::TWaypoint::getAsText
std::string getAsText() const
get in human-readable format
Definition: TWaypoint.cpp:48
mrpt::nav::TWaypoint
A single waypoint within TWaypointSequence.
Definition: TWaypoint.h:24
mrpt::nav::TWaypointStatusSequence::waypoints
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
Definition: TWaypoint.h:138
string
GLsizei const GLchar ** string
Definition: glext.h:4101
mrpt::nav::TWaypoint::target
mrpt::math::TPoint2D target
[Must be set by the user] Coordinates of desired target location (world/global coordinates).
Definition: TWaypoint.h:29
mrpt::nav::TWaypoint::allow_skip
bool allow_skip
[Default=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint in the s...
Definition: TWaypoint.h:53
mrpt::nav::TWaypointsRenderingParams::inner_radius_non_skippable
double inner_radius_non_skippable
Definition: TWaypoint.h:76
mrpt::nav::TWaypointsRenderingParams::color_current_goal
mrpt::img::TColor color_current_goal
Definition: TWaypoint.h:79
mrpt::nav::TWaypointStatusSequence
The struct for querying the status of waypoints navigation.
Definition: TWaypoint.h:135
mrpt::nav::TWaypointSequence::save
void save(mrpt::config::CConfigFileBase &c, const std::string &s) const
Saves waypoints to a config file section.
Definition: TWaypoint.cpp:242
TColor.h
params
GLenum const GLfloat * params
Definition: glext.h:3534
datetime.h



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