Main MRPT website > C++ reference for MRPT 1.5.5
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=true] Whether it is allowed to the navigator to proceed to a more advanced waypoint
40  * in the sequence if it determines that it is easier to skip this one (e.g. it seems blocked by dynamic obstacles).
41  * This value is ignored for the last waypoint in a sequence, since it is always considered to be the
42  * ultimate goal and hence not subject to be skipped.
43  */
44  bool allow_skip;
45 
46  bool isValid() const; //!< Check whether all the minimum mandatory fields have been filled by the user.
47  TWaypoint(); //!< Ctor with default values
48  TWaypoint(double target_x, double target_y, double allowed_distance, bool allow_skip = true, double target_heading_ = INVALID_NUM);
49  std::string getAsText() const; //!< get in human-readable format
50 
51  static const double INVALID_NUM; //!< The default value of fields (used to detect non-set values)
52  };
53 
54  /** used in getAsOpenglVisualization() */
56  {
58 
59  double outter_radius, inner_radius;
60  double outter_radius_non_skippable, inner_radius_non_skippable;
61  double outter_radius_reached, inner_radius_reached;
63  mrpt::utils::TColor color_regular, color_current_goal, color_reached;
65  };
66 
67  /** The struct for requesting navigation requests for a sequence of waypoints.
68  * Used in CWaypointsNavigator::navigateWaypoints().
69  * Users can directly fill in the list of waypoints manipulating the public field `waypoints`.
70  * \ingroup nav_reactive */
72  {
73  std::vector<TWaypoint> waypoints;
74 
75  void clear() { waypoints.clear(); }
76 
77  TWaypointSequence(); //!< Ctor with default values
78  std::string getAsText() const; //!< Gets navigation params as a human-readable format
79  /** Renders the sequence of waypoints (previous contents of `obj` are cleared) */
81  /** Saves waypoints to a config file section */
82  void save(mrpt::utils::CConfigFileBase &c,const std::string &s) const;
83  /** Loads waypoints to a config file section */
84  void load(const mrpt::utils::CConfigFileBase &c,const std::string &s);
85  };
86 
87  /** A waypoint with an execution status. \ingroup nav_reactive */
89  {
90  bool reached; //!< Whether this waypoint has been reached already (to within the allowed distance as per user specifications) or skipped.
91  bool skipped; //!< If `reached==true` this boolean tells whether the waypoint was physically reached (false) or marked as reached because it was skipped (true).
92  mrpt::system::TTimeStamp timestamp_reach; //!< Timestamp of when this waypoint was reached. (Default=INVALID_TIMESTAMP means not reached so far)
93  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.
94 
95 
97  TWaypointStatus & operator =(const TWaypoint &wp);
98  std::string getAsText() const; //!< Gets navigation params as a human-readable format
99  };
100 
101  /** The struct for querying the status of waypoints navigation. Used in CWaypointsNavigator::getWaypointNavStatus().
102  * \ingroup nav_reactive */
104  {
105  std::vector<TWaypointStatus> waypoints; //!< Waypoints parameters and status (reached, skipped, etc.)
106  mrpt::system::TTimeStamp timestamp_nav_started; //!< Timestamp of user navigation command.
107  bool final_goal_reached; //!< Whether the final waypoint has been reached successfuly.
108  /** Index in `waypoints` of the waypoint the navigator is currently trying to reach.
109  * This will point to the last waypoint after navigation ends successfully.
110  * Its value is `-1` if navigation has not started yet */
112 
113  mrpt::math::TPose2D last_robot_pose; //!< Robot pose at last time step (has INVALID_NUM fields upon initialization)
114 
115  TWaypointStatusSequence(); //!< Ctor with default values
116  std::string getAsText() const; //!< Gets navigation params as a human-readable format
117 
118  /** Renders the sequence of waypoints (previous contents of `obj` are cleared) */
120  };
121 
122  }
123 }
124 
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:44
mrpt::system::TTimeStamp timestamp_reach
Timestamp of when this waypoint was reached. (Default=INVALID_TIMESTAMP means not reached so far) ...
Definition: TWaypoint.h:92
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:51
used in getAsOpenglVisualization()
Definition: TWaypoint.h:55
std::vector< TWaypoint > waypoints
Definition: TWaypoint.h:73
A single waypoint within TWaypointSequence.
Definition: TWaypoint.h:25
The struct for requesting navigation requests for a sequence of waypoints.
Definition: TWaypoint.h:71
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:90
mrpt::math::TPose2D last_robot_pose
Robot pose at last time step (has INVALID_NUM fields upon initialization)
Definition: TWaypoint.h:113
const GLubyte * c
Definition: glext.h:5590
The struct for querying the status of waypoints navigation.
Definition: TWaypoint.h:103
A RGB color - 8bit.
Definition: TColor.h:26
mrpt::utils::TColor color_regular
Definition: TWaypoint.h:63
A waypoint with an execution status.
Definition: TWaypoint.h:88
bool final_goal_reached
Whether the final waypoint has been reached successfuly.
Definition: TWaypoint.h:107
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:106
bool skipped
If reached==true this boolean tells whether the waypoint was physically reached (false) or marked as ...
Definition: TWaypoint.h:91
std::vector< TWaypointStatus > waypoints
Waypoints parameters and status (reached, skipped, etc.)
Definition: TWaypoint.h:105
Lightweight 2D point.
int waypoint_index_current_goal
Index in waypoints of the waypoint the navigator is currently trying to reach.
Definition: TWaypoint.h:111
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:93
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.5 Git: e06b63dbf Fri Dec 1 14:41:11 2017 +0100 at lun oct 28 01:31:35 CET 2019