Main MRPT website > C++ reference
MRPT logo
TPath.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-2015, 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 
10 #ifndef TPATH_H
11 #define TPATH_H
12 
14 
15 namespace mrpt
16 {
17  namespace nav
18  {
19 
20  /** This class contains methods for path data structures and handling
21  *
22  * <b>Usage:</b><br>
23  * - write me
24  *
25  *
26  * <b>About the algorithm:</b><br>
27  *
28  *
29  * <b>Changes history</b>
30  * - 12/DEC/2013: Creation (MB).
31  * - 21/FEB/2014: Refactoring (MB)
32  * \ingroup mrpt_nav_grp
33  */
34  class TPath //: public PTRRT_Navigator
35  {
36  public:
37  TPath();
38  ~TPath();
39 
40 
41  /** @name TPath data structures */
42  struct TPathData
43  {
45  p(0,0,0),
46  max_v(0.1),max_w(0.2),
47  trg_v(0.1),ind_ptg(0),
48  K(0), ptg_dist(0.0)
49  {}
50 
51  mrpt::math::TPose2D p; //!< Coordinates are "global"
52  double max_v, max_w; //!< Maximum velocities along this path segment.
53  double trg_v; //!< Desired linear velocity at the target point, ie: the robot should program its velocities such as after this arc the speeds are the given ones.
54  int ind_ptg; //!< The PTG index is needed in order to get the correct "trajectory" path
55  int K; //!< K from PTGs
56  float ptg_dist; //!< PTGs distance
57 
58  };
59 
60  struct TPlannedPath : public std::vector<TPathData> //!< An ordered vector of path poses.
61  {
62 
63  bool isApproximate; //!< the path is approximate if the target is not reached
64 
65  /** Return the path length
66  * \note in Euclidean metric
67  * \note the planned path is suppose to be calculated
68  */
69  double lengthEuclidean() const;
70 
71  /** Return the path length
72  * \note in psm pseudo-meter (PTGs metric)
73  * \note the planned path is suppose to be calculated
74  */
75  double lengthPsm() const;
76 
77  /** Save the path in a file
78  * \note the firsts line include a header containing the max velocity linear/angular
79  * \note the format is: x y phi ptg_index K ptg_dist
80  * \note if the folder doesn't exist it will not be created
81  */
82  bool save_to_text_file(const std::string &file) const;
83 
84  /** Given a robot pose, get the closest path index
85  * \note this function consider only the euclidean distance
86  */
87  int getClosestPathIndex (mrpt::math::TPose2D &robotPose) const;
88 
89  /** Get the next point to follow for the reactive method, the idea is reactively navigate
90  * to the target through a set of points as a "Hop-o'-My-Thumb" path (or breadcrumbs path)
91  * \note the path have to be not-empty.
92  * \return false if can't determine the next point.
93  */
95  mrpt::math::TPose2D &robotPose,
96  mrpt::math::TPose2D &m_target_pose,
97  double breadcrumb_dist) ;
98 
99  };
100 
101 
102  protected:
103 
104  private:
105  };
106 
107  }
108 }
109 #endif // TPATH_H
< An ordered vector of path poses.
Definition: TPath.h:60
double trg_v
Desired linear velocity at the target point, ie: the robot should program its velocities such as afte...
Definition: TPath.h:53
int K
K from PTGs.
Definition: TPath.h:55
float ptg_dist
PTGs distance.
Definition: TPath.h:56
double max_w
Maximum velocities along this path segment.
Definition: TPath.h:52
bool getBreadcrumbPoint(mrpt::nav::TPath::TPathData &out_next_point, mrpt::math::TPose2D &robotPose, mrpt::math::TPose2D &m_target_pose, double breadcrumb_dist)
Get the next point to follow for the reactive method, the idea is reactively navigate to the target t...
double lengthPsm() const
Return the path length.
This class contains methods for path data structures and handling.
Definition: TPath.h:34
bool isApproximate
the path is approximate if the target is not reached
Definition: TPath.h:63
double lengthEuclidean() const
Return the path length.
mrpt::math::TPose2D p
Coordinates are "global".
Definition: TPath.h:51
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Lightweight 2D pose.
int ind_ptg
The PTG index is needed in order to get the correct "trajectory" path.
Definition: TPath.h:54
int getClosestPathIndex(mrpt::math::TPose2D &robotPose) const
Given a robot pose, get the closest path index.
bool save_to_text_file(const std::string &file) const
Save the path in a file.



Page generated by Doxygen 1.8.9.1 for MRPT 1.3.0 SVN: at Sun Sep 13 03:55:12 UTC 2015