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



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020