expose-aba-derivatives.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018-2021 CNRS INRIA
3 //
4 
10 
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17 
18  namespace bp = boost::python;
19  typedef PINOCCHIO_ALIGNED_STD_VECTOR(context::Force) ForceAlignedVector;
20 
22  const context::Model & model,
24  const context::VectorXs & q,
25  const context::VectorXs & v,
26  const context::VectorXs & tau)
27  {
29  make_symmetric(data.Minv);
30  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
31  }
32 
34  const context::Model & model,
36  const context::VectorXs & q,
37  const context::VectorXs & v,
38  const context::VectorXs & tau,
39  const ForceAlignedVector & fext)
40  {
42  make_symmetric(data.Minv);
43  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
44  }
45 
47  {
49  make_symmetric(data.Minv);
50  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
51  }
52 
54  const context::Model & model, context::Data & data, const ForceAlignedVector & fext)
55  {
57  make_symmetric(data.Minv);
58  return bp::make_tuple(make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.Minv));
59  }
60 
62  {
63  using namespace Eigen;
64 
65  bp::def(
66  "computeABADerivatives", computeABADerivatives, bp::args("model", "data", "q", "v", "tau"),
67  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and "
68  "data.Minv (aka ddq_dtau)\n"
69  "which correspond to the partial derivatives of the joint acceleration vector output "
70  "with respect to the joint configuration,\n"
71  "velocity and torque vectors.\n\n"
72  "Parameters:\n"
73  "\tmodel: model of the kinematic tree\n"
74  "\tdata: data related to the model\n"
75  "\tq: the joint configuration vector (size model.nq)\n"
76  "\tv: the joint velocity vector (size model.nv)\n"
77  "\ttau: the joint torque vector (size model.nv)\n\n"
78  "Returns: (ddq_dq, ddq_dv, ddq_da)",
80 
81  bp::def(
82  "computeABADerivatives", computeABADerivatives_fext,
83  bp::args("model", "data", "q", "v", "tau", "fext"),
84  "Computes the ABA derivatives with external contact foces,\n"
85  "store the result in data.ddq_dq, data.ddq_dv and data.Minv (aka ddq_dtau)\n"
86  "which correspond to the partial derivatives of the acceleration output with respect "
87  "to the joint configuration,\n"
88  "velocity and torque vectors.\n\n"
89  "Parameters:\n"
90  "\tmodel: model of the kinematic tree\n"
91  "\tdata: data related to the model\n"
92  "\tq: the joint configuration vector (size model.nq)\n"
93  "\tv: the joint velocity vector (size model.nv)\n"
94  "\ttau: the joint torque vector (size model.nv)\n"
95  "\tfext: list of external forces expressed in the local frame of the joints (size "
96  "model.njoints)\n\n"
97  "Returns: (ddq_dq, ddq_dv, ddq_da)",
99 
100  bp::def(
101  "computeABADerivatives", computeABADerivatives_min, bp::args("model", "data"),
102  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and data.Minv\n"
103  "which correspond to the partial derivatives of the joint acceleration vector output with "
104  "respect to the joint configuration,\n"
105  "velocity and torque vectors.\n"
106  "By calling this function, the user assumes that pinocchio.optimized.aba has been called "
107  "first, allowing to significantly reduce the computation timings by not recalculating "
108  "intermediate results.",
110 
111  bp::def(
112  "computeABADerivatives", computeABADerivatives_min_fext, bp::args("model", "data", "fext"),
113  "Computes the ABA derivatives, store the result in data.ddq_dq, data.ddq_dv and data.Minv\n"
114  "which correspond to the partial derivatives of the joint acceleration vector output with "
115  "respect to the joint configuration,\n"
116  "velocity and torque vectors.\n"
117  "By calling this function, the user assumes that pinocchio.optimized.aba has been called "
118  "first, allowing to significantly reduce the computation timings by not recalculating "
119  "intermediate results.",
121  }
122  } // namespace python
123 } // 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:53
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:33
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
pinocchio::python::VectorXs
context::VectorXs VectorXs
Definition: admm-solver.cpp:30
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:25
pinocchio::python::exposeABADerivatives
void exposeABADerivatives()
Definition: expose-aba-derivatives.cpp:61
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:1083
pinocchio::python::mimic_not_supported_function
Definition: model-checker.hpp:22
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:46
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:21
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
eigen.hpp
pinocchio::model
JointCollectionTpl & model
Definition: joint-configuration.hpp:1082
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33
namespace.hpp


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