pinocchio  UNKNOWN
data.hpp
1 //
2 // Copyright (c) 2015-2018 CNRS
3 // Copyright (c) 2015 Wandercraft, 86 rue de Paris 91400 Orsay, France.
4 //
5 // This file is part of Pinocchio
6 // Pinocchio is free software: you can redistribute it
7 // and/or modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation, either version
9 // 3 of the License, or (at your option) any later version.
10 //
11 // Pinocchio is distributed in the hope that it will be
12 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // General Lesser Public License for more details. You should have
15 // received a copy of the GNU Lesser General Public License along with
16 // Pinocchio If not, see
17 // <http://www.gnu.org/licenses/>.
18 
19 #ifndef __se3_data_hpp__
20 #define __se3_data_hpp__
21 
22 #include "pinocchio/spatial/fwd.hpp"
23 #include "pinocchio/spatial/se3.hpp"
24 #include "pinocchio/spatial/force.hpp"
25 #include "pinocchio/spatial/motion.hpp"
26 #include "pinocchio/spatial/inertia.hpp"
27 #include "pinocchio/multibody/fwd.hpp"
28 #include "pinocchio/multibody/frame.hpp"
29 #include "pinocchio/multibody/joint/joint.hpp"
30 #include "pinocchio/deprecated.hh"
31 #include "pinocchio/utils/string-generator.hpp"
32 #include "pinocchio/container/aligned-vector.hpp"
33 
34 #include <iostream>
35 #include <Eigen/Cholesky>
36 
37 namespace se3
38 {
39 
40  struct Data
41  {
42  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 
45  typedef Eigen::Matrix<double,6,Eigen::Dynamic> Matrix6x;
47  typedef Eigen::Matrix<double,3,Eigen::Dynamic> Matrix3x;
48  typedef SE3::Vector3 Vector3;
49 
50  typedef Eigen::Matrix<double,6,6,Eigen::RowMajor> RowMatrix6;
51  typedef Eigen::Matrix<double,Eigen::Dynamic,Eigen::Dynamic,Eigen::RowMajor> RowMatrixXd;
52 
56 
59 
62 
65 
68 
71 
75 
79 
82 
85 
88 
91 
93  Eigen::VectorXd tau;
94 
98  Eigen::VectorXd nle;
99 
103  Eigen::VectorXd g;
104 
107 
111 
113  container::aligned_vector<Inertia::Matrix6> dYcrb; // TODO: change with dense symmetric matrix6
114 
116  Eigen::MatrixXd M;
117 
119  RowMatrixXd Minv;
120 
122  Eigen::MatrixXd C;
123 
125  Matrix6x dFdq;
126 
128  Matrix6x dFdv;
129 
131  Matrix6x dFda;
132 
134  Matrix6x SDinv;
135 
137  Matrix6x UDinv;
138 
140  Matrix6x IS;
141 
144 
147 
150 
153 
155  Inertia::Matrix6 Itmp;
156 
158  RowMatrix6 M6tmpR;
159 
161  Eigen::VectorXd ddq;
162 
163  // ABA internal data
165  container::aligned_vector<Inertia::Matrix6> Yaba; // TODO: change with dense symmetric matrix6
166 
168  Eigen::VectorXd u; // Joint Inertia
169 
170  // CCRBA return quantities
173  Matrix6x Ag;
174 
175  // dCCRBA return quantities
178  Matrix6x dAg;
179 
184 
188 
191 
193  std::vector<int> lastChild;
195  std::vector<int> nvSubtree;
196 
198  Eigen::MatrixXd U;
199 
201  Eigen::VectorXd D;
202 
204  Eigen::VectorXd Dinv;
205 
207  Eigen::VectorXd tmp;
208 
210  std::vector<int> parents_fromRow;
211 
213  std::vector<int> nvSubtree_fromRow;
214 
217  Matrix6x J;
218 
220  Matrix6x dJ;
221 
223  Matrix6x dVdq;
224 
226  Matrix6x dAdq;
227 
229  Matrix6x dAdv;
230 
232  Eigen::MatrixXd dtau_dq;
233 
235  Eigen::MatrixXd dtau_dv;
236 
238  Eigen::MatrixXd ddq_dq;
239 
241  Eigen::MatrixXd ddq_dv;
242 
245 
248 
251 
254 
256  std::vector<double> mass;
257 
260  Matrix3x Jcom;
261 
262 
265 
268 
269  // Temporary variables used in forward dynamics
270 
272  Eigen::MatrixXd JMinvJt;
273 
275  Eigen::LLT<Eigen::MatrixXd> llt_JMinvJt;
276 
278  Eigen::VectorXd lambda_c;
279 
281  Eigen::MatrixXd sDUiJt;
282 
284  Eigen::VectorXd torque_residual;
285 
287  Eigen::VectorXd dq_after;
288 
290  Eigen::VectorXd impulse_c;
291 
292  // data related to regressor
293  Matrix3x staticRegressor;
294 
300  explicit Data(const Model & model);
301 
302  private:
303  void computeLastChild(const Model& model);
304  void computeParents_fromRow(const Model& model);
305 
306  };
307 
308 } // namespace se3
309 
310 /* --- Details -------------------------------------------------------------- */
311 /* --- Details -------------------------------------------------------------- */
312 /* --- Details -------------------------------------------------------------- */
313 #include "pinocchio/multibody/data.hxx"
314 
315 #endif // ifndef __se3_data_hpp__
316 
Eigen::VectorXd tau
Vector of joint torques (dim model.nv).
Definition: data.hpp:93
container::aligned_vector< Force > oh
Vector of spatial momenta expressed in the world frame.
Definition: data.hpp:84
Matrix6x Ag
Centroidal Momentum Matrix.
Definition: data.hpp:173
double potential_energy
Potential energy of the model.
Definition: data.hpp:267
Inertia Ig
Centroidal Composite Rigid Body Inertia.
Definition: data.hpp:187
container::aligned_vector< Motion > a
Vector of joint accelerations expressed at the centers of the joints.
Definition: data.hpp:58
Matrix3x Jcom
Jacobien of center of mass.
Definition: data.hpp:260
container::aligned_vector< Eigen::Vector3d > vcom
Vector of subtree center of mass linear velocities expressed in the root joint of the subtree...
Definition: data.hpp:250
std::vector< int > nvSubtree
Dimension of the subtree motion space (for CRBA)
Definition: data.hpp:195
container::aligned_vector< Inertia > oYcrb
Inertia quantities expressed in the world frame.
Definition: data.hpp:149
Data(const Model &model)
Default constructor of se3::Data from a se3::Model.
Definition: data.hxx:35
container::aligned_vector< SE3 > iMf
Vector of joint placements wrt to algorithm end effector.
Definition: data.hpp:244
Eigen::VectorXd u
Intermediate quantity corresponding to apparent torque [ABA].
Definition: data.hpp:168
Eigen::VectorXd g
Vector of generalized gravity (dim model.nv).
Definition: data.hpp:103
Eigen::MatrixXd dtau_dv
Partial derivative of the joint torque vector with respect to the joint velocity. ...
Definition: data.hpp:235
Matrix6x dAdq
Variation of the spatial acceleration set with respect to the joint configuration.
Definition: data.hpp:226
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef Eigen::Matrix< double, 6, Eigen::Dynamic > Matrix6x
The 6d jacobian type (temporary)
Definition: data.hpp:45
container::aligned_vector< Inertia::Matrix6 > vxI
Right variation of the inertia matrix.
Definition: data.hpp:143
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:110
Matrix6x J
Jacobian of joint placements.
Definition: data.hpp:217
container::aligned_vector< Motion > oa
Vector of joint accelerations expressed at the origin.
Definition: data.hpp:61
Matrix6x dAg
Centroidal Momentum Matrix Time Variation.
Definition: data.hpp:178
Eigen::LLT< Eigen::MatrixXd > llt_JMinvJt
Cholesky decompostion of .
Definition: data.hpp:275
Eigen::VectorXd Dinv
Diagonal inverse of the joint space intertia matrix obtained by a Cholesky Decomposition.
Definition: data.hpp:204
container::aligned_vector< Inertia::Matrix6 > doYcrb
Time variation of the inertia quantities expressed in the world frame.
Definition: data.hpp:152
Matrix6x dVdq
Variation of the spatial velocity set with respect to the joint configuration.
Definition: data.hpp:223
Force hg
Centroidal momentum quantity.
Definition: data.hpp:183
double kinetic_energy
Kinetic energy of the model.
Definition: data.hpp:264
Eigen::MatrixXd ddq_dv
Partial derivative of the joint acceleration vector with respect to the joint velocity.
Definition: data.hpp:241
Eigen::VectorXd lambda_c
Lagrange Multipliers corresponding to the contact forces in se3::forwardDynamics. ...
Definition: data.hpp:278
Matrix6x dFdv
Variation of the forceset with respect to the joint velocity.
Definition: data.hpp:128
Eigen::VectorXd D
Diagonal of the joint space intertia matrix obtained by a Cholesky Decomposition. ...
Definition: data.hpp:201
container::aligned_vector< Eigen::Vector3d > acom
Vector of subtree center of mass linear accelerations expressed in the root joint of the subtree...
Definition: data.hpp:253
Eigen::VectorXd ddq
The joint accelerations computed from ABA.
Definition: data.hpp:161
Eigen::VectorXd torque_residual
Temporary corresponding to the residual torque .
Definition: data.hpp:284
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:78
container::aligned_vector< Inertia::Matrix6 > Ivx
Left variation of the inertia matrix.
Definition: data.hpp:146
std::vector< int > nvSubtree_fromRow
Subtree of the current row index (used in Cholesky Decomposition).
Definition: data.hpp:213
Eigen::VectorXd impulse_c
Lagrange Multipliers corresponding to the contact impulses in se3::impulseDynamics.
Definition: data.hpp:290
Eigen::MatrixXd JMinvJt
Inverse of the operational-space inertia matrix.
Definition: data.hpp:272
Inertia::Matrix6 Itmp
Temporary for derivative algorithms.
Definition: data.hpp:155
Matrix6x dAdv
Variation of the spatial acceleration set with respect to the joint velocity.
Definition: data.hpp:229
Matrix6x UDinv
Used in computeMinverse.
Definition: data.hpp:137
Matrix6x dFdq
Variation of the forceset with respect to the joint configuration.
Definition: data.hpp:125
Matrix6x SDinv
Used in computeMinverse.
Definition: data.hpp:134
container::aligned_vector< Inertia::Matrix6 > Yaba
Inertia matrix of the subtree expressed as dense matrix [ABA].
Definition: data.hpp:165
container::aligned_vector< Motion > ov
Vector of joint velocities expressed at the origin.
Definition: data.hpp:70
container::aligned_vector< Matrix6x > Fcrb
Spatial forces set, used in CRBA and CCRBA.
Definition: data.hpp:190
Eigen::VectorXd nle
Vector of Non Linear Effects (dim model.nv). It corresponds to concatenation of the Coriolis...
Definition: data.hpp:98
Matrix6x dJ
Derivative of the Jacobian with respect to the time.
Definition: data.hpp:220
Matrix6x IS
Used in computeMinverse.
Definition: data.hpp:140
container::aligned_vector< Motion > a_gf
Vector of joint accelerations due to the gravity field.
Definition: data.hpp:64
container::aligned_vector< Eigen::Vector3d > 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:247
JointDataVector joints
Vector of se3::JointData associated to the se3::JointModel stored in model, encapsulated in JointData...
Definition: data.hpp:55
Eigen::VectorXd dq_after
Generalized velocity after impact.
Definition: data.hpp:287
Eigen::MatrixXd M
The joint space inertia matrix (a square matrix of dim model.nv).
Definition: data.hpp:116
Eigen::MatrixXd U
Joint space intertia matrix square root (upper trianglular part) computed with a Cholesky Decompositi...
Definition: data.hpp:198
Eigen::MatrixXd ddq_dq
Partial derivative of the joint acceleration vector with respect to the joint configuration.
Definition: data.hpp:238
container::aligned_vector< SE3 > oMf
Vector of absolute operationnel frame placements (wrt the world).
Definition: data.hpp:106
container::aligned_vector< SE3 > liMi
Vector of relative joint placements (wrt the body parent).
Definition: data.hpp:90
container::aligned_vector< Inertia::Matrix6 > dYcrb
Vector of sub-tree composite rigid body inertia time derivatives . See Data::Ycrb for more details...
Definition: data.hpp:113
container::aligned_vector< SE3 > oMi
Vector of absolute joint placements (wrt the world).
Definition: data.hpp:87
Eigen::Matrix< double, 3, Eigen::Dynamic > Matrix3x
The 3d jacobian type (temporary)
Definition: data.hpp:47
Eigen::MatrixXd sDUiJt
Temporary corresponding to .
Definition: data.hpp:281
RowMatrixXd Minv
The inverse of the joint space inertia matrix (a square matrix of dim model.nv).
Definition: data.hpp:119
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:74
RowMatrix6 M6tmpR
Temporary for derivative algorithms.
Definition: data.hpp:158
std::vector< int > parents_fromRow
First previous non-zero row in M (used in Cholesky Decomposition).
Definition: data.hpp:210
Eigen::MatrixXd dtau_dq
Partial derivative of the joint torque vector with respect to the joint configuration.
Definition: data.hpp:232
Eigen::VectorXd tmp
Temporary of size NV used in Cholesky Decomposition.
Definition: data.hpp:207
container::aligned_vector< Motion > v
Vector of joint velocities expressed at the centers of the joints.
Definition: data.hpp:67
container::aligned_vector< Force > h
Vector of spatial momenta expressed in the local frame of the joint.
Definition: data.hpp:81
std::vector< double > mass
Vector of subtree mass. In other words, mass[j] is the mass of the subtree supported by joint ...
Definition: data.hpp:256
Matrix6x dFda
Variation of the forceset with respect to the joint acceleration.
Definition: data.hpp:131
Eigen::MatrixXd C
The Coriolis matrix (a square matrix of dim model.nv).
Definition: data.hpp:122
std::vector< int > lastChild
Index of the last child (for CRBA)
Definition: data.hpp:193