pinocchio  2.1.3
data.hpp
1 //
2 // Copyright (c) 2015-2019 CNRS INRIA
3 // Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 
6 #ifndef __pinocchio_data_hpp__
7 #define __pinocchio_data_hpp__
8 
9 #include "pinocchio/spatial/fwd.hpp"
10 #include "pinocchio/spatial/se3.hpp"
11 #include "pinocchio/spatial/force.hpp"
12 #include "pinocchio/spatial/motion.hpp"
13 #include "pinocchio/spatial/inertia.hpp"
14 #include "pinocchio/multibody/fwd.hpp"
15 #include "pinocchio/multibody/joint/joint-generic.hpp"
16 #include "pinocchio/container/aligned-vector.hpp"
17 
18 #include <iostream>
19 #include <Eigen/Cholesky>
20 
21 namespace pinocchio
22 {
23 
24  template<typename _Scalar, int _Options, template<typename,int> class JointCollectionTpl>
25  struct DataTpl
26  {
27  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
28 
29  typedef _Scalar Scalar;
30  enum { Options = _Options };
31 
32  typedef JointCollectionTpl<Scalar,Options> JointCollection;
33 
35 
41 
42  typedef pinocchio::Index Index;
43  typedef pinocchio::JointIndex JointIndex;
44  typedef pinocchio::GeomIndex GeomIndex;
45  typedef pinocchio::FrameIndex FrameIndex;
46  typedef std::vector<Index> IndexVector;
47 
50 
53 
54  typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic,Options> MatrixXs;
55  typedef Eigen::Matrix<Scalar,Eigen::Dynamic,1,Options> VectorXs;
56  typedef Eigen::Matrix<Scalar,3,1,Options> Vector3;
57 
59  typedef VectorXs ConfigVectorType;
60 
63  typedef VectorXs TangentVectorType;
64 
66  typedef Eigen::Matrix<Scalar,6,Eigen::Dynamic,Options> Matrix6x;
68  typedef Eigen::Matrix<Scalar,3,Eigen::Dynamic,Options> Matrix3x;
69 
70  typedef Eigen::Matrix<Scalar,6,6,Options> Matrix6;
71  typedef Eigen::Matrix<Scalar,6,6,Eigen::RowMajor | Options> RowMatrix6;
72  typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor | Options> RowMatrixXs;
73 
76  JointDataVector joints;
77 
80 
83 
86 
89 
92 
95 
99 
103 
106 
109 
112 
115 
117  TangentVectorType tau;
118 
122  VectorXs nle;
123 
127  VectorXs g;
128 
131 
135 
137  container::aligned_vector<typename Inertia::Matrix6> dYcrb; // TODO: change with dense symmetric matrix6
138 
140  MatrixXs M;
141 
143  RowMatrixXs Minv;
144 
146  MatrixXs C;
147 
149  Matrix6x dHdq;
150 
152  Matrix6x dFdq;
153 
155  Matrix6x dFdv;
156 
158  Matrix6x dFda;
159 
161  Matrix6x SDinv;
162 
164  Matrix6x UDinv;
165 
167  Matrix6x IS;
168 
171 
174 
177 
180 
182  typename Inertia::Matrix6 Itmp;
183 
185  Matrix6 M6tmp;
186  RowMatrix6 M6tmpR;
187  RowMatrix6 M6tmpR2;
188 
190  TangentVectorType ddq;
191 
192  // ABA internal data
194  container::aligned_vector<typename Inertia::Matrix6> Yaba; // TODO: change with dense symmetric matrix6
195 
197  TangentVectorType u; // Joint Inertia
198 
199  // CCRBA return quantities
202  Matrix6x Ag;
203 
204  // dCCRBA return quantities
207  Matrix6x dAg;
208 
213  Force hg;
214 
219  Force dhg;
220 
223  Inertia Ig;
224 
227 
229  std::vector<int> lastChild;
231  std::vector<int> nvSubtree;
232 
234  MatrixXs U;
235 
237  VectorXs D;
238 
240  VectorXs Dinv;
241 
243  VectorXs tmp;
244 
246  std::vector<int> parents_fromRow;
247 
249  std::vector<int> nvSubtree_fromRow;
250 
253  Matrix6x J;
254 
256  Matrix6x dJ;
257 
259  Matrix6x dVdq;
260 
262  Matrix6x dAdq;
263 
265  Matrix6x dAdv;
266 
268  MatrixXs dtau_dq;
269 
271  MatrixXs dtau_dv;
272 
274  MatrixXs ddq_dq;
275 
277  MatrixXs ddq_dv;
278 
281 
284 
287 
290 
292  std::vector<Scalar> mass;
293 
296  Matrix3x Jcom;
297 
298 
301 
304 
305  // Temporary variables used in forward dynamics
306 
308  MatrixXs JMinvJt;
309 
311  Eigen::LLT<MatrixXs> llt_JMinvJt;
312 
314  VectorXs lambda_c;
315 
317  MatrixXs sDUiJt;
318 
320  VectorXs torque_residual;
321 
323  TangentVectorType dq_after;
324 
326  VectorXs impulse_c;
327 
328  // data related to regressor
329  Matrix3x staticRegressor;
330 
336  explicit DataTpl(const Model & model);
337 
338  private:
339  void computeLastChild(const Model & model);
340  void computeParents_fromRow(const Model & model);
341 
342  };
343 
344 } // namespace pinocchio
345 
346 /* --- Details -------------------------------------------------------------- */
347 /* --- Details -------------------------------------------------------------- */
348 /* --- Details -------------------------------------------------------------- */
349 #include "pinocchio/multibody/data.hxx"
350 
351 #endif // ifndef __pinocchio_data_hpp__
352 
DataTpl(const Model &model)
Default constructor of pinocchio::Data from a pinocchio::Model.
MatrixXs ddq_dv
Partial derivative of the joint acceleration vector with respect to the joint velocity.
Definition: data.hpp:277
JointDataVector joints
Vector of pinocchio::JointData associated to the pinocchio::JointModel stored in model, encapsulated in JointDataAccessor.
Definition: data.hpp:76
Matrix6x dFda
Variation of the forceset with respect to the joint acceleration.
Definition: data.hpp:158
RowMatrixXs Minv
The inverse of the joint space inertia matrix (a square matrix of dim model.nv).
Definition: data.hpp:143
Eigen::LLT< MatrixXs > llt_JMinvJt
Cholesky decompostion of .
Definition: data.hpp:311
Matrix3x Jcom
Jacobien of center of mass.
Definition: data.hpp:296
container::aligned_vector< Force > oh
Vector of spatial momenta expressed in the world frame.
Definition: data.hpp:108
container::aligned_vector< Vector3 > vcom
Vector of subtree center of mass linear velocities expressed in the root joint of the subtree...
Definition: data.hpp:286
std::vector< int > lastChild
Index of the last child (for CRBA)
Definition: data.hpp:229
Matrix6x UDinv
Used in computeMinverse.
Definition: data.hpp:164
VectorXs Dinv
Diagonal inverse of the joint space intertia matrix obtained by a Cholesky Decomposition.
Definition: data.hpp:240
container::aligned_vector< Motion > a_gf
Vector of joint accelerations due to the gravity field.
Definition: data.hpp:85
container::aligned_vector< Motion > a
Vector of joint accelerations expressed at the centers of the joints frames.
Definition: data.hpp:79
MatrixXs dtau_dq
Partial derivative of the joint torque vector with respect to the joint configuration.
Definition: data.hpp:268
MatrixXs JMinvJt
Inverse of the operational-space inertia matrix.
Definition: data.hpp:308
container::aligned_vector< Inertia > oYcrb
Inertia quantities expressed in the world frame.
Definition: data.hpp:176
TangentVectorType dq_after
Generalized velocity after impact.
Definition: data.hpp:323
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
MatrixXs sDUiJt
Temporary corresponding to .
Definition: data.hpp:317
Matrix6x dFdq
Variation of the forceset with respect to the joint configuration.
Definition: data.hpp:152
Inertia Ig
Centroidal Composite Rigid Body Inertia.
Definition: data.hpp:223
container::aligned_vector< Force > h
Vector of spatial momenta expressed in the local frame of the joint.
Definition: data.hpp:105
Matrix6x dAdv
Variation of the spatial acceleration set with respect to the joint velocity.
Definition: data.hpp:265
Matrix6x Ag
Centroidal Momentum Matrix.
Definition: data.hpp:202
TangentVectorType u
Intermediate quantity corresponding to apparent torque [ABA].
Definition: data.hpp:197
VectorXs torque_residual
Temporary corresponding to the residual torque .
Definition: data.hpp:320
Matrix6x dFdv
Variation of the forceset with respect to the joint velocity.
Definition: data.hpp:155
container::aligned_vector< Matrix6x > Fcrb
Spatial forces set, used in CRBA and CCRBA.
Definition: data.hpp:226
Matrix6x dAg
Centroidal Momentum Matrix Time Variation.
Definition: data.hpp:207
container::aligned_vector< SE3 > oMi
Vector of absolute joint placements (wrt the world).
Definition: data.hpp:111
VectorXs ConfigVectorType
Dense vectorized version of a joint configuration vector.
Definition: data.hpp:59
std::vector< int > nvSubtree_fromRow
Subtree of the current row index (used in Cholesky Decomposition).
Definition: data.hpp:249
Force dhg
Centroidal momentum time derivative.
Definition: data.hpp:219
Matrix6x dAdq
Variation of the spatial acceleration set with respect to the joint configuration.
Definition: data.hpp:262
MatrixXs ddq_dq
Partial derivative of the joint acceleration vector with respect to the joint configuration.
Definition: data.hpp:274
Matrix6x dHdq
Variation of the spatial momenta with respect to the joint configuration.
Definition: data.hpp:149
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
Definition: data.hpp:66
MatrixXs M
The joint space inertia matrix (a square matrix of dim model.nv).
Definition: data.hpp:140
Matrix6x dJ
Derivative of the Jacobian with respect to the time.
Definition: data.hpp:256
Inertia::Matrix6 Itmp
Temporary for derivative algorithms.
Definition: data.hpp:182
VectorXs g
Vector of generalized gravity (dim model.nv).
Definition: data.hpp:127
container::aligned_vector< typename Inertia::Matrix6 > Ivx
Left variation of the inertia matrix.
Definition: data.hpp:173
VectorXs nle
Vector of Non Linear Effects (dim model.nv). It corresponds to concatenation of the Coriolis...
Definition: data.hpp:122
container::aligned_vector< Motion > ov
Vector of joint velocities expressed at the origin.
Definition: data.hpp:94
MatrixXs C
The Coriolis matrix (a square matrix of dim model.nv).
Definition: data.hpp:146
container::aligned_vector< Vector3 > acom
Vector of subtree center of mass linear accelerations expressed in the root joint of the subtree...
Definition: data.hpp:289
Eigen::Matrix< Scalar, 3, Eigen::Dynamic, Options > Matrix3x
The 3d jacobian type (temporary)
Definition: data.hpp:68
container::aligned_vector< Motion > v
Vector of joint velocities expressed at the centers of the joints.
Definition: data.hpp:91
TangentVectorType ddq
The joint accelerations computed from ABA.
Definition: data.hpp:190
VectorXs TangentVectorType
Dense vectorized version of a joint tangent vector (e.g. velocity, acceleration, etc). It also handles the notion of co-tangent vector (e.g. torque, etc).
Definition: data.hpp:63
container::aligned_vector< Force > f
Vector of body forces expressed in the local frame of the joint. For each body, the force represents ...
Definition: data.hpp:98
std::vector< Scalar > mass
Vector of subtree mass. In other words, mass[j] is the mass of the subtree supported by joint ...
Definition: data.hpp:292
container::aligned_vector< typename Inertia::Matrix6 > doYcrb
Time variation of the inertia quantities expressed in the world frame.
Definition: data.hpp:179
MatrixXs dtau_dv
Partial derivative of the joint torque vector with respect to the joint velocity. ...
Definition: data.hpp:271
VectorXs D
Diagonal of the joint space intertia matrix obtained by a Cholesky Decomposition. ...
Definition: data.hpp:237
container::aligned_vector< SE3 > oMf
Vector of absolute operationnel frame placements (wrt the world).
Definition: data.hpp:130
VectorXs lambda_c
Lagrange Multipliers corresponding to the contact forces in pinocchio::forwardDynamics.
Definition: data.hpp:314
container::aligned_vector< Force > of
Vector of body forces expressed in the world frame. For each body, the force represents the sum of al...
Definition: data.hpp:102
MatrixXs U
Joint space intertia matrix square root (upper trianglular part) computed with a Cholesky Decompositi...
Definition: data.hpp:234
Matrix6x J
Jacobian of joint placements.
Definition: data.hpp:253
VectorXs tmp
Temporary of size NV used in Cholesky Decomposition.
Definition: data.hpp:243
container::aligned_vector< Motion > oa_gf
Vector of joint accelerations expressed at the origin of the world including gravity contribution...
Definition: data.hpp:88
VectorXs impulse_c
Lagrange Multipliers corresponding to the contact impulses in pinocchio::impulseDynamics.
Definition: data.hpp:326
Main pinocchio namespace.
Definition: treeview.dox:24
TangentVectorType tau
Vector of joint torques (dim model.nv).
Definition: data.hpp:117
container::aligned_vector< Vector3 > com
Vector of subtree center of mass positions expressed in the root joint of the subtree. In other words, com[j] is the CoM position of the subtree supported by joint and expressed in the joint frame . The element com[0] corresponds to the center of mass position of the whole model and expressed in the global frame.
Definition: data.hpp:283
std::vector< int > parents_fromRow
First previous non-zero row in M (used in Cholesky Decomposition).
Definition: data.hpp:246
container::aligned_vector< typename Inertia::Matrix6 > dYcrb
Vector of sub-tree composite rigid body inertia time derivatives . See Data::Ycrb for more details...
Definition: data.hpp:137
Matrix6x IS
Used in computeMinverse.
Definition: data.hpp:167
Matrix6x SDinv
Used in computeMinverse.
Definition: data.hpp:161
container::aligned_vector< typename Inertia::Matrix6 > Yaba
Inertia matrix of the subtree expressed as dense matrix [ABA].
Definition: data.hpp:194
container::aligned_vector< SE3 > iMf
Vector of joint placements wrt to algorithm end effector.
Definition: data.hpp:280
std::vector< int > nvSubtree
Dimension of the subtree motion space (for CRBA)
Definition: data.hpp:231
Matrix6x dVdq
Variation of the spatial velocity set with respect to the joint configuration.
Definition: data.hpp:259
Scalar kinetic_energy
Kinetic energy of the model.
Definition: data.hpp:300
container::aligned_vector< typename Inertia::Matrix6 > vxI
Right variation of the inertia matrix.
Definition: data.hpp:170
Matrix6 M6tmp
Temporary for derivative algorithms.
Definition: data.hpp:185
container::aligned_vector< SE3 > liMi
Vector of relative joint placements (wrt the body parent).
Definition: data.hpp:114
container::aligned_vector< Inertia > Ycrb
Vector of sub-tree composite rigid body inertias, i.e. the apparent inertia of the subtree supported ...
Definition: data.hpp:134
container::aligned_vector< Motion > oa
Vector of joint accelerations expressed at the origin of the world.
Definition: data.hpp:82
Force hg
Centroidal momentum quantity.
Definition: data.hpp:213
Scalar potential_energy
Potential energy of the model.
Definition: data.hpp:303