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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019