- 3.0.2 models module.
jsim.h
Go to the documentation of this file.
1 #ifndef IIT_CT_QUADROTOR_JSIM_H_
2 #define IIT_CT_QUADROTOR_JSIM_H_
3 
4 #include <iit/rbd/rbd.h>
7 
8 #include "declarations.h"
9 #include "transforms.h"
10 #include "inertia_properties.h"
12 
13 
14 namespace iit {
15 namespace ct_quadrotor {
16 namespace dyn {
17 
18 namespace tpl{
19 
23 template <class TRAIT>
24 class JSIM : public iit::rbd::StateDependentMatrix<iit::ct_quadrotor::JointState, 8, 8, JSIM<TRAIT>>
25 {
26  public:
27  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28  private:
30  public:
31  typedef typename TRAIT::Scalar SCALAR;
32  typedef typename Base::Index Index;
33  typedef Eigen::Matrix<SCALAR,8,8> MatrixType;
35  typedef const Eigen::Block<const MatrixType,6,2> BlockF_t;
37  typedef const Eigen::Block<const MatrixType,2,2> BlockFixedBase_t;
39  typedef iit::ct_quadrotor::tpl::ForceTransforms<TRAIT> FTransforms;
41 
42  public:
43  JSIM(IProperties&, FTransforms&);
44  ~JSIM() {}
45 
47 
48 
52  void computeL();
59  void computeInverse();
63  const MatrixType& getL() const;
67  const MatrixType& getInverse() const;
68 
79  const InertiaMatrix& getWholeBodyInertia() const;
86  const BlockF_t getF() const;
94  const BlockFixedBase_t getFixedBaseBlock() const;
95  protected:
99  void computeLInverse();
100  private:
101  IProperties& linkInertias;
102  FTransforms* frcTransf;
103 
104  // The composite-inertia tensor for each link
105  InertiaMatrix body_Ic;
106  InertiaMatrix link1_Ic;
107  const InertiaMatrix& link2_Ic;
108  InertiaMatrix Ic_spare;
109 
110  MatrixType L;
111  MatrixType Linv;
112  MatrixType inverse;
113 };
114 
115 template <class TRAIT>
116 inline const typename JSIM<TRAIT>::MatrixType& JSIM<TRAIT>::getL() const {
117  return L;
118 }
119 
120 template <class TRAIT>
121 inline const typename JSIM<TRAIT>::MatrixType& JSIM<TRAIT>::getInverse() const {
122  return inverse;
123 }
124 
125 template <class TRAIT>
127  return body_Ic;
128 }
129 
130 template <class TRAIT>
131 inline const typename JSIM<TRAIT>::BlockF_t JSIM<TRAIT>::getF() const {
132  return JSIM<TRAIT>:: template block<6,2>(0,6);
133 }
134 
135 template <class TRAIT>
137  return JSIM<TRAIT>:: template block<2,2>(6,6);
138 }
139 
140 } // namespace tpl
141 
143 
144 }
145 }
146 }
147 
148 #include "jsim.impl.h"
149 
150 #endif
void computeL()
Definition: jsim.impl.h:62
Column2d JointState
Definition: declarations.h:23
JSIM(IProperties &, FTransforms &)
Definition: jsim.impl.h:4
const BlockFixedBase_t getFixedBaseBlock() const
Definition: jsim.h:136
iit::rbd::tpl::InertiaMatrixDense< SCALAR > InertiaMatrix
Definition: jsim.h:40
const Eigen::Block< const MatrixType, 2, 2 > BlockFixedBase_t
Definition: jsim.h:37
const MatrixType & getL() const
Definition: jsim.h:116
ct::core::ADCodegenLinearizer< state_dim, control_dim >::ADCGScalar Scalar
Definition: HyALinearizationCodeGen.cpp:23
const BlockF_t getF() const
Definition: jsim.h:131
TRAIT::Scalar SCALAR
Definition: jsim.h:31
Base::Index Index
Definition: jsim.h:32
iit::ct_quadrotor::tpl::ForceTransforms< TRAIT > FTransforms
Definition: jsim.h:39
Definition: inertia_properties.h:25
const MatrixType & getInverse() const
Definition: jsim.h:121
InertiaProperties< TRAIT > IProperties
Definition: jsim.h:38
void computeLInverse()
Definition: jsim.impl.h:85
void computeInverse()
Definition: jsim.impl.h:75
const InertiaMatrix & getWholeBodyInertia() const
Definition: jsim.h:126
Eigen::Matrix< SCALAR, 8, 8 > MatrixType
Definition: jsim.h:33
const JSIM & update(const iit::ct_quadrotor::JointState &)
Definition: jsim.impl.h:18
const Eigen::Block< const MatrixType, 6, 2 > BlockF_t
Definition: jsim.h:35
~JSIM()
Definition: jsim.h:44