pinocchio  UNKNOWN
center-of-mass.hpp
1 //
2 // Copyright (c) 2015-2016 CNRS
3 //
4 // This file is part of Pinocchio
5 // Pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // Pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // Pinocchio If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef __se3_center_of_mass_hpp__
19 #define __se3_center_of_mass_hpp__
20 
21 #include "pinocchio/multibody/visitor.hpp"
22 #include "pinocchio/multibody/model.hpp"
23 #include "pinocchio/multibody/data.hpp"
24 #include "pinocchio/algorithm/kinematics.hpp"
25 
26 namespace se3
27 {
28 
40  inline const SE3::Vector3 &
41  centerOfMass(const Model & model, Data & data,
42  const Eigen::VectorXd & q,
43  const bool computeSubtreeComs = true);
44 
58  inline const SE3::Vector3 &
59  centerOfMass(const Model & model, Data & data,
60  const Eigen::VectorXd & q,
61  const Eigen::VectorXd & v,
62  const bool computeSubtreeComs = true);
63 
78  inline const SE3::Vector3 &
79  centerOfMass(const Model & model, Data & data,
80  const Eigen::VectorXd & q,
81  const Eigen::VectorXd & v,
82  const Eigen::VectorXd & a,
83  const bool computeSubtreeComs = true);
84 
98  template<bool do_position, bool do_velocity, bool do_acceleration>
99  inline void centerOfMass(const Model & model, Data & data,
100  const bool computeSubtreeComs = true);
101 
111  inline void centerOfMass(const Model & model, Data & data,
112  const bool computeSubtreeComs)
113  { centerOfMass<true,true,true>(model,data,computeSubtreeComs); }
114 
128  inline const Data::Matrix3x &
129  jacobianCenterOfMass(const Model & model, Data & data,
130  const Eigen::VectorXd & q,
131  const bool computeSubtreeComs = true,
132  const bool updateKinematics = true);
133 
134  /* If the CRBA has been run, then both COM and Jcom are easily available from
135  * the mass matrix. Use the following methods to access them. In that case,
136  * the COM subtrees (also easily available from CRBA data) are not
137  * explicitely set. Use data.Ycrb[i].lever() to get them. */
146  inline const SE3::Vector3 &
147  getComFromCrba(const Model & model, Data & data);
148 
160  inline const Data::Matrix3x &
161  getJacobianComFromCrba(const Model & model, Data & data);
162 
163 } // namespace se3
164 
165 /* --- Details -------------------------------------------------------------------- */
166 /* --- Details -------------------------------------------------------------------- */
167 /* --- Details -------------------------------------------------------------------- */
168 #include "pinocchio/algorithm/center-of-mass.hxx"
169 
170 #endif // ifndef __se3_center_of_mass_hpp__
const SE3::Vector3 & getComFromCrba(const Model &model, Data &data)
Extracts the center of mass position from the joint space inertia matrix (also called the mass matrix...
const Data::Matrix3x & getJacobianComFromCrba(const Model &model, Data &data)
Extracts both the jacobian of the center of mass (CoM), the total mass of the system and the CoM posi...
const Data::Matrix3x & jacobianCenterOfMass(const Model &model, Data &data, const Eigen::VectorXd &q, const bool computeSubtreeComs=true, const bool updateKinematics=true)
Computes both the jacobian and the the center of mass position of a given model according to a partic...
const SE3::Vector3 & centerOfMass(const Model &model, Data &data, const Eigen::VectorXd &q, const bool computeSubtreeComs=true)
Computes the center of mass position of a given model according to a particular joint configuration...
Eigen::Matrix< double, 3, Eigen::Dynamic > Matrix3x
The 3d jacobian type (temporary)
Definition: data.hpp:47