expose-aba-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2021 CNRS INRIA
3 //
4 
9 
11 
12 namespace pinocchio
13 {
14  namespace python
15  {
16 
17  namespace bp = boost::python;
18  typedef PINOCCHIO_ALIGNED_STD_VECTOR(context::Force) ForceAlignedVector;
19 
21  const context::Model & model,
23  const context::VectorXs & q,
24  const context::VectorXs & v,
25  const context::VectorXs & tau)
26  {
28  make_symmetric(data.Minv);
29  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
30  }
31 
33  const context::Model & model,
35  const context::VectorXs & q,
36  const context::VectorXs & v,
37  const context::VectorXs & tau,
38  const ForceAlignedVector & fext)
39  {
41  make_symmetric(data.Minv);
42  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
43  }
44 
46  {
48  make_symmetric(data.Minv);
49  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
50  }
51 
53  const context::Model & model, context::Data & data, const ForceAlignedVector & fext)
54  {
56  make_symmetric(data.Minv);
57  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
58  }
59 
61  {
62  using namespace Eigen;
63 
64  bp::def(
65  "computeABADerivatives", computeABADerivatives, bp::args("model", "data", "q", "v", "tau"),
66  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and "
67  "data.Minv (aka ddq_dtau)\n"
68  "which correspond to the partial derivatives of the joint acceleration vector output "
69  "with respect to the joint configuration,\n"
70  "velocity and torque vectors.\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  "\tv: the joint velocity vector (size model.nv)\n"
76  "\ttau: the joint torque vector (size model.nv)\n\n"
77  "Returns: (ddq_dq, ddq_dv, ddq_da)");
78 
79  bp::def(
80  "computeABADerivatives", computeABADerivatives_fext,
81  bp::args("model", "data", "q", "v", "tau", "fext"),
82  "Computes the ABA derivatives with external contact foces,\n"
83  "store the result in data.ddq_dq, data.ddq_dv and data.Minv (aka ddq_dtau)\n"
84  "which correspond to the partial derivatives of the acceleration output with respect "
85  "to the joint configuration,\n"
86  "velocity and torque vectors.\n\n"
87  "Parameters:\n"
88  "\tmodel: model of the kinematic tree\n"
89  "\tdata: data related to the model\n"
90  "\tq: the joint configuration vector (size model.nq)\n"
91  "\tv: the joint velocity vector (size model.nv)\n"
92  "\ttau: the joint torque vector (size model.nv)\n"
93  "\tfext: list of external forces expressed in the local frame of the joints (size "
94  "model.njoints)\n\n"
95  "Returns: (ddq_dq, ddq_dv, ddq_da)");
96 
97  bp::def(
98  "computeABADerivatives", computeABADerivatives_min, bp::args("model", "data"),
99  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and data.Minv\n"
100  "which correspond to the partial derivatives of the joint acceleration vector output with "
101  "respect to the joint configuration,\n"
102  "velocity and torque vectors.\n"
103  "By calling this function, the user assumes that pinocchio.optimized.aba has been called "
104  "first, allowing to significantly reduce the computation timings by not recalculating "
105  "intermediate results.");
106 
107  bp::def(
108  "computeABADerivatives", computeABADerivatives_min_fext, bp::args("model", "data", "fext"),
109  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and data.Minv\n"
110  "which correspond to the partial derivatives of the joint acceleration vector output with "
111  "respect to the joint configuration,\n"
112  "velocity and torque vectors.\n"
113  "By calling this function, the user assumes that pinocchio.optimized.aba has been called "
114  "first, allowing to significantly reduce the computation timings by not recalculating "
115  "intermediate results.");
116  }
117  } // namespace python
118 } // namespace pinocchio
boost::python
Eigen
pinocchio::DataTpl
Definition: context/generic.hpp:25
pinocchio::python::computeABADerivatives_min_fext
bp::tuple computeABADerivatives_min_fext(const context::Model &model, context::Data &data, const ForceAlignedVector &fext)
Definition: expose-aba-derivatives.cpp:52
pinocchio::python::computeABADerivatives_fext
bp::tuple computeABADerivatives_fext(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &tau, const ForceAlignedVector &fext)
Definition: expose-aba-derivatives.cpp:32
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
eigen-to-python.hpp
pinocchio::python::PINOCCHIO_ALIGNED_STD_VECTOR
typedef PINOCCHIO_ALIGNED_STD_VECTOR(context::Force) ForceAlignedVector
aba-derivatives.hpp
pinocchio::python::make_symmetric
void make_symmetric(const Eigen::MatrixBase< Matrix > &mat, const int mode=Eigen::Upper)
Definition: bindings/python/utils/eigen.hpp:24
forward-dynamics-derivatives.tau
tau
Definition: forward-dynamics-derivatives.py:23
pinocchio::context::VectorXs
Eigen::Matrix< Scalar, Eigen::Dynamic, 1, Options > VectorXs
Definition: context/generic.hpp:47
pinocchio::python::exposeABADerivatives
void exposeABADerivatives()
Definition: expose-aba-derivatives.cpp:60
algorithms.hpp
python
pinocchio::python::v
const Vector3Like & v
Definition: bindings/python/spatial/explog.hpp:66
pinocchio::q
JointCollectionTpl const Eigen::MatrixBase< ConfigVectorType > & q
Definition: joint-configuration.hpp:1117
pinocchio::computeABADerivatives
void computeABADerivatives(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 > &tau, const Eigen::MatrixBase< MatrixType1 > &aba_partial_dq, const Eigen::MatrixBase< MatrixType2 > &aba_partial_dv, const Eigen::MatrixBase< MatrixType3 > &aba_partial_dtau)
The derivatives of the Articulated-Body algorithm.
pinocchio::python::computeABADerivatives_min
bp::tuple computeABADerivatives_min(const context::Model &model, context::Data &data)
Definition: expose-aba-derivatives.cpp:45
pinocchio::python::computeABADerivatives
bp::tuple computeABADerivatives(const context::Model &model, context::Data &data, const context::VectorXs &q, const context::VectorXs &v, const context::VectorXs &tau)
Definition: expose-aba-derivatives.cpp:20
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
eigen.hpp
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1116
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
namespace.hpp


pinocchio
Author(s):
autogenerated on Fri Jun 7 2024 02:40:46