expose-kinematics-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2021 CNRS INRIA
3 //
7 
9 
10 #include <boost/python/tuple.hpp>
11 
12 namespace pinocchio
13 {
14  namespace python
15  {
16  namespace bp = boost::python;
17 
19  const context::Model & model,
21  const JointIndex jointId,
22  ReferenceFrame rf)
23  {
25 
26  Matrix6x partial_dq(Matrix6x::Zero(6, model.nv));
27  Matrix6x partial_dv(Matrix6x::Zero(6, model.nv));
28 
29  getJointVelocityDerivatives(model, data, jointId, rf, partial_dq, partial_dv);
30 
31  return bp::make_tuple(partial_dq, partial_dv);
32  }
33 
35  const context::Model & model,
37  const JointIndex joint_id,
38  const context::SE3 & placement,
39  ReferenceFrame rf)
40  {
41  typedef context::Data::Matrix3x Matrix3x;
42 
43  Matrix3x v_partial_dq(Matrix3x::Zero(3, model.nv));
44  Matrix3x v_partial_dv(Matrix3x::Zero(3, model.nv));
45 
46  getPointVelocityDerivatives(model, data, joint_id, placement, rf, v_partial_dq, v_partial_dv);
47 
48  return bp::make_tuple(v_partial_dq, v_partial_dv);
49  }
50 
52  const context::Model & model,
54  const JointIndex jointId,
55  ReferenceFrame rf)
56  {
58 
59  Matrix6x v_partial_dq(Matrix6x::Zero(6, model.nv));
60  Matrix6x a_partial_dq(Matrix6x::Zero(6, model.nv));
61  Matrix6x a_partial_dv(Matrix6x::Zero(6, model.nv));
62  Matrix6x a_partial_da(Matrix6x::Zero(6, model.nv));
63 
65  model, data, jointId, rf, v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
66 
67  return bp::make_tuple(v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
68  }
69 
71  const context::Model & model,
73  const JointIndex joint_id,
74  const context::SE3 & placement,
75  ReferenceFrame rf)
76  {
77  typedef context::Data::Matrix3x Matrix3x;
78 
79  Matrix3x v_partial_dq(Matrix3x::Zero(3, model.nv));
80  Matrix3x a_partial_dq(Matrix3x::Zero(3, model.nv));
81  Matrix3x a_partial_dv(Matrix3x::Zero(3, model.nv));
82  Matrix3x a_partial_da(Matrix3x::Zero(3, model.nv));
83 
85  model, data, joint_id, placement, rf, v_partial_dq, a_partial_dq, a_partial_dv,
86  a_partial_da);
87 
88  return bp::make_tuple(v_partial_dq, a_partial_dq, a_partial_dv, a_partial_da);
89  }
90 
93  {
94  typedef context::Data::Matrix3x Matrix3x;
95  Matrix3x partial_dq(Matrix3x::Zero(3, model.nv));
97  return partial_dq;
98  }
99 
101  {
102  typedef context::Scalar Scalar;
103  typedef context::VectorXs VectorXs;
104  enum
105  {
107  };
108 
109  bp::def(
110  "computeForwardKinematicsDerivatives",
113  bp::args("model", "data", "q", "v", "a"),
114  "Computes all the terms required to compute the derivatives of the placement, "
115  "spatial velocity and acceleration\n"
116  "for any joint of the model.\n"
117  "The results are stored in data.\n\n"
118  "Parameters:\n"
119  "\tmodel: model of the kinematic tree\n"
120  "\tdata: data related to the model\n"
121  "\tq: the joint configuration vector (size model.nq)\n"
122  "\tv: the joint velocity vector (size model.nv)\n"
123  "\ta: the joint acceleration vector (size model.nv)\n",
125 
126  bp::def(
127  "getJointVelocityDerivatives", getJointVelocityDerivatives_proxy,
128  bp::args("model", "data", "joint_id", "reference_frame"),
129  "Computes the partial derivatives of the spatial velocity of a given joint with respect "
130  "to\n"
131  "the joint configuration and velocity and returns them as a tuple.\n"
132  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
133  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
134  "reference_frame.\n"
135  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
136  "Parameters:\n"
137  "\tmodel: model of the kinematic tree\n"
138  "\tdata: data related to the model\n"
139  "\tjoint_id: index of the joint\n"
140  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
142 
143  bp::def(
144  "getPointVelocityDerivatives", getPointVelocityDerivatives_proxy,
145  bp::args("model", "data", "joint_id", "placement", "reference_frame"),
146  "Computes the partial derivatives of the velocity of a point given by its placement "
147  "information w.r.t. the joint frame and returns them as a tuple.\n"
148  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
149  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
150  "reference_frame.\n"
151  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
152  "Parameters:\n"
153  "\tmodel: model of the kinematic tree\n"
154  "\tdata: data related to the model\n"
155  "\tjoint_id: index of the joint\n"
156  "\tplacement: relative placement of the point w.r.t. the joint frame\n"
157  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
159 
160  bp::def(
161  "getPointClassicAccelerationDerivatives", getPointClassicAccelerationDerivatives_proxy,
162  bp::args("model", "data", "joint_id", "placement", "reference_frame"),
163  "Computes the partial derivatives of the classic acceleration of a point given by its "
164  "placement information w.r.t. the joint frame and returns them as a tuple.\n"
165  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
166  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
167  "reference_frame.\n"
168  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
169  "Parameters:\n"
170  "\tmodel: model of the kinematic tree\n"
171  "\tdata: data related to the model\n"
172  "\tjoint_id: index of the joint\n"
173  "\tplacement: relative placement of the point w.r.t. the joint frame\n"
174  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
176 
177  bp::def(
178  "getJointAccelerationDerivatives", getJointAccelerationDerivatives_proxy,
179  bp::args("model", "data", "joint_id", "reference_frame"),
180  "Computes the partial derivatives of the spatial acceleration of a given joint with "
181  "respect to\n"
182  "the joint configuration, velocity and acceleration and returns them as a tuple.\n"
183  "The partial derivatives can be either expressed in the LOCAL frame of the joint, in the "
184  "LOCAL_WORLD_ALIGNED frame or in the WORLD coordinate frame depending on the value of "
185  "reference_frame.\n"
186  "You must first call computeForwardKinematicsDerivatives before calling this function.\n\n"
187  "Parameters:\n"
188  "\tmodel: model of the kinematic tree\n"
189  "\tdata: data related to the model\n"
190  "\tjoint_id: index of the joint\n"
191  "\treference_frame: reference frame in which the resulting derivatives are expressed\n",
193 
194  bp::def(
195  "getCenterOfMassVelocityDerivatives", getCoMVelocityDerivatives_proxy,
196  bp::args("model", "data"),
197  "Computes the partial derivaties of the center of mass velocity with respect to\n"
198  "the joint configuration.\n"
199  "You must first call computeAllTerms(model,data,q,v) or centerOfMass(model,data,q,v) "
200  "before calling this function.\n\n"
201  "Parameters:\n"
202  "\tmodel: model of the kinematic tree\n"
203  "\tdata: data related to the model\n",
205  }
206 
207  } // namespace python
208 } // namespace pinocchio
boost::python
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::ReferenceFrame
ReferenceFrame
Various conventions to express the velocity of a moving frame.
Definition: multibody/fwd.hpp:46
pinocchio::SE3Tpl< Scalar, Options >
pinocchio::getPointClassicAccelerationDerivatives
void getPointClassicAccelerationDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex joint_id, const SE3Tpl< Scalar, Options > &placement, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix3xOut1 > &v_point_partial_dq, const Eigen::MatrixBase< Matrix3xOut2 > &a_point_partial_dq, const Eigen::MatrixBase< Matrix3xOut3 > &a_point_partial_dv, const Eigen::MatrixBase< Matrix3xOut4 > &a_point_partial_da)
Computes the partial derivatives of the classic acceleration of a point given by its placement inform...
pinocchio::python::Options
@ Options
Definition: expose-contact-inverse-dynamics.cpp:24
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::Scalar
context::Scalar Scalar
Definition: admm-solver.cpp:29
pinocchio::python::getCoMVelocityDerivatives_proxy
context::Data::Matrix3x getCoMVelocityDerivatives_proxy(const context::Model &model, context::Data &data)
Definition: expose-kinematics-derivatives.cpp:92
pinocchio::python::getPointClassicAccelerationDerivatives_proxy
bp::tuple getPointClassicAccelerationDerivatives_proxy(const context::Model &model, context::Data &data, const JointIndex joint_id, const context::SE3 &placement, ReferenceFrame rf)
Definition: expose-kinematics-derivatives.cpp:70
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
pinocchio::getJointAccelerationDerivatives
void getJointAccelerationDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &a_partial_dq, const Eigen::MatrixBase< Matrix6xOut3 > &a_partial_dv, const Eigen::MatrixBase< Matrix6xOut4 > &a_partial_da)
Computes the partial derivaties of the spatial acceleration of a given with respect to the joint conf...
pinocchio::python::context::Options
@ Options
Definition: bindings/python/context/generic.hpp:40
pinocchio::computeForwardKinematicsDerivatives
void computeForwardKinematicsDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< TangentVectorType1 > &v, const Eigen::MatrixBase< TangentVectorType2 > &a)
Computes all the terms required to compute the derivatives of the placement, spatial velocity and acc...
pinocchio::placement
const MotionDense< Motion2 > const SE3Tpl< SE3Scalar, SE3Options > & placement
Definition: spatial/classic-acceleration.hpp:122
pinocchio::DataTpl::Matrix3x
Eigen::Matrix< Scalar, 3, Eigen::Dynamic, Options > Matrix3x
The 3d jacobian type (temporary)
Definition: multibody/data.hpp:94
algorithms.hpp
pinocchio::getJointVelocityDerivatives
void getJointVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex jointId, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix6xOut1 > &v_partial_dq, const Eigen::MatrixBase< Matrix6xOut2 > &v_partial_dv)
Computes the partial derivaties of the spatial velocity of a given with respect to the joint configur...
pinocchio::python::getPointVelocityDerivatives_proxy
bp::tuple getPointVelocityDerivatives_proxy(const context::Model &model, context::Data &data, const JointIndex joint_id, const context::SE3 &placement, ReferenceFrame rf)
Definition: expose-kinematics-derivatives.cpp:34
python
pinocchio::getCenterOfMassVelocityDerivatives
void getCenterOfMassVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< Matrix3xOut > &vcom_partial_dq)
Computes the partial derivatie of the center-of-mass velocity with respect to the joint configuration...
pinocchio::python::getJointVelocityDerivatives_proxy
bp::tuple getJointVelocityDerivatives_proxy(const context::Model &model, context::Data &data, const JointIndex jointId, ReferenceFrame rf)
Definition: expose-kinematics-derivatives.cpp:18
center-of-mass-derivatives.hpp
Matrix6x
Eigen::Matrix< double, 6, Eigen::Dynamic > Matrix6x
Definition: joint-mimic.cpp:15
pinocchio::python::mimic_not_supported_function
Definition: model-checker.hpp:22
kinematics-derivatives.hpp
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::DataTpl::Matrix6x
Eigen::Matrix< Scalar, 6, Eigen::Dynamic, Options > Matrix6x
The 6d jacobian type (temporary)
Definition: multibody/data.hpp:92
pinocchio::getPointVelocityDerivatives
void getPointVelocityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &data, const Model::JointIndex joint_id, const SE3Tpl< Scalar, Options > &placement, const ReferenceFrame rf, const Eigen::MatrixBase< Matrix3xOut1 > &v_point_partial_dq, const Eigen::MatrixBase< Matrix3xOut2 > &v_point_partial_dv)
Computes the partial derivatives of the velocity of a point given by its placement information w....
pinocchio::JointCollectionDefaultTpl
Definition: context/generic.hpp:15
append-urdf-model-with-another-model.joint_id
joint_id
Definition: append-urdf-model-with-another-model.py:34
model-checker.hpp
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::python::exposeKinematicsDerivatives
void exposeKinematicsDerivatives()
Definition: expose-kinematics-derivatives.cpp:100
pinocchio::python::getJointAccelerationDerivatives_proxy
bp::tuple getJointAccelerationDerivatives_proxy(const context::Model &model, context::Data &data, const JointIndex jointId, ReferenceFrame rf)
Definition: expose-kinematics-derivatives.cpp:51
pinocchio::python::context::Scalar
PINOCCHIO_PYTHON_SCALAR_TYPE Scalar
Definition: bindings/python/context/generic.hpp:37
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33


pinocchio
Author(s):
autogenerated on Wed Apr 16 2025 02:41:46