7 #include "pinocchio/algorithm/center-of-mass.hpp" 9 #include <boost/python/overloads.hpp> 24 bool computeSubtreeComs = true)
34 bool computeSubtreeComs =
true)
45 bool computeSubtreeComs =
true)
47 return centerOfMass(model,data,q,v,a,computeSubtreeComs);
54 bool computeSubtreeComs =
true)
56 return centerOfMass(model,data,kinematic_level,computeSubtreeComs);
63 bool computeSubtreeComs =
true)
65 centerOfMass(model,data,static_cast<KinematicLevel>(kinematic_level),computeSubtreeComs);
71 bool computeSubtreeComs =
true)
123 using namespace Eigen;
125 bp::def(
"computeTotalMass",
126 (
double (*)(
const Model &))&computeTotalMass<double,0,JointCollectionDefaultTpl>,
128 "Compute the total mass of the model and return it.");
130 bp::def(
"computeTotalMass",
131 (
double (*)(
const Model &,
Data &))&computeTotalMass<double,0,JointCollectionDefaultTpl>,
133 "Compute the total mass of the model, put it in data.mass[0] and return it.");
135 bp::def(
"computeSubtreeMasses",
136 (
void (*)(
const Model &,
Data &))&computeSubtreeMasses<double,0,JointCollectionDefaultTpl>,
138 "Compute the mass of each kinematic subtree and store it in the vector data.mass.");
140 bp::def(
"centerOfMass",
142 com_0_overload(
bp::args(
"model",
"data",
144 "compute_subtree_coms"),
145 "Compute the center of mass, putting the result in Data and return it." 146 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees." 147 )[bp::return_value_policy<bp::return_by_value>()]
150 bp::def(
"centerOfMass",
155 "compute_subtree_coms"),
156 "Computes the center of mass position and velocity by storing the result in Data. It returns the center of mass position expressed in the WORLD frame.\n" 157 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees." 158 )[bp::return_value_policy<bp::return_by_value>()]
161 bp::def(
"centerOfMass",
166 "compute_subtree_coms"),
167 "Computes the center of mass position, velocity and acceleration by storing the result in Data. It returns the center of mass position expressed in the WORLD frame.\n" 168 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees." 169 )[bp::return_value_policy<bp::return_by_value>()]
172 bp::def(
"centerOfMass",
174 com_level_overload_deprecated_signature(
177 "computeSubtreeComs If true, the algorithm computes also the center of mass of the subtrees" 179 "Computes the center of mass position, velocity and acceleration of a given model according to the current kinematic values contained in data and the requested kinematic_level.\n" 180 "If kinematic_level = 0, computes the CoM position, if kinematic_level = 1, also computes the CoM velocity and if kinematic_level = 2, it also computes the CoM acceleration." 184 bp::def(
"centerOfMass",
186 com_level_overload(
bp::args(
"model",
"data",
188 "compute_subtree_coms"),
189 "Computes the center of mass position, velocity or acceleration of a given model according to the current kinematic values contained in data and the requested kinematic_level.\n" 190 "If kinematic_level = POSITION, computes the CoM position, if kinematic_level = VELOCITY, also computes the CoM velocity and if kinematic_level = ACCELERATION, it also computes the CoM acceleration.\n" 191 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees." 192 )[bp::return_value_policy<bp::return_by_value>()]
195 bp::def(
"centerOfMass",
197 com_default_overload(
200 "compute_subtree_coms"),
201 "Computes the center of mass position, velocity and acceleration of a given model according to the current kinematic values contained in data.\n" 202 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees." 203 )[bp::return_value_policy<bp::return_by_value>()]
206 bp::def(
"jacobianCenterOfMass",
207 (
const Data::Matrix3x & (*)(
const Model &,
Data &,
const Eigen::MatrixBase<Eigen::VectorXd> &,
bool))&jacobianCenterOfMass<double,0,JointCollectionDefaultTpl,VectorXd>,
208 jacobianCenterOfMassUpdate_overload(
bp::args(
"model",
211 "compute_subtree_coms"),
212 "Computes the Jacobian of the center of mass, puts the result in Data and return it.\n" 213 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees.")[
214 bp::return_value_policy<bp::return_by_value>()]);
216 bp::def(
"jacobianCenterOfMass",
217 (
const Data::Matrix3x & (*)(
const Model &,
Data &,
bool))&jacobianCenterOfMass<double,0,JointCollectionDefaultTpl>,
218 jacobianCenterOfMassNoUpdate_overload(
bp::args(
"model",
220 "compute_subtree_coms"),
221 "Computes the Jacobian of the center of mass, puts the result in Data and return it.\n" 222 "If compute_subtree_coms is True, the algorithm also computes the center of mass of the subtrees.")[
223 bp::return_value_policy<bp::return_by_value>()]);
229 "subtree_root_joint_id"),
230 "Computes the Jacobian of the CoM of the given subtree (subtree_root_joint_id) expressed in the WORLD frame, according to the given joint configuration.");
232 bp::args(
"Model, the model of the kinematic tree",
233 "Data, the data associated to the model where the results are stored",
234 "Joint configuration q (size Model::nq)",
235 "Subtree root ID, the index of the subtree root joint."),
236 "Computes the Jacobian of the CoM of the given subtree expressed in the world frame, according to the given joint configuration.",
237 deprecated_function<>(
"This function is now deprecated. It has been renamed jacobianSubtreeCenterOfMass."));
242 "subtree_root_joint_id"),
243 "Computes the Jacobian of the CoM of the given subtree (subtree_root_joint_id) expressed in the WORLD frame, according to the given entries in data.");
246 bp::args(
"Model, the model of the kinematic tree",
247 "Data, the data associated to the model where the results are stored",
248 "Subtree root ID, the index of the subtree root joint."),
249 "Computes the Jacobian of the CoM of the given subtree expressed in the world frame, according to the given entries in data.",
250 deprecated_function<>(
"This function is now deprecated. It has been renamed jacobianSubtreeCenterOfMass."));
255 "subtree_root_joint_id"),
256 "Get the Jacobian of the CoM of the given subtree expressed in the world frame, according to the given entries in data. It assumes that jacobianCenterOfMass has been called first.");
const DataTpl< Scalar, Options, JointCollectionTpl >::Matrix3x & jacobianCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes both the jacobian and the the center of mass position of a given model according to a partic...
static SE3::Vector3 com_0_proxy(const Model &model, Data &data, const Eigen::VectorXd &q, bool computeSubtreeComs=true)
BOOST_PYTHON_FUNCTION_OVERLOADS(computeKKTContactDynamicMatrixInverse_overload, computeKKTContactDynamicMatrixInverse_proxy, 4, 5) static const Eigen
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
static void com_level_proxy_deprecated_signature(const Model &model, Data &data, int kinematic_level, bool computeSubtreeComs=true)
static const Data::Vector3 & com_default_proxy(const Model &model, Data &data, bool computeSubtreeComs=true)
static Data::Matrix3x jacobian_subtree_com_kinematics_proxy(const Model &model, Data &data, const Eigen::VectorXd &q, Model::JointIndex jointId)
static const Data::Vector3 & com_level_proxy(const Model &model, Data &data, KinematicLevel kinematic_level, bool computeSubtreeComs=true)
static SE3::Vector3 com_1_proxy(const Model &model, Data &data, const Eigen::VectorXd &q, const Eigen::VectorXd &v, bool computeSubtreeComs=true)
pinocchio::JointIndex JointIndex
KinematicLevel
List of Kinematics Level supported by Pinocchio.
traits< SE3Tpl >::Vector3 Vector3
void getJacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Retrieves the Jacobian of the center of mass of the given subtree according to the current value stor...
Main pinocchio namespace.
int nv
Dimension of the velocity vector space.
Eigen::Matrix< Scalar, 3, Eigen::Dynamic, Options > Matrix3x
The 3d jacobian type (temporary)
static Data::Matrix3x jacobian_subtree_com_proxy(const Model &model, Data &data, Model::JointIndex jointId)
const DataTpl< Scalar, Options, JointCollectionTpl >::Vector3 & centerOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const bool computeSubtreeComs=true)
Computes the center of mass position of a given model according to a particular joint configuration...
void jacobianSubtreeCenterOfMass(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const JointIndex &rootSubtreeId, const Eigen::MatrixBase< Matrix3xLike > &res)
Computes the Jacobian of the center of mass of the given subtree according to a particular joint conf...
static SE3::Vector3 com_2_proxy(const Model &model, Data &data, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Eigen::VectorXd &a, bool computeSubtreeComs=true)
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
JointCollectionTpl & model
Eigen::Matrix< Scalar, 3, 1, Options > Vector3
static Data::Matrix3x get_jacobian_subtree_com_proxy(const Model &model, Data &data, Model::JointIndex jointId)