- 3.0.2 models module.
jsim.impl.h
Go to the documentation of this file.
1 
2 
3 //Implementation of default constructor
4 template <typename TRAIT>
6  linkInertias(inertiaProperties),
7  frcTransf( &forceTransforms ),
8  Link2_Ic(linkInertias.getTensor_Link2())
9 {
10  //Initialize the matrix itself
11  this->setZero();
12 }
13 
14 #define DATA tpl::JSIM<TRAIT>::operator()
15 
16 template <typename TRAIT>
18  ForceVector F;
19 
20  // Precomputes only once the coordinate transforms:
21  frcTransf -> fr_Link1_X_fr_Link2(state);
22 
23  // Initializes the composite inertia tensors
24  Link1_Ic = linkInertias.getTensor_Link1();
25 
26  // "Bottom-up" loop to update the inertia-composite property of each link, for the current configuration
27 
28  // Link Link2:
29  iit::rbd::transformInertia<Scalar>(Link2_Ic, frcTransf -> fr_Link1_X_fr_Link2, Ic_spare);
30  Link1_Ic += Ic_spare;
31 
32  F = Link2_Ic.col(iit::rbd::AZ);
34 
35  F = frcTransf -> fr_Link1_X_fr_Link2 * F;
38 
39  // Link Link1:
40 
41  F = Link1_Ic.col(iit::rbd::AZ);
43 
44 
45  return *this;
46 }
47 
48 #undef DATA
49 #undef F
50 
51 template <typename TRAIT>
53  L = this -> template triangularView<Eigen::Lower>();
54  // Joint Joint2, index 1 :
55  L(1, 1) = std::sqrt(L(1, 1));
56  L(1, 0) = L(1, 0) / L(1, 1);
57  L(0, 0) = L(0, 0) - L(1, 0) * L(1, 0);
58 
59  // Joint Joint1, index 0 :
60  L(0, 0) = std::sqrt(L(0, 0));
61 
62 }
63 
64 template <typename TRAIT>
67 
68  inverse(0, 0) = + (Linv(0, 0) * Linv(0, 0));
69  inverse(1, 1) = + (Linv(1, 0) * Linv(1, 0)) + (Linv(1, 1) * Linv(1, 1));
70  inverse(1, 0) = + (Linv(1, 0) * Linv(0, 0));
71  inverse(0, 1) = inverse(1, 0);
72 }
73 
74 template <typename TRAIT>
76  //assumes L has been computed already
77  Linv(0, 0) = 1 / L(0, 0);
78  Linv(1, 1) = 1 / L(1, 1);
79  Linv(1, 0) = - Linv(0, 0) * ((Linv(1, 1) * L(1, 0)) + 0);
80 }
81 
JSIM(IProperties &, FTransforms &)
Definition: jsim.impl.h:5
Definition: declarations.h:27
void computeL()
Definition: jsim.impl.h:52
const JSIM & update(const JointState &)
Definition: jsim.impl.h:17
Definition: declarations.h:26
CoreS::ForceVector ForceVector
Definition: jsim.h:39
iit::ct_DoubleInvertedPendulum::tpl::ForceTransforms< TRAIT > FTransforms
Definition: jsim.h:37
#define F(i, j)
Definition: jsim.impl.h:19
const IMatrix & getTensor_Link1() const
Definition: inertia_properties.h:55
void computeLInverse()
Definition: jsim.impl.h:75
void computeInverse()
Definition: jsim.impl.h:65
#define DATA
Definition: jsim.impl.h:14
iit::ct_DoubleInvertedPendulum::tpl::JointState< Scalar > JointState
Definition: jsim.h:32