expose-rnea-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2021 CNRS INRIA
3 //
4 
9 
10 namespace pinocchio
11 {
12  namespace python
13  {
14 
15  namespace bp = boost::python;
16  typedef PINOCCHIO_ALIGNED_STD_VECTOR(context::Force) ForceAlignedVector;
17 
20  {
22  res.setZero();
24  return res;
25  }
26 
28  const context::Model & model,
30  const context::VectorXs & q,
31  const ForceAlignedVector & fext)
32  {
34  res.setZero();
36  return res;
37  }
38 
40  const context::Model & model,
42  const context::VectorXs & q,
43  const context::VectorXs & v,
44  const context::VectorXs & a)
45  {
48  return bp::make_tuple(make_ref(data.dtau_dq), make_ref(data.dtau_dv), make_ref(data.M));
49  }
50 
52  const context::Model & model,
54  const context::VectorXs & q,
55  const context::VectorXs & v,
56  const context::VectorXs & a,
57  const ForceAlignedVector & fext)
58  {
61  return bp::make_tuple(make_ref(data.dtau_dq), make_ref(data.dtau_dv), make_ref(data.M));
62  }
63 
65  {
66  bp::def(
67  "computeGeneralizedGravityDerivatives", computeGeneralizedGravityDerivatives,
68  bp::args("model", "data", "q"),
69  "Computes the partial derivative of the generalized gravity contribution\n"
70  "with respect to the joint configuration.\n\n"
71  "Parameters:\n"
72  "\tmodel: model of the kinematic tree\n"
73  "\tdata: data related to the model\n"
74  "\tq: the joint configuration vector (size model.nq)\n"
75  "Returns: dtau_statique_dq\n",
77 
78  bp::def(
79  "computeStaticTorqueDerivatives", computeStaticTorqueDerivatives,
80  bp::args("model", "data", "q", "fext"),
81  "Computes the partial derivative of the generalized gravity and external forces "
82  "contributions (a.k.a static torque vector)\n"
83  "with respect to the joint configuration.\n\n"
84  "Parameters:\n"
85  "\tmodel: model of the kinematic tree\n"
86  "\tdata: data related to the model\n"
87  "\tq: the joint configuration vector (size model.nq)\n"
88  "\tfext: list of external forces expressed in the local frame of the joints (size "
89  "model.njoints)\n"
90  "Returns: dtau_statique_dq\n",
92 
93  bp::def(
94  "computeRNEADerivatives", computeRNEADerivatives, bp::args("model", "data", "q", "v", "a"),
95  "Computes the RNEA partial derivatives, store the result in data.dtau_dq, "
96  "data.dtau_dv and data.M (aka dtau_da)\n"
97  "which correspond to the partial derivatives of the torque output with respect to "
98  "the joint configuration,\n"
99  "velocity and acceleration vectors.\n\n"
100  "Parameters:\n"
101  "\tmodel: model of the kinematic tree\n"
102  "\tdata: data related to the model\n"
103  "\tq: the joint configuration vector (size model.nq)\n"
104  "\tv: the joint velocity vector (size model.nv)\n"
105  "\ta: the joint acceleration vector (size model.nv)\n\n"
106  "Returns: (dtau_dq, dtau_dv, dtau_da)\n",
108 
109  bp::def(
110  "computeRNEADerivatives", computeRNEADerivatives_fext,
111  bp::args("model", "data", "q", "v", "a", "fext"),
112  "Computes the RNEA partial derivatives with external contact foces,\n"
113  "store the result in data.dtau_dq, data.dtau_dv and data.M (aka dtau_da)\n"
114  "which correspond to the partial derivatives of the torque output with respect to "
115  "the joint configuration,\n"
116  "velocity and acceleration vectors.\n\n"
117  "Parameters:\n"
118  "\tmodel: model of the kinematic tree\n"
119  "\tdata: data related to the model\n"
120  "\tq: the joint configuration vector (size model.nq)\n"
121  "\tv: the joint velocity vector (size model.nv)\n"
122  "\ta: the joint acceleration vector (size model.nv)\n"
123  "\tfext: list of external forces expressed in the local frame of the joints (size "
124  "model.njoints)\n\n"
125  "Returns: (dtau_dq, dtau_dv, dtau_da)\n",
127  }
128 
129  } // namespace python
130 } // namespace pinocchio
pinocchio::DataTpl::MatrixXs
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
Definition: multibody/data.hpp:74
boost::python
pinocchio::computeRNEADerivatives
void computeRNEADerivatives(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, const Eigen::MatrixBase< MatrixType1 > &rnea_partial_dq, const Eigen::MatrixBase< MatrixType2 > &rnea_partial_dv, const Eigen::MatrixBase< MatrixType3 > &rnea_partial_da)
Computes the partial derivatives of the Recursive Newton Euler Algorithms with respect to the joint c...
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::python::exposeRNEADerivatives
void exposeRNEADerivatives()
Definition: expose-rnea-derivatives.cpp:64
rnea-derivatives.hpp
setup.data
data
Definition: cmake/cython/setup.in.py:48
pinocchio::python::context::Force
ForceTpl< Scalar, Options > Force
Definition: bindings/python/context/generic.hpp:55
pinocchio::python::computeRNEADerivatives
bp::tuple computeRNEADerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &a)
Definition: expose-rnea-derivatives.cpp:39
pinocchio::computeStaticTorqueDerivatives
void computeStaticTorqueDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const container::aligned_vector< ForceTpl< Scalar, Options >> &fext, const Eigen::MatrixBase< ReturnMatrixType > &static_torque_partial_dq)
Computes the partial derivative of the generalized gravity and external forces contributions (a....
pinocchio::python::PINOCCHIO_ALIGNED_STD_VECTOR
typedef PINOCCHIO_ALIGNED_STD_VECTOR(context::Force) ForceAlignedVector
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
pinocchio::python::computeRNEADerivatives_fext
bp::tuple computeRNEADerivatives_fext(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &a, const ForceAlignedVector &fext)
Definition: expose-rnea-derivatives.cpp:51
pinocchio::python::make_symmetric
void make_symmetric(const Eigen::MatrixBase< Matrix > &mat, const int mode=Eigen::Upper)
Definition: bindings/python/utils/eigen.hpp:24
pinocchio::computeGeneralizedGravityDerivatives
void computeGeneralizedGravityDerivatives(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, DataTpl< Scalar, Options, JointCollectionTpl > &data, const Eigen::MatrixBase< ConfigVectorType > &q, const Eigen::MatrixBase< ReturnMatrixType > &gravity_partial_dq)
Computes the partial derivative of the generalized gravity contribution with respect to the joint con...
algorithms.hpp
python
pinocchio::python::v
const Vector3Like & v
Definition: bindings/python/spatial/explog.hpp:66
pinocchio::python::computeGeneralizedGravityDerivatives
context::Data::MatrixXs computeGeneralizedGravityDerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q)
Definition: expose-rnea-derivatives.cpp:18
pinocchio::q
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Definition: joint-configuration.hpp:1083
a
Vec3f a
pinocchio::python::computeStaticTorqueDerivatives
context::Data::MatrixXs computeStaticTorqueDerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q, const ForceAlignedVector &fext)
Definition: expose-rnea-derivatives.cpp:27
pinocchio::python::mimic_not_supported_function
Definition: model-checker.hpp:22
model-checker.hpp
pinocchio::python::make_ref
Eigen::Ref< Matrix > make_ref(const Eigen::PlainObjectBase< Matrix > &mat)
Definition: bindings/python/utils/eigen.hpp:17
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::python::res
ReturnType res
Definition: bindings/python/spatial/explog.hpp:68
eigen.hpp
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