SystemModel.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 ROBDEKON
17  * @author Christoph Pohl ( christoph dot pohl at kit dot edu )
18  * @date 18.03.21
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  *
22  * Code adapted to C++ from: https://github.com/CAOR-MINES-ParisTech/ukfm
23  * See also:
24  * - https://arxiv.org/pdf/2002.00878.pdf
25  * - https://ieeexplore.ieee.org/document/8206066/
26  */
27 
28 
29 
30 #ifndef ROBDEKON_SYSTEMMODEL_H
31 #define ROBDEKON_SYSTEMMODEL_H
32 
33 #include <Eigen/Dense>
34 
35 #define MANIF_NO_DEBUG
36 #include <manif/SE3.h>
37 #include <manif/SO3.h>
38 
39 template <typename floatT>
40 struct StateSE3 {
41  manif::SE3<floatT> pose;
42 };
43 
44 template <typename floatT>
45 struct ControlSE3 {
46  typename manif::SE3<floatT>::Tangent velocity;
47 };
48 
49 template <typename floatT>
50 struct StateSE3xV {
51  manif::SE3<floatT> pose;
52  typename manif::SE3<floatT>::Tangent velocity;
53 };
54 
55 template <typename floatT>
56 struct StateSO3xR3 {
57  manif::SO3<floatT> orientation;
59 };
60 
61 template <typename floatT>
62 struct ControlSO3xR3 {
63  typename manif::SO3<floatT>::Tangent angular_velocity;
65 };
66 
67 
68 template <typename floatT>
69 struct ControlSE3xV {
71 };
72 
73 template<typename floatT>
75 {
76  static_assert(std::is_floating_point_v<floatT>);
77  struct dim {
78  static constexpr long state = 6, control = 6, obs = 6;
79  };
80 
81  using FloatT = floatT;
85  using ControlNoiseT = Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
87 
88  static ObsT observationFunction(const StateT& state);
89 
90  static StateT propagationFunction(const StateT& state, const ControlT& control, const ControlNoiseT& noise, FloatT dt);
91 
92  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
93 
94  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
95 
96 };
97 
98 template<typename floatT>
100 {
101  static_assert(std::is_floating_point_v<floatT>);
102  struct dim {
103  static constexpr long state = 6, control = 6, obs = 6;
104  };
105 
106  using FloatT = floatT;
110  using ControlNoiseT = Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
112 
113  static ObsT observationFunction(const StateT& state);
114 
115  static StateT propagationFunction(const StateT& state, const ControlT& control, const ControlNoiseT& noise, FloatT dt);
116 
117  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
118 
119  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
120 
121 };
122 
123 template<typename floatT>
125 {
126  static_assert(std::is_floating_point_v<floatT>);
127  struct dim {
128  static constexpr long state = 12, control = 6, obs = 6;
129  };
130 
131  using FloatT = floatT;
135  using ControlNoiseT = Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
137 
138  static ObsT observationFunction(const StateT& state);
139 
140  static StateT propagationFunction(const StateT& state, const ControlT& control, const ControlNoiseT& noise, FloatT dt);
141 
142  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
143 
144  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
145 
146 };
147 
148 extern template struct SystemModelSE3<float>;
149 extern template struct SystemModelSE3<double>;
150 extern template struct SystemModelSO3xR3<float>;
151 extern template struct SystemModelSO3xR3<double>;
152 extern template struct SystemModelSE3xV<float>;
153 extern template struct SystemModelSE3xV<double>;
154 #endif //ROBDEKON_SYSTEMMODEL_H
SystemModelSO3xR3::dim::state
static constexpr long state
Definition: SystemModel.h:103
SystemModelSO3xR3::dim
Definition: SystemModel.h:102
ControlSE3::velocity
manif::SE3< floatT >::Tangent velocity
Definition: SystemModel.h:46
SystemModelSE3xV::dim::state
static constexpr long state
Definition: SystemModel.h:128
SystemModelSE3xV::FloatT
floatT FloatT
Definition: SystemModel.h:131
SystemModelSO3xR3::dim::obs
static constexpr long obs
Definition: SystemModel.h:103
StateSO3xR3::position
Eigen::Matrix< floatT, 3, 1 > position
Definition: SystemModel.h:58
StateSE3xV::pose
manif::SE3< floatT > pose
Definition: SystemModel.h:51
ControlSO3xR3::angular_velocity
manif::SO3< floatT >::Tangent angular_velocity
Definition: SystemModel.h:63
SystemModelSE3::dim::state
static constexpr long state
Definition: SystemModel.h:78
SystemModelSE3xV::dim::obs
static constexpr long obs
Definition: SystemModel.h:128
SystemModelSO3xR3::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:132
SystemModelSO3xR3::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:141
ControlSE3xV::acceleration
Eigen::Matrix< floatT, 6, 1 > acceleration
Definition: SystemModel.h:70
SystemModelSE3xV::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:103
SystemModelSE3xV
Definition: SystemModel.h:124
ControlSE3
Definition: SystemModel.h:45
SystemModelSO3xR3::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:166
SystemModelSE3::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:62
SystemModelSE3::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:52
StateSO3xR3
Definition: SystemModel.h:56
SystemModelSO3xR3
Definition: SystemModel.h:99
StateSE3
Definition: SystemModel.h:40
SystemModelSO3xR3::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:153
SystemModelSE3::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:33
StateSE3xV
Definition: SystemModel.h:50
ControlSE3xV
Definition: SystemModel.h:69
SystemModelSE3::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:41
SystemModelSE3::dim::obs
static constexpr long obs
Definition: SystemModel.h:78
StateSO3xR3::orientation
manif::SO3< floatT > orientation
Definition: SystemModel.h:57
ControlSO3xR3
Definition: SystemModel.h:62
SystemModelSE3::FloatT
floatT FloatT
Definition: SystemModel.h:81
SystemModelSE3xV::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:117
ControlSO3xR3::euclidean_velocity
Eigen::Matrix< floatT, 3, 1 > euclidean_velocity
Definition: SystemModel.h:64
SystemModelSE3::dim
Definition: SystemModel.h:77
Eigen::Matrix< floatT, 3, 1 >
SystemModelSE3
Definition: SystemModel.h:74
SystemModelSE3xV::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:76
StateSE3xV::velocity
manif::SE3< floatT >::Tangent velocity
Definition: SystemModel.h:52
control
This file is part of ArmarX.
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:42
SystemModelSO3xR3::FloatT
floatT FloatT
Definition: SystemModel.h:106
SystemModelSE3xV::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:83
StateSE3::pose
manif::SE3< floatT > pose
Definition: SystemModel.h:41
SystemModelSE3xV::dim
Definition: SystemModel.h:127