- 3.0.2 models module.
forward_dynamics.impl.h
Go to the documentation of this file.
1 
2 // Initialization of static-const data
3 template <typename TRAIT>
6 
7 template <typename TRAIT>
9  inertiaProps( & inertia ),
10  motionTransforms( & transforms )
11 {
12  Link1_v.setZero();
13  Link1_c.setZero();
14 
15  vcross.setZero();
16  Ia_r.setZero();
17 
18 }
19 
20 template <typename TRAIT>
22  JointState& qdd,
23  const JointState& qd,
24  const JointState& tau,
25  const ExtForces& fext/* = zeroExtForces */)
26 {
27 
28  Link1_AI = inertiaProps->getTensor_Link1();
29  Link1_p = - fext[LINK1];
30  // ---------------------- FIRST PASS ---------------------- //
31  // Note that, during the first pass, the articulated inertias are really
32  // just the spatial inertia of the links (see assignments above).
33  // Afterwards things change, and articulated inertias shall not be used
34  // in functions which work specifically with spatial inertias.
35 
36  // + Link Link1
37  // - The spatial velocity:
38  Link1_v(iit::rbd::AZ) = qd(JOINT1);
39 
40  // - The bias force term:
41  Link1_p += iit::rbd::vxIv(qd(JOINT1), Link1_AI);
42 
43 
44  // ---------------------- SECOND PASS ---------------------- //
45  Matrix66S IaB;
46  Force pa;
47 
48  // + Link Link1
49  Link1_u = tau(JOINT1) - Link1_p(iit::rbd::AZ);
50  Link1_U = Link1_AI.col(iit::rbd::AZ);
51  Link1_D = Link1_U(iit::rbd::AZ);
52 
53 
54 
55  // ---------------------- THIRD PASS ---------------------- //
56  Link1_a = (motionTransforms-> fr_Link1_X_fr_InvertedPendulumBase).col(iit::rbd::LZ) * Scalar(iit::rbd::g);
57  qdd(JOINT1) = (Link1_u - Link1_U.dot(Link1_a)) / Link1_D;
58  Link1_a(iit::rbd::AZ) += qdd(JOINT1);
59 
60 
61 }
Definition: declarations.h:31
ForwardDynamics(InertiaProperties< TRAIT > &in, MTransforms &tr)
Definition: forward_dynamics.impl.h:8
CoreS::Matrix66 Matrix66S
Definition: forward_dynamics.h:45
Definition: declarations.h:26
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef TRAIT::Scalar Scalar
Definition: forward_dynamics.h:37
Force< DScalar > vxIv(const Velocity< DScalar > &v, const MatrixBase< Derived > &I)
Definition: link_data_map.h:12
void fd(JointState &qdd, const JointState &q, const JointState &qd, const JointState &tau, const ExtForces &fext=zeroExtForces)
Definition: forward_dynamics.h:109
CoreS::ForceVector Force
Definition: forward_dynamics.h:41
iit::ct_InvertedPendulum::tpl::MotionTransforms< TRAIT > MTransforms
Definition: forward_dynamics.h:48
iit::ct_InvertedPendulum::tpl::JointState< Scalar > JointState
Definition: forward_dynamics.h:47