Main MRPT website > C++ reference for MRPT 1.5.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 
13 #include <mrpt/system/datetime.h>
15 #include <mrpt/utils/TColor.h>
16 #include <vector>
17 #include <string>
18 
19 #include <mrpt/nav/link_pragmas.h>
20 
21 namespace mrpt
22 {
23  namespace nav
24  {
25  /** A single waypoint within TWaypointSequence. \ingroup nav_reactive */
27  {
28  /** [Must be set by the user] Coordinates of desired target location (world/global coordinates).
29  * \sa target_heading */
31  /** [Default=any heading] Optionally, set to the desired orientation [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 find it out. */
35 
36  std::string target_frame_id; //!< (Default="map") Frame ID in which target is given. Optional, use only for submapping applications.
37 
38  double allowed_distance; //!< [Must be set by the user] How close should the robot get to this waypoint for it to be considered reached.
39 
40  /** (Default=1.0) Desired robot speed at the target, as a ratio of the full robot speed.
41  * That is: speed_ratio=1 means that the user wants the robot to navigate to the target
42  * and smoothly continue to the next one when reached. speed_ratio=0 on the other hand means
43  * that the robot should approach this waypoint slowing down and end up totally stopped.
44  */
45  double speed_ratio;
46 
47  /** [Default=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint
48  * in the sequence if it determines that it is easier to skip this one (e.g. it seems blocked by dynamic obstacles).
49  * This value is ignored for the last waypoint in a sequence, since it is always considered to be the
50  * ultimate goal and hence not subject to be skipped.
51  */
52  bool allow_skip;
53 
54  bool isValid() const; //!< Check whether all the minimum mandatory fields have been filled by the user.
55  TWaypoint(); //!< Ctor with default values
56  TWaypoint(double target_x, double target_y, double allowed_distance, bool allow_skip = true, double target_heading_ = INVALID_NUM, double speed_ratio_ = 1.0);
57  std::string getAsText() const; //!< get in human-readable format
58 
59  static const double INVALID_NUM; //!< The default value of fields (used to detect non-set values)
60  };
61 
62  /** used in getAsOpenglVisualization() */
64  {
66 
67  double outter_radius, inner_radius;
68  double outter_radius_non_skippable, inner_radius_non_skippable;
69  double outter_radius_reached, inner_radius_reached;
71  mrpt::utils::TColor color_regular, color_current_goal, color_reached;
73  };
74 
75  /** The struct for requesting navigation requests for a sequence of waypoints.
76  * Used in CWaypointsNavigator::navigateWaypoints().
77  * Users can directly fill in the list of waypoints manipulating the public field `waypoints`.
78  * \ingroup nav_reactive */
80  {
81  std::vector<TWaypoint> waypoints;
82 
83  void clear() { waypoints.clear(); }
84 
85  TWaypointSequence(); //!< Ctor with default values
86  std::string getAsText() const; //!< Gets navigation params as a human-readable format
87  /** Renders the sequence of waypoints (previous contents of `obj` are cleared) */
89  /** Saves waypoints to a config file section */
90  void save(mrpt::utils::CConfigFileBase &c,const std::string &s) const;
91  /** Loads waypoints to a config file section */
92  void load(const mrpt::utils::CConfigFileBase &c,const std::string &s);
93  };
94 
95  /** A waypoint with an execution status. \ingroup nav_reactive */
97  {
98  bool reached; //!< Whether this waypoint has been reached already (to within the allowed distance as per user specifications) or skipped.
99  bool skipped; //!< If `reached==true` this boolean tells whether the waypoint was physically reached (false) or marked as reached because it was skipped (true).
100  mrpt::system::TTimeStamp timestamp_reach; //!< Timestamp of when this waypoint was reached. (Default=INVALID_TIMESTAMP means not reached so far)
101  int counter_seen_reachable; //!< (Initialized to 0 automatically) How many times this waypoint has been seen as "reachable" before it being the current active waypoint.
102 
103 
104  TWaypointStatus();
105  TWaypointStatus & operator =(const TWaypoint &wp);
106  std::string getAsText() const; //!< Gets navigation params as a human-readable format
107  };
108 
109  /** The struct for querying the status of waypoints navigation. Used in CWaypointsNavigator::getWaypointNavStatus().
110  * \ingroup nav_reactive */
112  {
113  std::vector<TWaypointStatus> waypoints; //!< Waypoints parameters and status (reached, skipped, etc.)
114  mrpt::system::TTimeStamp timestamp_nav_started; //!< Timestamp of user navigation command.
115  bool final_goal_reached; //!< Whether the final waypoint has been reached successfuly.
116  /** Index in `waypoints` of the waypoint the navigator is currently trying to reach.
117  * This will point to the last waypoint after navigation ends successfully.
118  * Its value is `-1` if navigation has not started yet */
120 
121  mrpt::math::TPose2D last_robot_pose; //!< Robot pose at last time step (has INVALID_NUM fields upon initialization)
122 
123  TWaypointStatusSequence(); //!< Ctor with default values
124  std::string getAsText() const; //!< Gets navigation params as a human-readable format
125 
126  /** Renders the sequence of waypoints (previous contents of `obj` are cleared) */
128  };
129 
130  }
131 }
uint64_t TTimeStamp
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1...
Definition: datetime.h:30
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
mrpt::system::TTimeStamp timestamp_reach
Timestamp of when this waypoint was reached. (Default=INVALID_TIMESTAMP means not reached so far) ...
Definition: TWaypoint.h:100
A set of object, which are referenced to the coordinates framework established in this object...
Definition: CSetOfObjects.h:32
static const double INVALID_NUM
The default value of fields (used to detect non-set values)
Definition: TWaypoint.h:59
used in getAsOpenglVisualization()
Definition: TWaypoint.h:63
std::vector< TWaypoint > waypoints
Definition: TWaypoint.h:81
A single waypoint within TWaypointSequence.
Definition: TWaypoint.h:26
The struct for requesting navigation requests for a sequence of waypoints.
Definition: TWaypoint.h:79
GLdouble s
Definition: glext.h:3602
GLsizei GLsizei GLuint * obj
Definition: glext.h:3902
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:98
mrpt::math::TPose2D last_robot_pose
Robot pose at last time step (has INVALID_NUM fields upon initialization)
Definition: TWaypoint.h:121
const GLubyte * c
Definition: glext.h:5590
The struct for querying the status of waypoints navigation.
Definition: TWaypoint.h:111
A RGB color - 8bit.
Definition: TColor.h:26
mrpt::utils::TColor color_regular
Definition: TWaypoint.h:71
A waypoint with an execution status.
Definition: TWaypoint.h:96
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
Definition: TWaypoint.h:115
GLsizei const GLchar ** string
Definition: glext.h:3919
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::math::TPoint2D target
[Must be set by the user] Coordinates of desired target location (world/global coordinates).
Definition: TWaypoint.h:30
Lightweight 2D pose.
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:38
mrpt::system::TTimeStamp timestamp_nav_started
Timestamp of user navigation command.
Definition: TWaypoint.h:114
bool skipped
If reached==true this boolean tells whether the waypoint was physically reached (false) or marked as ...
Definition: TWaypoint.h:99
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
Definition: TWaypoint.h:113
Lightweight 2D point.
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
Definition: TWaypoint.h:119
GLenum const GLfloat * params
Definition: glext.h:3514
int counter_seen_reachable
(Initialized to 0 automatically) How many times this waypoint has been seen as "reachable" before it ...
Definition: TWaypoint.h:101
double speed_ratio
(Default=1.0) Desired robot speed at the target, as a ratio of the full robot speed.
Definition: TWaypoint.h:45
std::string target_frame_id
(Default="map") Frame ID in which target is given. Optional, use only for submapping applications...
Definition: TWaypoint.h:36



Page generated by Doxygen 1.8.14 for MRPT 1.5.9 Git: 690a4699f Wed Apr 15 19:29:53 2020 +0200 at miƩ abr 15 19:30:12 CEST 2020