- 3.0.2 models module.
forward_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_ROBOT_CT_DOUBLEINVERTEDPENDULUM_FORWARD_DYNAMICS_H_
2 #define IIT_ROBOT_CT_DOUBLEINVERTEDPENDULUM_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 ct_DoubleInvertedPendulum {
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;
42  typedef typename CoreS::VelocityVector Velocity;
44  typedef typename CoreS::Column6D Column6DS;
45  typedef typename CoreS::Matrix66 Matrix66S;
48  typedef iit::ct_DoubleInvertedPendulum::tpl::MotionTransforms<TRAIT> MTransforms;
49 
50 public:
58  ForwardDynamics(InertiaProperties<TRAIT>& in, MTransforms& tr);
62 
71  void fd(
72  JointState& qdd, // output parameter
73  const JointState& q, const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
74  void fd(
75  JointState& qdd, // output parameter
76  const JointState& qd, const JointState& tau, const ExtForces& fext = zeroExtForces);
78 
80  void setJointStatus(const JointState& q) const;
81 
82 private:
83  InertiaProperties<TRAIT>* inertiaProps;
84  MTransforms* motionTransforms;
85 
86  Matrix66S vcross; // support variable
87  Matrix66S Ia_r; // support variable, articulated inertia in the case of a revolute joint
88 
89  // Link 'Link1' :
90  Matrix66S Link1_AI;
91  Velocity Link1_a;
92  Velocity Link1_v;
93  Velocity Link1_c;
94  Force Link1_p;
95 
96  Column6DS Link1_U;
97  Scalar Link1_D;
98  Scalar Link1_u;
99  // Link 'Link2' :
100  Matrix66S Link2_AI;
101  Velocity Link2_a;
102  Velocity Link2_v;
103  Velocity Link2_c;
104  Force Link2_p;
105 
106  Column6DS Link2_U;
107  Scalar Link2_D;
108  Scalar Link2_u;
109 private:
110  static const ExtForces zeroExtForces;
111 };
112 
113 template <typename TRAIT>
115  (motionTransforms-> fr_Link1_X_fr_DoubleInvertedPendulumBase)(q);
116  (motionTransforms-> fr_Link2_X_fr_Link1)(q);
117 }
118 
119 template <typename TRAIT>
121  JointState& qdd,
122  const JointState& q,
123  const JointState& qd,
124  const JointState& tau,
125  const ExtForces& fext/* = zeroExtForces */)
126 {
127  setJointStatus(q);
128  fd(qdd, qd, tau, fext);
129 }
130 
131 }
132 
134 
135 }
136 }
137 }
138 
139 #include "forward_dynamics.impl.h"
140 
141 #endif
Definition: link_data_map.h:12
ForwardDynamics(InertiaProperties< TRAIT > &in, MTransforms &tr)
Definition: forward_dynamics.impl.h:8
LinkDataMap< Force > ExtForces
Definition: forward_dynamics.h:46
CoreS::ForceVector Force
Definition: forward_dynamics.h:41
PlainMatrix< Scalar, 6, 6 > Matrix66
void fd(JointState &qdd, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:120
Column2d< SCALAR > JointState
Definition: declarations.h:19
ct::core::ADCodegenLinearizer< state_dim, control_dim >::ADCGScalar Scalar
Definition: HyALinearizationCodeGen.cpp:23
void setJointStatus(const JointState &q) const
Definition: forward_dynamics.h:114
CoreS::VelocityVector Acceleration
Definition: forward_dynamics.h:43
iit::ct_DoubleInvertedPendulum::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:48
iit::ct_DoubleInvertedPendulum::tpl::JointState< Scalar > JointState
Definition: forward_dynamics.h:47
Vector6D Column6D
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar Scalar
Definition: forward_dynamics.h:37
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:45
Vector6D ForceVector
CoreS::VelocityVector Velocity
Definition: forward_dynamics.h:42
iit::rbd::Core< Scalar > CoreS
Definition: forward_dynamics.h:39
CoreS::Column6D Column6DS
Definition: forward_dynamics.h:44
Vector6D VelocityVector