- 3.0.2 models module.
inverse_dynamics.impl.h
Go to the documentation of this file.
1 // Initialization of static-const data
2 template <typename TRAIT>
5 
6 template <typename TRAIT>
8  inertiaProps( & inertia ),
9  xm( & transforms ),
10  Link1_I(inertiaProps->getTensor_Link1() )
11  {
12 #ifndef EIGEN_NO_DEBUG
13  std::cout << "Robot ct_InvertedPendulum, InverseDynamics<TRAIT>::InverseDynamics()" << std::endl;
14  std::cout << "Compiled with Eigen debug active" << std::endl;
15 #endif
16  Link1_v.setZero();
17 
18  vcross.setZero();
19 }
20 
21 template <typename TRAIT>
23  JointState& jForces,
24  const JointState& qd, const JointState& qdd,
25  const ExtForces& fext)
26 {
27  firstPass(qd, qdd, fext);
28  secondPass(jForces);
29 }
30 
31 template <typename TRAIT>
33 {
34  // Link 'Link1'
35  Link1_a = (xm->fr_Link1_X_fr_InvertedPendulumBase).col(iit::rbd::LZ) * Scalar(iit::rbd::g);
36  Link1_f = Link1_I * Link1_a;
37 
38  secondPass(jForces);
39 }
40 
41 template <typename TRAIT>
43 {
44  // Link 'Link1'
45  Link1_v(iit::rbd::AZ) = qd(JOINT1); // Link1_v = vJ, for the first link of a fixed base robot
46 
47  Link1_f = iit::rbd::vxIv(qd(JOINT1), Link1_I);
48 
49 
50  secondPass(jForces);
51 }
52 
53 template <typename TRAIT>
55 {
56  // First pass, link 'Link1'
57  Link1_a = (xm->fr_Link1_X_fr_InvertedPendulumBase).col(iit::rbd::LZ) * Scalar(iit::rbd::g);
58  Link1_a(iit::rbd::AZ) += qdd(JOINT1);
59  Link1_v(iit::rbd::AZ) = qd(JOINT1); // Link1_v = vJ, for the first link of a fixed base robot
60 
61  Link1_f = Link1_I * Link1_a + iit::rbd::vxIv(qd(JOINT1), Link1_I) - fext[LINK1];
62 
63 }
64 
65 template <typename TRAIT>
67 {
68  // Link 'Link1'
69  jForces(JOINT1) = Link1_f(iit::rbd::AZ);
70 }
void C_terms(JointState &jForces, const JointState &q, const JointState &qd)
Definition: inverse_dynamics.h:166
Definition: declarations.h:31
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
Definition: declarations.h:26
Force< DScalar > vxIv(const Velocity< DScalar > &v, const MatrixBase< Derived > &I)
Definition: link_data_map.h:12
iit::ct_InvertedPendulum::tpl::JointState< Scalar > JointState
Definition: inverse_dynamics.h:54
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
void firstPass(const JointState &qd, const JointState &qdd, const ExtForces &fext)
Definition: inverse_dynamics.impl.h:54
void G_terms(JointState &jForces, const JointState &q)
Definition: inverse_dynamics.h:159
InverseDynamics(IProperties &in, MTransforms &tr)
Definition: inverse_dynamics.impl.h:7