- 3.0.2 models module.
inverse_dynamics.h
Go to the documentation of this file.
1 #ifndef IIT_CT_INVERTEDPENDULUM_INVERSE_DYNAMICS_H_
2 #define IIT_CT_INVERTEDPENDULUM_INVERSE_DYNAMICS_H_
3 
4 #include <iit/rbd/rbd.h>
6 #include <iit/rbd/utils.h>
9 
10 #include "declarations.h"
11 #include "inertia_properties.h"
12 #include "transforms.h"
13 #include "link_data_map.h"
14 
15 namespace iit {
16 namespace ct_InvertedPendulum {
17 namespace dyn {
18 
38 namespace tpl {
39 
40 template <typename TRAIT>
42 public:
43  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
44 
45  typedef typename TRAIT::Scalar Scalar;
46 
48 
49  typedef typename CoreS::ForceVector Force;
50  typedef typename CoreS::VelocityVector Velocity;
52  typedef typename CoreS::Matrix66 Matrix66s;
56  typedef iit::ct_InvertedPendulum::tpl::MotionTransforms<TRAIT> MTransforms;
58 
59 public:
67  InverseDynamics(IProperties& in, MTransforms& tr);
68 
79  void id(
81  JointState& jForces,
82  const JointState& q, const JointState& qd, const JointState& qdd,
83  const ExtForces& fext = zeroExtForces);
84  void id(
85  JointState& jForces,
86  const JointState& qd, const JointState& qdd,
87  const ExtForces& fext = zeroExtForces);
89 
94  void G_terms(JointState& jForces, const JointState& q);
96  void G_terms(JointState& jForces);
98 
103  void C_terms(JointState& jForces, const JointState& q, const JointState& qd);
105  void C_terms(JointState& jForces, const JointState& qd);
107 
108  void setJointStatus(const JointState& q) const;
109 
110 public:
127  const Velocity& getVelocity_Link1() const { return Link1_v; }
129  const Acceleration& getAcceleration_Link1() const { return Link1_a; }
130  const Force& getForce_Link1() const { return Link1_f; }
132 protected:
133  void firstPass(const JointState& qd, const JointState& qdd, const ExtForces& fext);
134  void secondPass(JointState& jForces);
135 
136 private:
137  IProperties* inertiaProps;
138  MTransforms* xm;
139 private:
140  Matrix66s vcross; // support variable
141  // Link 'Link1' :
142  const InertiaMatrix& Link1_I;
143  Velocity Link1_v;
144  Acceleration Link1_a;
145  Force Link1_f;
146 
147 
148 private:
149  static const ExtForces zeroExtForces;
150 };
151 
152 template <typename TRAIT>
154 {
155  (xm->fr_Link1_X_fr_InvertedPendulumBase)(q);
156 }
157 
158 template <typename TRAIT>
160 {
161  setJointStatus(q);
162  G_terms(jForces);
163 }
164 
165 template <typename TRAIT>
166 inline void InverseDynamics<TRAIT>::C_terms(JointState& jForces, const JointState& q, const JointState& qd)
167 {
168  setJointStatus(q);
169  C_terms(jForces, qd);
170 }
171 
172 template <typename TRAIT>
174  JointState& jForces,
175  const JointState& q, const JointState& qd, const JointState& qdd,
176  const ExtForces& fext)
177 {
178  setJointStatus(q);
179  id(jForces, qd, qdd, fext);
180 }
181 
182 }
183 
185 
186 }
187 }
188 
189 }
190 
191 #include "inverse_dynamics.impl.h"
192 
193 #endif
void C_terms(JointState &jForces, const JointState &q, const JointState &qd)
Definition: inverse_dynamics.h:166
iit::ct_InvertedPendulum::tpl::MotionTransforms< TRAIT > MTransforms
Definition: inverse_dynamics.h:56
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar Scalar
Definition: inverse_dynamics.h:45
CoreS::ForceVector Force
Definition: inverse_dynamics.h:49
PlainMatrix< Scalar, 6, 6 > Matrix66
void setJointStatus(const JointState &q) const
Definition: inverse_dynamics.h:153
const Velocity & getVelocity_Link1() const
Definition: inverse_dynamics.h:128
iit::rbd::Core< Scalar > CoreS
Definition: inverse_dynamics.h:47
const Force & getForce_Link1() const
Definition: inverse_dynamics.h:130
ct::core::ADCodegenLinearizer< state_dim, control_dim >::ADCGScalar Scalar
Definition: HyALinearizationCodeGen.cpp:23
CoreS::VelocityVector Velocity
Definition: inverse_dynamics.h:50
Definition: link_data_map.h:12
iit::ct_InvertedPendulum::tpl::JointState< Scalar > JointState
Definition: inverse_dynamics.h:54
Column1d< SCALAR > JointState
Definition: declarations.h:19
CoreS::Matrix66 Matrix66s
Definition: inverse_dynamics.h:52
void secondPass(JointState &jForces)
Definition: inverse_dynamics.impl.h:66
void id(JointState &jForces, const JointState &q, const JointState &qd, const JointState &qdd, const ExtForces &fext=zeroExtForces)
Definition: inverse_dynamics.h:173
LinkDataMap< Force > ExtForces
Definition: inverse_dynamics.h:55
void firstPass(const JointState &qd, const JointState &qdd, const ExtForces &fext)
Definition: inverse_dynamics.impl.h:54
Vector6D ForceVector
InertiaProperties< TRAIT > IProperties
Definition: inverse_dynamics.h:57
iit::rbd::tpl::InertiaMatrixDense< Scalar > InertiaMatrix
Definition: inverse_dynamics.h:53
const Acceleration & getAcceleration_Link1() const
Definition: inverse_dynamics.h:129
void G_terms(JointState &jForces, const JointState &q)
Definition: inverse_dynamics.h:159
Vector6D VelocityVector
CoreS::VelocityVector Acceleration
Definition: inverse_dynamics.h:51
InverseDynamics(IProperties &in, MTransforms &tr)
Definition: inverse_dynamics.impl.h:7