- 3.0.2 rigid body dynamics module.
forward_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_ROBOT_TESTIRB4600_FORWARD_DYNAMICS_H_
2 #define IIT_ROBOT_TESTIRB4600_FORWARD_DYNAMICS_H_
3 
4 #include <Eigen/Dense>
5 #include <iit/rbd/rbd.h>
7 #include <iit/rbd/utils.h>
9 
10 #include "declarations.h"
11 #include "transforms.h"
12 #include "inertia_properties.h"
13 #include "link_data_map.h"
14 
15 namespace iit {
16 namespace testirb4600 {
17 namespace dyn {
18 
31 namespace tpl{
32 
33 template <typename TRAIT>
35 public:
36  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
37  // Convenient type aliases:
38 
39  typedef typename TRAIT::Scalar SCALAR;
40 
42 
44  typedef typename CoreS::ForceVector Force;
45  typedef typename CoreS::VelocityVector Velocity;
47  typedef typename CoreS::Column6D Column6DS;
49  typedef typename CoreS::Matrix66 Matrix66S;
50 
52  typedef iit::testirb4600::tpl::MotionTransforms<TRAIT> MTransforms;
53 
54 public:
66 
75  void fd(
76  JointState& qdd, // output parameter
77  const JointState& q, const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
78  void fd(
79  JointState& qdd, // output parameter
80  const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
82 
84  void setJointStatus(const JointState& q) const;
85 
86 private:
88  MTransforms* motionTransforms;
89 
90  Matrix66S vcross; // support variable
91  Matrix66S Ia_r; // support variable, articulated inertia in the case of a revolute joint
92 
93  // Link 'link1' :
94  Matrix66S link1_AI;
95  Velocity link1_a;
96  Velocity link1_v;
97  Velocity link1_c;
98  Force link1_p;
99 
100  Column6DS link1_U;
101  SCALAR link1_D;
102  SCALAR link1_u;
103  // Link 'link2' :
104  Matrix66S link2_AI;
105  Velocity link2_a;
106  Velocity link2_v;
107  Velocity link2_c;
108  Force link2_p;
109 
110  Column6DS link2_U;
111  SCALAR link2_D;
112  SCALAR link2_u;
113  // Link 'link3' :
114  Matrix66S link3_AI;
115  Velocity link3_a;
116  Velocity link3_v;
117  Velocity link3_c;
118  Force link3_p;
119 
120  Column6DS link3_U;
121  SCALAR link3_D;
122  SCALAR link3_u;
123  // Link 'link4' :
124  Matrix66S link4_AI;
125  Velocity link4_a;
126  Velocity link4_v;
127  Velocity link4_c;
128  Force link4_p;
129 
130  Column6DS link4_U;
131  SCALAR link4_D;
132  SCALAR link4_u;
133  // Link 'link5' :
134  Matrix66S link5_AI;
135  Velocity link5_a;
136  Velocity link5_v;
137  Velocity link5_c;
138  Force link5_p;
139 
140  Column6DS link5_U;
141  SCALAR link5_D;
142  SCALAR link5_u;
143  // Link 'link6' :
144  Matrix66S link6_AI;
145  Velocity link6_a;
146  Velocity link6_v;
147  Velocity link6_c;
148  Force link6_p;
149 
150  Column6DS link6_U;
151  SCALAR link6_D;
152  SCALAR link6_u;
153 private:
154  static const ExtForces zeroExtForces;
155 };
156 
157 template <typename TRAIT>
159  (motionTransforms-> fr_link1_X_fr_link0)(q);
160  (motionTransforms-> fr_link2_X_fr_link1)(q);
161  (motionTransforms-> fr_link3_X_fr_link2)(q);
162  (motionTransforms-> fr_link4_X_fr_link3)(q);
163  (motionTransforms-> fr_link5_X_fr_link4)(q);
164  (motionTransforms-> fr_link6_X_fr_link5)(q);
165 }
166 
167 template<typename TRAIT>
169  JointState& qdd,
170  const JointState& q,
171  const JointState& qd,
172  const JointState& tau,
173  const ExtForces& fext/* = zeroExtForces */)
174 {
175  setJointStatus(q);
176  fd(qdd, qd, tau, fext);
177 }
178 
179 } // namespace tpl
180 
182 
183 }
184 }
185 }
186 
187 #include "forward_dynamics.impl.h"
188 
189 #endif
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:49
CoreS::Column6D Column6DS
Definition: forward_dynamics.h:47
iit::rbd::tpl::InertiaMatrixDense< SCALAR > InertiaMatrix
Definition: forward_dynamics.h:51
PlainMatrix< Scalar, 6, 6 > Matrix66
Definition: rbd.h:79
iit::testirb4600::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:52
LinkDataMap< typename CoreS::ForceVector > ExtForces
Definition: forward_dynamics.h:43
CoreS::ForceVector Force
Definition: forward_dynamics.h:44
iit::testirb4600::tpl::JointState< SCALAR > JointState
Definition: forward_dynamics.h:48
CoreS::VelocityVector Acceleration
Definition: forward_dynamics.h:46
ForwardDynamics(iit::testirb4600::dyn::tpl::InertiaProperties< TRAIT > &in, MTransforms &tr)
Definition: forward_dynamics.impl.h:9
Definition: InertiaMatrix.h:25
void fd(JointState &qdd, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:168
void setJointStatus(const JointState &q) const
Definition: forward_dynamics.h:158
Definition: inertia_properties.h:25
Vector6D Column6D
a 3D subvector of a 6D vector
Definition: rbd.h:90
iit::rbd::Core< SCALAR > CoreS
Definition: forward_dynamics.h:41
Definition: rbd.h:72
Definition: link_data_map.h:12
Vector6D ForceVector
a 3D subvector of a 6D vector
Definition: rbd.h:92
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar SCALAR
Definition: forward_dynamics.h:39
Column6d< SCALAR > JointState
Definition: declarations.h:19
Vector6D VelocityVector
a 3D subvector of a 6D vector
Definition: rbd.h:91
CoreS::VelocityVector Velocity
Definition: forward_dynamics.h:45
Definition: forward_dynamics.h:34