Main MRPT website > C++ reference
MRPT logo
CPoses2DSequence.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef CPoses2DSequence_H
29 #define CPoses2DSequence_H
30 
31 #include <mrpt/poses/CPose2D.h>
33 
34 namespace mrpt
35 {
36 namespace poses
37 {
38 
39  // This must be added to any CSerializable derived class:
41 
42  /** This class stores a sequence of relative, incremental 2D poses. It is useful as the bases storing unit for more complex probability particles and for computing the absolute pose of any intermediate pose.
43  *
44  * \sa CPose2D, CMultiMetricMap
45  * \ingroup poses_grp
46  */
47  class BASE_IMPEXP CPoses2DSequence : public mrpt::utils::CSerializable
48  {
49  // This must be added to any CSerializable derived class:
51  public:
52  /** Default constructor
53  */
55 
56  /** Returns the poses count in the sequence:
57  */
58  size_t posesCount();
59 
60  /** Reads the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"
61  * \exception std::exception On invalid index value
62  */
63  void getPose(unsigned int ind, CPose2D &outPose);
64 
65  /** Changes the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"
66  * \exception std::exception On invalid index value
67  */
68  void changePose(unsigned int ind, CPose2D &inPose);
69 
70  /** Appends a new pose at the end of sequence. Remember that poses are relative, incremental to the last one.
71  */
72  void appendPose(CPose2D &newPose);
73 
74  /** Clears the sequence.
75  */
76  void clear();
77 
78  /** Returns the absolute pose of a robot after moving "n" poses, so for "n=0" the origin pose (0,0,0deg) is returned, for "n=1" the first pose is returned, and for "n=posesCount()", the pose
79  * of robot after moving ALL poses is returned, all of them relative to the starting pose.
80  * \exception std::exception On invalid index value
81  * \sa absolutePoseAfterAll
82  */
83  CPose2D absolutePoseOf(unsigned int n);
84 
85  /** A shortcut for "absolutePoseOf( posesCount() )".
86  * \sa absolutePoseOf, posesCount
87  */
88  CPose2D absolutePoseAfterAll();
89 
90  /** Returns the traveled distance after moving "n" poses, so for "n=0" it returns 0, for "n=1" the first traveled distance, and for "n=posesCount()", the total
91  * distance after ALL movements.
92  * \exception std::exception On invalid index value
93  * \sa computeTraveledDistanceAfterAll
94  */
95  float computeTraveledDistanceAfter(unsigned int n);
96 
97  /** Returns the traveled distance after ALL movements.
98  * A shortcut for "computeTraveledDistanceAfter( posesCount() )".
99  * \sa computeTraveledDistanceAfter
100  */
101  float computeTraveledDistanceAfterAll();
102 
103  private:
104  /** The internal sequence of poses, stored as relative, incremental poses, thus each one is situated just at the end point of last one, where the first one is referenced to (0,0,0deg)
105  */
106  mrpt::aligned_containers<CPose2D>::vector_t poses;
107 
108  }; // End of class def.
109 
110 
111  } // End of namespace
112 } // End of namespace
113 
114 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013