expose-rnea-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2021 CNRS INRIA
3 //
4 
6 #include "pinocchio/algorithm/rnea-derivatives.hpp"
8 
9 namespace pinocchio
10 {
11  namespace python
12  {
13 
14  namespace bp = boost::python;
15  typedef PINOCCHIO_ALIGNED_STD_VECTOR(Force) ForceAlignedVector;
16 
18  const Eigen::VectorXd & q)
19  {
20  Data::MatrixXs res(model.nv,model.nv);
21  res.setZero();
23  return res;
24  }
25 
27  const Eigen::VectorXd & q,
28  const ForceAlignedVector & fext)
29  {
30  Data::MatrixXs res(model.nv,model.nv);
31  res.setZero();
32  pinocchio::computeStaticTorqueDerivatives(model,data,q,fext,res);
33  return res;
34  }
35 
36  bp::tuple computeRNEADerivatives(const Model & model, Data & data,
37  const Eigen::VectorXd & q,
38  const Eigen::VectorXd & v,
39  const Eigen::VectorXd & a)
40  {
41  pinocchio::computeRNEADerivatives(model,data,q,v,a);
42  make_symmetric(data.M);
43  return bp::make_tuple(make_ref(data.dtau_dq),
44  make_ref(data.dtau_dv),
45  make_ref(data.M));
46  }
47 
48  bp::tuple computeRNEADerivatives_fext(const Model & model, Data & data,
49  const Eigen::VectorXd & q,
50  const Eigen::VectorXd & v,
51  const Eigen::VectorXd & a,
52  const ForceAlignedVector & fext)
53  {
54  pinocchio::computeRNEADerivatives(model,data,q,v,a,fext);
55  make_symmetric(data.M);
56  return bp::make_tuple(make_ref(data.dtau_dq),
57  make_ref(data.dtau_dv),
58  make_ref(data.M));
59  }
60 
62  {
63  using namespace Eigen;
64 
65  bp::def("computeGeneralizedGravityDerivatives",
67  bp::args("model","data","q"),
68  "Computes the partial derivative of the generalized gravity contribution\n"
69  "with respect to the joint configuration.\n\n"
70  "Parameters:\n"
71  "\tmodel: model of the kinematic tree\n"
72  "\tdata: data related to the model\n"
73  "\tq: the joint configuration vector (size model.nq)\n"
74  "Returns: dtau_statique_dq\n");
75 
76  bp::def("computeStaticTorqueDerivatives",
78  bp::args("model","data","q","fext"),
79  "Computes the partial derivative of the generalized gravity and external forces contributions (a.k.a static torque vector)\n"
80  "with respect to the joint configuration.\n\n"
81  "Parameters:\n"
82  "\tmodel: model of the kinematic tree\n"
83  "\tdata: data related to the model\n"
84  "\tq: the joint configuration vector (size model.nq)\n"
85  "\tfext: list of external forces expressed in the local frame of the joints (size model.njoints)\n"
86  "Returns: dtau_statique_dq\n");
87 
88  bp::def("computeRNEADerivatives",
90  bp::args("model","data","q","v","a"),
91  "Computes the RNEA partial derivatives, store the result in data.dtau_dq, data.dtau_dv and data.M (aka dtau_da)\n"
92  "which correspond to the partial derivatives of the torque output with respect to the joint configuration,\n"
93  "velocity and acceleration vectors.\n\n"
94  "Parameters:\n"
95  "\tmodel: model of the kinematic tree\n"
96  "\tdata: data related to the model\n"
97  "\tq: the joint configuration vector (size model.nq)\n"
98  "\tv: the joint velocity vector (size model.nv)\n"
99  "\ta: the joint acceleration vector (size model.nv)\n\n"
100  "Returns: (dtau_dq, dtau_dv, dtau_da)\n");
101 
102  bp::def("computeRNEADerivatives",
104  bp::args("model","data","q","v","a","fext"),
105  "Computes the RNEA partial derivatives with external contact foces,\n"
106  "store the result in data.dtau_dq, data.dtau_dv and data.M (aka dtau_da)\n"
107  "which correspond to the partial derivatives of the torque output with respect to the joint configuration,\n"
108  "velocity and acceleration vectors.\n\n"
109  "Parameters:\n"
110  "\tmodel: model of the kinematic tree\n"
111  "\tdata: data related to the model\n"
112  "\tq: the joint configuration vector (size model.nq)\n"
113  "\tv: the joint velocity vector (size model.nv)\n"
114  "\ta: the joint acceleration vector (size model.nv)\n"
115  "\tfext: list of external forces expressed in the local frame of the joints (size model.njoints)\n\n"
116  "Returns: (dtau_dq, dtau_dv, dtau_da)\n");
117  }
118 
119 
120 
121  } // namespace python
122 } // namespace pinocchio
ForceTpl< double, 0 > Force
MatrixXs dtau_dv
Partial derivative of the joint torque vector with respect to the joint velocity. ...
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...
void make_symmetric(Eigen::MatrixBase< Matrix > &mat)
Data::MatrixXs computeStaticTorqueDerivatives(const Model &model, Data &data, const Eigen::VectorXd &q, const ForceAlignedVector &fext)
MatrixXs dtau_dq
Partial derivative of the joint torque vector with respect to the joint configuration.
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
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...
Data::MatrixXs computeGeneralizedGravityDerivatives(const Model &model, Data &data, const Eigen::VectorXd &q)
MatrixXs M
The joint space inertia matrix (a square matrix of dim model.nv).
bp::tuple computeRNEADerivatives(const Model &model, Data &data, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Eigen::VectorXd &a)
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic, Options > MatrixXs
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...
typedef PINOCCHIO_ALIGNED_STD_VECTOR(Force) ForceAlignedVector
Main pinocchio namespace.
Definition: timings.cpp:30
int nv
Dimension of the velocity vector space.
bp::tuple computeRNEADerivatives_fext(const Model &model, Data &data, const Eigen::VectorXd &q, const Eigen::VectorXd &v, const Eigen::VectorXd &a, const ForceAlignedVector &fext)
Eigen::Ref< Matrix > make_ref(Eigen::PlainObjectBase< Matrix > &mat)
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > VectorXd
Definition: conversions.cpp:14
JointCollectionTpl & model


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:02