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



Page generated by Doxygen 1.8.14 for MRPT 1.5.7 Git: 5902e14cc Wed Apr 24 15:04:01 2019 +0200 at lun oct 28 01:39:17 CET 2019