- 3.0.2 rigid body dynamics module.
forward_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_ROBOT_TESTHYQ_FORWARD_DYNAMICS_H_
2 #define IIT_ROBOT_TESTHYQ_FORWARD_DYNAMICS_H_
3 
4 #include <iit/rbd/rbd.h>
5 #include <iit/rbd/utils.h>
7 
8 #include "declarations.h"
9 #include "transforms.h"
10 #include "inertia_properties.h"
11 #include "link_data_map.h"
12 
13 namespace iit {
14 namespace TestHyQ {
15 namespace dyn {
16 
29 namespace tpl {
30 
31 template <typename TRAIT>
33 public:
34  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
35  // Convenient type aliases:
36 
37  typedef typename TRAIT::Scalar Scalar;
38 
40 
41  typedef typename CoreS::ForceVector Force;
43  typedef typename CoreS::VelocityVector Velocity;
45  typedef typename CoreS::Column6D Column6DS;
47  typedef typename CoreS::Matrix66 Matrix66S;
48  typedef iit::TestHyQ::tpl::MotionTransforms<TRAIT> MTransforms;
49 
50 public:
62 
75  void fd(
76  JointState& qdd, Acceleration& trunk_a, // output parameters,
77  const Velocity& trunk_v, const Acceleration& g,
78  const JointState& q, const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
79  void fd(
80  JointState& qdd, Acceleration& trunk_a, // output parameters,
81  const Velocity& trunk_v, const Acceleration& g,
82  const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
84 
86  void setJointStatus(const JointState& q) const;
87 
88 private:
90  MTransforms* motionTransforms;
91 
92  Matrix66S vcross; // support variable
93  Matrix66S Ia_r; // support variable, articulated inertia in the case of a revolute joint
94  // Link 'trunk'
95  Matrix66S trunk_AI;
96  Force trunk_p;
97 
98  // Link 'LF_hipassembly' :
99  Matrix66S LF_hipassembly_AI;
100  Velocity LF_hipassembly_a;
101  Velocity LF_hipassembly_v;
102  Velocity LF_hipassembly_c;
103  Force LF_hipassembly_p;
104 
105  Column6DS LF_hipassembly_U;
106  Scalar LF_hipassembly_D;
107  Scalar LF_hipassembly_u;
108  // Link 'LF_upperleg' :
109  Matrix66S LF_upperleg_AI;
110  Velocity LF_upperleg_a;
111  Velocity LF_upperleg_v;
112  Velocity LF_upperleg_c;
113  Force LF_upperleg_p;
114 
115  Column6DS LF_upperleg_U;
116  Scalar LF_upperleg_D;
117  Scalar LF_upperleg_u;
118  // Link 'LF_lowerleg' :
119  Matrix66S LF_lowerleg_AI;
120  Velocity LF_lowerleg_a;
121  Velocity LF_lowerleg_v;
122  Velocity LF_lowerleg_c;
123  Force LF_lowerleg_p;
124 
125  Column6DS LF_lowerleg_U;
126  Scalar LF_lowerleg_D;
127  Scalar LF_lowerleg_u;
128  // Link 'RF_hipassembly' :
129  Matrix66S RF_hipassembly_AI;
130  Velocity RF_hipassembly_a;
131  Velocity RF_hipassembly_v;
132  Velocity RF_hipassembly_c;
133  Force RF_hipassembly_p;
134 
135  Column6DS RF_hipassembly_U;
136  Scalar RF_hipassembly_D;
137  Scalar RF_hipassembly_u;
138  // Link 'RF_upperleg' :
139  Matrix66S RF_upperleg_AI;
140  Velocity RF_upperleg_a;
141  Velocity RF_upperleg_v;
142  Velocity RF_upperleg_c;
143  Force RF_upperleg_p;
144 
145  Column6DS RF_upperleg_U;
146  Scalar RF_upperleg_D;
147  Scalar RF_upperleg_u;
148  // Link 'RF_lowerleg' :
149  Matrix66S RF_lowerleg_AI;
150  Velocity RF_lowerleg_a;
151  Velocity RF_lowerleg_v;
152  Velocity RF_lowerleg_c;
153  Force RF_lowerleg_p;
154 
155  Column6DS RF_lowerleg_U;
156  Scalar RF_lowerleg_D;
157  Scalar RF_lowerleg_u;
158  // Link 'LH_hipassembly' :
159  Matrix66S LH_hipassembly_AI;
160  Velocity LH_hipassembly_a;
161  Velocity LH_hipassembly_v;
162  Velocity LH_hipassembly_c;
163  Force LH_hipassembly_p;
164 
165  Column6DS LH_hipassembly_U;
166  Scalar LH_hipassembly_D;
167  Scalar LH_hipassembly_u;
168  // Link 'LH_upperleg' :
169  Matrix66S LH_upperleg_AI;
170  Velocity LH_upperleg_a;
171  Velocity LH_upperleg_v;
172  Velocity LH_upperleg_c;
173  Force LH_upperleg_p;
174 
175  Column6DS LH_upperleg_U;
176  Scalar LH_upperleg_D;
177  Scalar LH_upperleg_u;
178  // Link 'LH_lowerleg' :
179  Matrix66S LH_lowerleg_AI;
180  Velocity LH_lowerleg_a;
181  Velocity LH_lowerleg_v;
182  Velocity LH_lowerleg_c;
183  Force LH_lowerleg_p;
184 
185  Column6DS LH_lowerleg_U;
186  Scalar LH_lowerleg_D;
187  Scalar LH_lowerleg_u;
188  // Link 'RH_hipassembly' :
189  Matrix66S RH_hipassembly_AI;
190  Velocity RH_hipassembly_a;
191  Velocity RH_hipassembly_v;
192  Velocity RH_hipassembly_c;
193  Force RH_hipassembly_p;
194 
195  Column6DS RH_hipassembly_U;
196  Scalar RH_hipassembly_D;
197  Scalar RH_hipassembly_u;
198  // Link 'RH_upperleg' :
199  Matrix66S RH_upperleg_AI;
200  Velocity RH_upperleg_a;
201  Velocity RH_upperleg_v;
202  Velocity RH_upperleg_c;
203  Force RH_upperleg_p;
204 
205  Column6DS RH_upperleg_U;
206  Scalar RH_upperleg_D;
207  Scalar RH_upperleg_u;
208  // Link 'RH_lowerleg' :
209  Matrix66S RH_lowerleg_AI;
210  Velocity RH_lowerleg_a;
211  Velocity RH_lowerleg_v;
212  Velocity RH_lowerleg_c;
213  Force RH_lowerleg_p;
214 
215  Column6DS RH_lowerleg_U;
216  Scalar RH_lowerleg_D;
217  Scalar RH_lowerleg_u;
218 private:
219  static const ExtForces zeroExtForces;
220 };
221 
222 template <typename TRAIT>
224  (motionTransforms-> fr_LF_hipassembly_X_fr_trunk)(q);
225  (motionTransforms-> fr_LF_upperleg_X_fr_LF_hipassembly)(q);
226  (motionTransforms-> fr_LF_lowerleg_X_fr_LF_upperleg)(q);
227  (motionTransforms-> fr_RF_hipassembly_X_fr_trunk)(q);
228  (motionTransforms-> fr_RF_upperleg_X_fr_RF_hipassembly)(q);
229  (motionTransforms-> fr_RF_lowerleg_X_fr_RF_upperleg)(q);
230  (motionTransforms-> fr_LH_hipassembly_X_fr_trunk)(q);
231  (motionTransforms-> fr_LH_upperleg_X_fr_LH_hipassembly)(q);
232  (motionTransforms-> fr_LH_lowerleg_X_fr_LH_upperleg)(q);
233  (motionTransforms-> fr_RH_hipassembly_X_fr_trunk)(q);
234  (motionTransforms-> fr_RH_upperleg_X_fr_RH_hipassembly)(q);
235  (motionTransforms-> fr_RH_lowerleg_X_fr_RH_upperleg)(q);
236 }
237 
238 template <typename TRAIT>
240  JointState& qdd, Acceleration& trunk_a, // output parameters,
241  const Velocity& trunk_v, const Acceleration& g,
242  const JointState& q,
243  const JointState& qd,
244  const JointState& tau,
245  const ExtForces& fext/* = zeroExtForces */)
246 {
247  setJointStatus(q);
248  fd(qdd, trunk_a, trunk_v, g, qd, tau, fext);
249 }
250 
251 }
252 
254 
255 }
256 }
257 }
258 
259 #include "forward_dynamics.impl.h"
260 
261 #endif
LinkDataMap< Force > ExtForces
Definition: forward_dynamics.h:42
void setJointStatus(const JointState &q) const
Definition: forward_dynamics.h:223
CoreS::Column6D Column6DS
Definition: forward_dynamics.h:45
PlainMatrix< Scalar, 6, 6 > Matrix66
Definition: rbd.h:79
void fd(JointState &qdd, Acceleration &trunk_a, const Velocity &trunk_v, const Acceleration &g, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:239
CoreS::VelocityVector Acceleration
Definition: forward_dynamics.h:44
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:47
ForwardDynamics(iit::TestHyQ::dyn::tpl::InertiaProperties< TRAIT > &in, MTransforms &tr)
Definition: forward_dynamics.impl.h:8
iit::TestHyQ::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:48
CoreS::ForceVector Force
Definition: forward_dynamics.h:41
iit::TestHyQ::tpl::JointState< Scalar > JointState
Definition: forward_dynamics.h:46
Vector6D Column6D
a 3D subvector of a 6D vector
Definition: rbd.h:90
Definition: inertia_properties.h:24
Definition: link_data_map.h:12
Definition: rbd.h:72
Column12d< SCALAR > JointState
Definition: declarations.h:19
Vector6D ForceVector
a 3D subvector of a 6D vector
Definition: rbd.h:92
iit::rbd::Core< Scalar > CoreS
Definition: forward_dynamics.h:39
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar Scalar
Definition: forward_dynamics.h:37
Definition: forward_dynamics.h:32
Vector6D VelocityVector
a 3D subvector of a 6D vector
Definition: rbd.h:91
CoreS::VelocityVector Velocity
Definition: forward_dynamics.h:43