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  /**
41  * @brief getPoseAt returns the Pose defined by f(time)
42  * @param time a time between 0 and 1 with getPoseAt(0) being the startingPose and getPoseAt(1) being the ending Pose
43  * @return the pose of the interpolation-function at time
44  */
45  virtual PoseBasePtr getPoseAt(double time) = 0;
46 
47  /**
48  * @brief getNumberOfControlPoints returns number of controlPoints
49  * @return the number of controlPoints that define the interpolation
50  */
52 
53  protected:
54  /**
55  * @brief controlPoints the controlPoints that are interpolated between
56  */
57  std::vector<PoseBasePtr> controlPoints;
58  /**
59  * @brief init convinience method to construct the basic parts of the interpolation (copying all controlPoints)
60  * @param cp the controlPoints toinitialize the Interpolation with
61  */
62  void init(const std::vector<PoseBasePtr> cp);
63  /**
64  * @brief calculateOrientationAt calculates the rotation/orientation of the pose at a certain time
65  * @param time a time between 0 and 1 with calculateOrientationAt(0) being the starting Orientation and calculateOrientationAt(1) being the ending Orientation
66  * @return the orientation at time
67  */
68  virtual const QuaternionBasePtr calculateOrientationAt(double time);
69  /**
70  * @brief deepCopy creates a real, independent copy of a PoseBasePtr
71  * @param org the PoseBasePtr to be cloned
72  * @return the cloned PoseBasePtr
73  */
74  static PoseBasePtr deepCopy(PoseBasePtr org);
75  };
76 
77  using AbstractInterpolationPtr = std::shared_ptr <AbstractInterpolation>;
78 }
79 
80 #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:36
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:58
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::AbstractInterpolationPtr
std::shared_ptr< AbstractInterpolation > AbstractInterpolationPtr
Definition: AbstractInterpolation.h:77
armarx::AbstractInterpolation::getNumberOfControlPoints
int getNumberOfControlPoints()
getNumberOfControlPoints returns number of controlPoints
Definition: AbstractInterpolation.cpp:53
armarx::AbstractInterpolation::controlPoints
std::vector< PoseBasePtr > controlPoints
controlPoints the controlPoints that are interpolated between
Definition: AbstractInterpolation.h:57
armarx::AbstractInterpolation::deepCopy
static PoseBasePtr deepCopy(PoseBasePtr org)
deepCopy creates a real, independent copy of a PoseBasePtr
Definition: AbstractInterpolation.cpp:67
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:28