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 #ifndef ROBDEKON_SYSTEMMODEL_H
30 #define ROBDEKON_SYSTEMMODEL_H
31 
32 #include <Eigen/Dense>
33 
34 #define MANIF_NO_DEBUG
35 #include <manif/SE3.h>
36 #include <manif/SO3.h>
37 
38 template <typename floatT>
39 struct StateSE3
40 {
41  manif::SE3<floatT> pose;
42 };
43 
44 template <typename floatT>
45 struct ControlSE3
46 {
47  typename manif::SE3<floatT>::Tangent velocity;
48 };
49 
50 template <typename floatT>
51 struct StateSE3xV
52 {
53  manif::SE3<floatT> pose;
54  typename manif::SE3<floatT>::Tangent velocity;
55 };
56 
57 template <typename floatT>
59 {
60  manif::SO3<floatT> orientation;
62 };
63 
64 template <typename floatT>
66 {
67  typename manif::SO3<floatT>::Tangent angular_velocity;
69 };
70 
71 template <typename floatT>
73 {
75 };
76 
77 template <typename floatT>
79 {
80  static_assert(std::is_floating_point_v<floatT>);
81 
82  struct dim
83  {
84  static constexpr long state = 6, control = 6, obs = 6;
85  };
86 
87  using FloatT = floatT;
91  using ControlNoiseT =
92  Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
94 
95  static ObsT observationFunction(const StateT& state);
96 
97  static StateT propagationFunction(const StateT& state,
98  const ControlT& control,
99  const ControlNoiseT& noise,
100  FloatT dt);
101 
102  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
103 
104  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
105 };
106 
107 template <typename floatT>
109 {
110  static_assert(std::is_floating_point_v<floatT>);
111 
112  struct dim
113  {
114  static constexpr long state = 6, control = 6, obs = 6;
115  };
116 
117  using FloatT = floatT;
121  using ControlNoiseT =
122  Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
124 
125  static ObsT observationFunction(const StateT& state);
126 
127  static StateT propagationFunction(const StateT& state,
128  const ControlT& control,
129  const ControlNoiseT& noise,
130  FloatT dt);
131 
132  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
133 
134  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
135 };
136 
137 template <typename floatT>
139 {
140  static_assert(std::is_floating_point_v<floatT>);
141 
142  struct dim
143  {
144  static constexpr long state = 12, control = 6, obs = 6;
145  };
146 
147  using FloatT = floatT;
151  using ControlNoiseT =
152  Eigen::Matrix<FloatT, dim::control, 1>; // todo: correct name? Is it the same as ControlT?
154 
155  static ObsT observationFunction(const StateT& state);
156 
157  static StateT propagationFunction(const StateT& state,
158  const ControlT& control,
159  const ControlNoiseT& noise,
160  FloatT dt);
161 
162  static StateT retraction(const StateT& state, const SigmaPointsT& sigmaPoints);
163 
164  static SigmaPointsT inverseRetraction(const StateT& state1, const StateT& state2);
165 };
166 
167 extern template struct SystemModelSE3<float>;
168 extern template struct SystemModelSE3<double>;
169 extern template struct SystemModelSO3xR3<float>;
170 extern template struct SystemModelSO3xR3<double>;
171 extern template struct SystemModelSE3xV<float>;
172 extern template struct SystemModelSE3xV<double>;
173 #endif //ROBDEKON_SYSTEMMODEL_H
SystemModelSO3xR3::dim::state
static constexpr long state
Definition: SystemModel.h:114
SystemModelSO3xR3::dim
Definition: SystemModel.h:112
ControlSE3::velocity
manif::SE3< floatT >::Tangent velocity
Definition: SystemModel.h:47
SystemModelSE3xV::dim::state
static constexpr long state
Definition: SystemModel.h:144
SystemModelSE3xV::FloatT
floatT FloatT
Definition: SystemModel.h:147
SystemModelSO3xR3::dim::obs
static constexpr long obs
Definition: SystemModel.h:114
StateSO3xR3::position
Eigen::Matrix< floatT, 3, 1 > position
Definition: SystemModel.h:61
StateSE3xV::pose
manif::SE3< floatT > pose
Definition: SystemModel.h:53
ControlSO3xR3::angular_velocity
manif::SO3< floatT >::Tangent angular_velocity
Definition: SystemModel.h:67
SystemModelSE3::dim::state
static constexpr long state
Definition: SystemModel.h:84
SystemModelSE3xV::dim::obs
static constexpr long obs
Definition: SystemModel.h:144
SystemModelSO3xR3::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:139
SystemModelSO3xR3::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:149
ControlSE3xV::acceleration
Eigen::Matrix< floatT, 6, 1 > acceleration
Definition: SystemModel.h:74
SystemModelSE3xV::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:108
SystemModelSE3xV
Definition: SystemModel.h:138
ControlSE3
Definition: SystemModel.h:45
SystemModelSO3xR3::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:176
SystemModelSE3::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:63
SystemModelSE3::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:54
StateSO3xR3
Definition: SystemModel.h:58
SystemModelSO3xR3
Definition: SystemModel.h:108
StateSE3
Definition: SystemModel.h:39
SystemModelSO3xR3::retraction
static StateT retraction(const StateT &state, const SigmaPointsT &sigmaPoints)
Definition: SystemModel.cpp:162
SystemModelSE3::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:34
StateSE3xV
Definition: SystemModel.h:51
ControlSE3xV
Definition: SystemModel.h:72
SystemModelSE3::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:42
SystemModelSE3::dim::obs
static constexpr long obs
Definition: SystemModel.h:84
StateSO3xR3::orientation
manif::SO3< floatT > orientation
Definition: SystemModel.h:60
ControlSO3xR3
Definition: SystemModel.h:65
SystemModelSE3::FloatT
floatT FloatT
Definition: SystemModel.h:87
SystemModelSE3xV::inverseRetraction
static SigmaPointsT inverseRetraction(const StateT &state1, const StateT &state2)
Definition: SystemModel.cpp:123
ControlSO3xR3::euclidean_velocity
Eigen::Matrix< floatT, 3, 1 > euclidean_velocity
Definition: SystemModel.h:68
SystemModelSE3::dim
Definition: SystemModel.h:82
Eigen::Matrix< floatT, 3, 1 >
SystemModelSE3
Definition: SystemModel.h:78
SystemModelSE3xV::observationFunction
static ObsT observationFunction(const StateT &state)
Definition: SystemModel.cpp:78
StateSE3xV::velocity
manif::SE3< floatT >::Tangent velocity
Definition: SystemModel.h:54
control
This file is part of ArmarX.
dt
constexpr T dt
Definition: UnscentedKalmanFilterTest.cpp:45
SystemModelSO3xR3::FloatT
floatT FloatT
Definition: SystemModel.h:117
SystemModelSE3xV::propagationFunction
static StateT propagationFunction(const StateT &state, const ControlT &control, const ControlNoiseT &noise, FloatT dt)
Definition: SystemModel.cpp:86
StateSE3::pose
manif::SE3< floatT > pose
Definition: SystemModel.h:41
SystemModelSE3xV::dim
Definition: SystemModel.h:142