- 3.0.2 models module.
forward_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_ROBOT_CT_HYA_FORWARD_DYNAMICS_H_
2 #define IIT_ROBOT_CT_HYA_FORWARD_DYNAMICS_H_
3 
4 #include <Eigen/Dense>
5 #include <Eigen/StdVector>
6 #include <iit/rbd/rbd.h>
8 #include <iit/rbd/utils.h>
10 
11 #include "declarations.h"
12 #include "transforms.h"
13 #include "inertia_properties.h"
14 #include "link_data_map.h"
15 
16 namespace iit {
17 namespace ct_HyA {
18 namespace dyn {
19 
32 namespace tpl{
33 
34 template <typename TRAIT>
36 public:
37  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
38  // Convenient type aliases:
39 
40  typedef typename TRAIT::Scalar SCALAR;
41 
43 
45  typedef typename CoreS::ForceVector Force;
46  typedef typename CoreS::VelocityVector Velocity;
48  typedef typename CoreS::Column6D Column6DS;
50  typedef typename CoreS::Matrix66 Matrix66S;
51 
53  typedef iit::ct_HyA::tpl::MotionTransforms<TRAIT> MTransforms;
54 
55 public:
67 
76  void fd(
77  JointState& qdd, // output parameter
78  const JointState& q, const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
79  void fd(
80  JointState& qdd, // output parameter
81  const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
83 
85  void setJointStatus(const JointState& q) const;
86 
87 private:
89  MTransforms* motionTransforms;
90 
91  Matrix66S vcross; // support variable
92  Matrix66S Ia_r; // support variable, articulated inertia in the case of a revolute joint
93 
94  // Link 'Shoulder_AA' :
95  Matrix66S Shoulder_AA_AI;
96  Velocity Shoulder_AA_a;
97  Velocity Shoulder_AA_v;
98  Velocity Shoulder_AA_c;
99  Force Shoulder_AA_p;
100 
101  Column6DS Shoulder_AA_U;
102  SCALAR Shoulder_AA_D;
103  SCALAR Shoulder_AA_u;
104  // Link 'Shoulder_FE' :
105  Matrix66S Shoulder_FE_AI;
106  Velocity Shoulder_FE_a;
107  Velocity Shoulder_FE_v;
108  Velocity Shoulder_FE_c;
109  Force Shoulder_FE_p;
110 
111  Column6DS Shoulder_FE_U;
112  SCALAR Shoulder_FE_D;
113  SCALAR Shoulder_FE_u;
114  // Link 'Humerus_R' :
115  Matrix66S Humerus_R_AI;
116  Velocity Humerus_R_a;
117  Velocity Humerus_R_v;
118  Velocity Humerus_R_c;
119  Force Humerus_R_p;
120 
121  Column6DS Humerus_R_U;
122  SCALAR Humerus_R_D;
123  SCALAR Humerus_R_u;
124  // Link 'Elbow_FE' :
125  Matrix66S Elbow_FE_AI;
126  Velocity Elbow_FE_a;
127  Velocity Elbow_FE_v;
128  Velocity Elbow_FE_c;
129  Force Elbow_FE_p;
130 
131  Column6DS Elbow_FE_U;
132  SCALAR Elbow_FE_D;
133  SCALAR Elbow_FE_u;
134  // Link 'Wrist_R' :
135  Matrix66S Wrist_R_AI;
136  Velocity Wrist_R_a;
137  Velocity Wrist_R_v;
138  Velocity Wrist_R_c;
139  Force Wrist_R_p;
140 
141  Column6DS Wrist_R_U;
142  SCALAR Wrist_R_D;
143  SCALAR Wrist_R_u;
144  // Link 'Wrist_FE' :
145  Matrix66S Wrist_FE_AI;
146  Velocity Wrist_FE_a;
147  Velocity Wrist_FE_v;
148  Velocity Wrist_FE_c;
149  Force Wrist_FE_p;
150 
151  Column6DS Wrist_FE_U;
152  SCALAR Wrist_FE_D;
153  SCALAR Wrist_FE_u;
154 private:
155  static const ExtForces zeroExtForces;
156 };
157 
158 template <typename TRAIT>
160  (motionTransforms-> fr_Shoulder_AA_X_fr_HyABase)(q);
161  (motionTransforms-> fr_Shoulder_FE_X_fr_Shoulder_AA)(q);
162  (motionTransforms-> fr_Humerus_R_X_fr_Shoulder_FE)(q);
163  (motionTransforms-> fr_Elbow_FE_X_fr_Humerus_R)(q);
164  (motionTransforms-> fr_Wrist_R_X_fr_Elbow_FE)(q);
165  (motionTransforms-> fr_Wrist_FE_X_fr_Wrist_R)(q);
166 }
167 
168 template<typename TRAIT>
170  JointState& qdd,
171  const JointState& q,
172  const JointState& qd,
173  const JointState& tau,
174  const ExtForces& fext/* = zeroExtForces */)
175 {
176  setJointStatus(q);
177  fd(qdd, qd, tau, fext);
178 }
179 
180 } // namespace tpl
181 
183 
184 }
185 }
186 }
187 
188 #include "forward_dynamics.impl.h"
189 
190 #endif
Definition: derivativeIvState.hpp:21
PlainMatrix< Scalar, 6, 6 > Matrix66
iit::rbd::Core< SCALAR > CoreS
Definition: forward_dynamics.h:42
iit::ct_HyA::tpl::JointState< SCALAR > JointState
Definition: forward_dynamics.h:49
CoreS::VelocityVector Acceleration
Definition: forward_dynamics.h:47
CoreS::ForceVector Force
Definition: forward_dynamics.h:45
CoreS::Column6D Column6DS
Definition: forward_dynamics.h:48
ForwardDynamics(iit::ct_HyA::dyn::tpl::InertiaProperties< TRAIT > &in, MTransforms &tr)
Definition: forward_dynamics.impl.h:9
ct::core::ADCodegenLinearizer< state_dim, control_dim >::ADCGScalar Scalar
Definition: HyALinearizationCodeGen.cpp:23
Definition: forward_dynamics.h:35
Vector6D Column6D
Definition: link_data_map.h:12
iit::ct_HyA::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:53
Vector6D ForceVector
CoreS::VelocityVector Velocity
Definition: forward_dynamics.h:46
void setJointStatus(const JointState &q) const
Definition: forward_dynamics.h:159
Vector6D VelocityVector
void fd(JointState &qdd, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:169
iit::rbd::tpl::InertiaMatrixDense< SCALAR > InertiaMatrix
Definition: forward_dynamics.h:52
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:50
LinkDataMap< typename CoreS::ForceVector > ExtForces
Definition: forward_dynamics.h:44
Definition: inertia_properties.h:26
Column6d< SCALAR > JointState
Definition: declarations.h:20
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar SCALAR
Definition: forward_dynamics.h:40