- 3.0.2 models module.
forward_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_ROBOT_CT_QUADROTOR_FORWARD_DYNAMICS_H_
2 #define IIT_ROBOT_CT_QUADROTOR_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 ct_quadrotor {
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::ct_quadrotor::tpl::MotionTransforms<TRAIT> MTransforms;
53 
54 public:
66 
79  void fd(
80  JointState& qdd, Acceleration& body_a, // output parameters,
81  const Velocity& body_v, const Acceleration& g,
82  const JointState& q, const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
83  void fd(
84  JointState& qdd, Acceleration& body_a, // output parameters,
85  const Velocity& body_v, const Acceleration& g,
86  const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
88 
90  void setJointStatus(const JointState& q) const;
91 
92 private:
94  MTransforms* motionTransforms;
95 
96  Matrix66S vcross; // support variable
97  Matrix66S Ia_r; // support variable, articulated inertia in the case of a revolute joint
98  // Link 'body'
99  Matrix66S body_AI;
100  Force body_p;
101 
102  // Link 'link1' :
103  Matrix66S link1_AI;
104  Velocity link1_a;
105  Velocity link1_v;
106  Velocity link1_c;
107  Force link1_p;
108 
109  Column6DS link1_U;
110  SCALAR link1_D;
111  SCALAR link1_u;
112  // Link 'link2' :
113  Matrix66S link2_AI;
114  Velocity link2_a;
115  Velocity link2_v;
116  Velocity link2_c;
117  Force link2_p;
118 
119  Column6DS link2_U;
120  SCALAR link2_D;
121  SCALAR link2_u;
122 private:
123  static const ExtForces zeroExtForces;
124 };
125 
126 template <typename TRAIT>
128  (motionTransforms-> fr_link1_X_fr_body)(q);
129  (motionTransforms-> fr_link2_X_fr_link1)(q);
130 }
131 
132 template<typename TRAIT>
134  JointState& qdd, Acceleration& body_a, // output parameters,
135  const Velocity& body_v, const Acceleration& g,
136  const JointState& q,
137  const JointState& qd,
138  const JointState& tau,
139  const ExtForces& fext/* = zeroExtForces */)
140 {
141  setJointStatus(q);
142  fd(qdd, body_a, body_v, g, qd, tau, fext);
143 }
144 
145 } // namespace tpl
146 
148 
149 }
150 }
151 }
152 
153 #include "forward_dynamics.impl.h"
154 
155 #endif
Column2d< SCALAR > JointState
Definition: declarations.h:19
Definition: forward_dynamics.h:34
PlainMatrix< Scalar, 6, 6 > Matrix66
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:49
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar SCALAR
Definition: forward_dynamics.h:39
CoreS::ForceVector Force
Definition: forward_dynamics.h:44
ct::core::ADCodegenLinearizer< state_dim, control_dim >::ADCGScalar Scalar
Definition: HyALinearizationCodeGen.cpp:23
iit::rbd::Core< SCALAR > CoreS
Definition: forward_dynamics.h:41
Definition: inertia_properties.h:25
Vector6D Column6D
ForwardDynamics(iit::ct_quadrotor::dyn::tpl::InertiaProperties< TRAIT > &in, MotionTransforms &tr)
Definition: forward_dynamics.impl.h:9
Definition: link_data_map.h:12
iit::rbd::tpl::InertiaMatrixDense< SCALAR > InertiaMatrix
Definition: forward_dynamics.h:51
CoreS::VelocityVector Acceleration
Definition: forward_dynamics.h:46
CoreS::VelocityVector Velocity
Definition: forward_dynamics.h:45
Vector6D ForceVector
LinkDataMap< typename CoreS::ForceVector > ExtForces
Definition: forward_dynamics.h:43
iit::ct_quadrotor::tpl::JointState< SCALAR > JointState
Definition: forward_dynamics.h:48
void setJointStatus(const JointState &q) const
Definition: forward_dynamics.h:127
void fd(JointState &qdd, Acceleration &body_a, const Velocity &body_v, const Acceleration &g, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:133
iit::ct_quadrotor::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:52
Vector6D VelocityVector
CoreS::Column6D Column6DS
Definition: forward_dynamics.h:47