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
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
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:102
mrpt::system::TTimeStamp timestamp_reach
Timestamp of when this waypoint was reached.
Definition: TWaypoint.h:121
A set of object, which are referenced to the coordinates framework established in this object...
Definition: CSetOfObjects.h:28
bool isValid() const
Check whether all the minimum mandatory fields have been filled by the user.
Definition: TWaypoint.cpp:42
TWaypointSequence()
Ctor with default values.
Definition: TWaypoint.cpp:72
std::string getAsText() const
get in human-readable format
Definition: TWaypoint.cpp:48
used in getAsOpenglVisualization()
Definition: TWaypoint.h:71
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
std::vector< TWaypoint > waypoints
Definition: TWaypoint.h:90
A single waypoint within TWaypointSequence.
Definition: TWaypoint.h:24
The struct for requesting navigation requests for a sequence of waypoints.
Definition: TWaypoint.h:88
GLdouble s
Definition: glext.h:3676
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
bool reached
Whether this waypoint has been reached already (to within the allowed distance as per user specificat...
Definition: TWaypoint.h:114
void load(const mrpt::config::CConfigFileBase &c, const std::string &s)
Loads waypoints to a config file section.
Definition: TWaypoint.cpp:268
This class allows loading and storing values and vectors of different types from a configuration text...
mrpt::math::TPose2D last_robot_pose
Robot pose at last time step (has INVALID_NUM fields upon initialization)
Definition: TWaypoint.h:151
void save(mrpt::config::CConfigFileBase &c, const std::string &s) const
Saves waypoints to a config file section.
Definition: TWaypoint.cpp:242
TWaypoint()
Ctor with default values.
Definition: TWaypoint.cpp:22
const GLubyte * c
Definition: glext.h:6313
The struct for querying the status of waypoints navigation.
Definition: TWaypoint.h:135
A waypoint with an execution status.
Definition: TWaypoint.h:110
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
Definition: TWaypoint.h:142
GLsizei const GLchar ** string
Definition: glext.h:4101
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
TWaypointStatus & operator=(const TWaypoint &wp)
Definition: TWaypoint.cpp:97
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::img::TColor color_current_goal
Definition: TWaypoint.h:79
TWaypointStatusSequence()
Ctor with default values.
Definition: TWaypoint.cpp:111
mrpt::math::TPoint2D target
[Must be set by the user] Coordinates of desired target location (world/global coordinates).
Definition: TWaypoint.h:29
Lightweight 2D pose.
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:31
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:74
double target_heading
[Default=any heading] Optionally, set to the desired orientation [radians] of the robot at this waypo...
Definition: TWaypoint.h:35
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::system::TTimeStamp timestamp_nav_started
Timestamp of user navigation command.
Definition: TWaypoint.h:140
bool skipped
If reached==true this boolean tells whether the waypoint was physically reached (false) or marked as ...
Definition: TWaypoint.h:118
A RGB color - 8bit.
Definition: TColor.h:22
std::string getAsText() const
Gets navigation params as a human-readable format.
Definition: TWaypoint.cpp:122
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
Definition: TWaypoint.h:138
Lightweight 2D point.
static const int INVALID_NUM
The default value of fields (used to detect non-set values)
Definition: TWaypoint.h:67
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
Definition: TWaypoint.h:147
GLenum const GLfloat * params
Definition: glext.h:3534
int counter_seen_reachable
(Initialized to 0 automatically) How many times this waypoint has been seen as "reachable" before it ...
Definition: TWaypoint.h:124
std::string target_frame_id
(Default="map") Frame ID in which target is given.
Definition: TWaypoint.h:39



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at lun oct 28 00:14:14 CET 2019