AbstractInterpolation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package ArmarXGuiPlugins::RobotTrajectoryDesigner::Interpolation
17  * @author Timo Birr
18  * @date 2018
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #ifndef ABSTRACTINTERPOLATION_H
23 #define ABSTRACTINTERPOLATION_H
24 
25 #include <memory>
26 
27 #include <RobotAPI/interface/core/PoseBase.h>
28 
29 namespace armarx
30 {
31  /**
32  * @brief The AbstractInterpolation class represents a function f:t->P with P being the space of all poses
33  * The function parameters are initialized when using the constructors, so using getPoseAt is fast.
34  * The Interpolation can be defined by a series of controlPoints and the Interpolation Type, which are the subclasses of this class.
35  */
37  {
38  public:
39  /**
40  * @brief getPoseAt returns the Pose defined by f(time)
41  * @param time a time between 0 and 1 with getPoseAt(0) being the startingPose and getPoseAt(1) being the ending Pose
42  * @return the pose of the interpolation-function at time
43  */
44  virtual PoseBasePtr getPoseAt(double time) = 0;
45 
46  /**
47  * @brief getNumberOfControlPoints returns number of controlPoints
48  * @return the number of controlPoints that define the interpolation
49  */
51 
52  protected:
53  /**
54  * @brief controlPoints the controlPoints that are interpolated between
55  */
56  std::vector<PoseBasePtr> controlPoints;
57  /**
58  * @brief init convinience method to construct the basic parts of the interpolation (copying all controlPoints)
59  * @param cp the controlPoints toinitialize the Interpolation with
60  */
61  void init(const std::vector<PoseBasePtr> cp);
62  /**
63  * @brief calculateOrientationAt calculates the rotation/orientation of the pose at a certain time
64  * @param time a time between 0 and 1 with calculateOrientationAt(0) being the starting Orientation and calculateOrientationAt(1) being the ending Orientation
65  * @return the orientation at time
66  */
67  virtual const QuaternionBasePtr calculateOrientationAt(double time);
68  /**
69  * @brief deepCopy creates a real, independent copy of a PoseBasePtr
70  * @param org the PoseBasePtr to be cloned
71  * @return the cloned PoseBasePtr
72  */
73  static PoseBasePtr deepCopy(PoseBasePtr org);
74  };
75 
76  using AbstractInterpolationPtr = std::shared_ptr<AbstractInterpolation>;
77 } // namespace armarx
78 
79 #endif
armarx::AbstractInterpolation::calculateOrientationAt
virtual const QuaternionBasePtr calculateOrientationAt(double time)
calculateOrientationAt calculates the rotation/orientation of the pose at a certain time
Definition: AbstractInterpolation.cpp:37
armarx::AbstractInterpolation::init
void init(const std::vector< PoseBasePtr > cp)
init convinience method to construct the basic parts of the interpolation (copying all controlPoints)
Definition: AbstractInterpolation.cpp:62
armarx::AbstractInterpolation
The AbstractInterpolation class represents a function f:t->P with P being the space of all poses The ...
Definition: AbstractInterpolation.h:36
armarx::AbstractInterpolation::getNumberOfControlPoints
int getNumberOfControlPoints()
getNumberOfControlPoints returns number of controlPoints
Definition: AbstractInterpolation.cpp:56
armarx::AbstractInterpolationPtr
std::shared_ptr< AbstractInterpolation > AbstractInterpolationPtr
Definition: AbstractInterpolation.h:76
armarx::AbstractInterpolation::controlPoints
std::vector< PoseBasePtr > controlPoints
controlPoints the controlPoints that are interpolated between
Definition: AbstractInterpolation.h:56
armarx::AbstractInterpolation::deepCopy
static PoseBasePtr deepCopy(PoseBasePtr org)
deepCopy creates a real, independent copy of a PoseBasePtr
Definition: AbstractInterpolation.cpp:71
armarx::AbstractInterpolation::getPoseAt
virtual PoseBasePtr getPoseAt(double time)=0
getPoseAt returns the Pose defined by f(time)
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27