| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-aba.cpp |
| Date: | 2025-04-30 16:14:33 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 20 | 24 | 83.3% |
| Branches: | 32 | 64 | 50.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2015-2021 CNRS INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | #include "pinocchio/bindings/python/utils/namespace.hpp" | ||
| 7 | |||
| 8 | #include "pinocchio/algorithm/aba.hpp" | ||
| 9 | #include "pinocchio/bindings/python/utils/eigen.hpp" | ||
| 10 | #include "pinocchio/bindings/python/utils/model-checker.hpp" | ||
| 11 | |||
| 12 | namespace pinocchio | ||
| 13 | { | ||
| 14 | namespace python | ||
| 15 | { | ||
| 16 | |||
| 17 | 2 | const context::Data::RowMatrixXs & computeMinverse_proxy( | |
| 18 | const context::Model & model, context::Data & data, const context::VectorXs & q) | ||
| 19 | { | ||
| 20 | 2 | computeMinverse(model, data, q); | |
| 21 | 2 | make_symmetric(data.Minv); | |
| 22 | 2 | return data.Minv; | |
| 23 | } | ||
| 24 | |||
| 25 | const context::Data::RowMatrixXs & | ||
| 26 | ✗ | computeMinverse_min_proxy(const context::Model & model, context::Data & data) | |
| 27 | { | ||
| 28 | ✗ | pinocchio::computeMinverse(model, data); | |
| 29 | ✗ | make_symmetric(data.Minv); | |
| 30 | ✗ | return data.Minv; | |
| 31 | } | ||
| 32 | |||
| 33 | 72 | void exposeABA() | |
| 34 | { | ||
| 35 | typedef context::Scalar Scalar; | ||
| 36 | typedef context::VectorXs VectorXs; | ||
| 37 | enum | ||
| 38 | { | ||
| 39 | Options = context::Options | ||
| 40 | }; | ||
| 41 | |||
| 42 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 43 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
144 | "computeMinverse", &computeMinverse_proxy, bp::args("model", "data", "q"), |
| 44 | "Computes the inverse of the joint space inertia matrix using an extension of the " | ||
| 45 | "Articulated Body algorithm.\n" | ||
| 46 | "The result is stored in data.Minv.\n" | ||
| 47 | "Parameters:\n" | ||
| 48 | "\t model: Model of the kinematic tree\n" | ||
| 49 | "\t data: Data related to the kinematic tree\n" | ||
| 50 | "\t q: joint configuration (size model.nq)", | ||
| 51 | 72 | mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0)); | |
| 52 | |||
| 53 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 54 | "aba", &aba<Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs, VectorXs>, | ||
| 55 |
9/18✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 72 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 72 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 72 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 72 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 72 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 72 times.
✗ Branch 26 not taken.
|
216 | (bp::arg("model"), bp::arg("data"), bp::arg("q"), bp::arg("v"), bp::arg("tau"), |
| 56 |
3/6✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
|
144 | bp::arg("convention") = pinocchio::Convention::LOCAL), |
| 57 | "Compute ABA, store the result in data.ddq and return it.\n" | ||
| 58 | "Parameters:\n" | ||
| 59 | "\t model: Model of the kinematic tree\n" | ||
| 60 | "\t data: Data related to the kinematic tree\n" | ||
| 61 | "\t q: joint configuration (size model.nq)\n" | ||
| 62 | "\t tau: joint velocity (size model.nv)\n" | ||
| 63 | "\t v: joint torque (size model.nv)" | ||
| 64 | "\t convention: Convention to use", | ||
| 65 | 72 | mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0)); | |
| 66 | |||
| 67 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 68 | "aba", | ||
| 69 | &aba< | ||
| 70 | Scalar, Options, JointCollectionDefaultTpl, VectorXs, VectorXs, VectorXs, context::Force>, | ||
| 71 |
10/20✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 72 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 72 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 72 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 72 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 72 times.
✗ Branch 23 not taken.
✓ Branch 25 taken 72 times.
✗ Branch 26 not taken.
✓ Branch 28 taken 72 times.
✗ Branch 29 not taken.
|
216 | (bp::arg("model"), bp::arg("data"), bp::arg("q"), bp::arg("v"), bp::arg("tau"), |
| 72 |
4/8✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 72 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 72 times.
✗ Branch 11 not taken.
|
216 | bp::arg("fext"), bp::arg("convention") = pinocchio::Convention::LOCAL), |
| 73 | "Compute ABA with external forces, store the result in data.ddq and return it.\n" | ||
| 74 | "Parameters:\n" | ||
| 75 | "\t model: Model of the kinematic tree\n" | ||
| 76 | "\t data: Data related to the kinematic tree\n" | ||
| 77 | "\t q: joint configuration (size model.nq)\n" | ||
| 78 | "\t v: joint velocity (size model.nv)\n" | ||
| 79 | "\t tau: joint torque (size model.nv)\n" | ||
| 80 | "\t fext: vector of external forces expressed in the local frame of the joint (size " | ||
| 81 | "model.njoints)" | ||
| 82 | "\t convention: Convention to use", | ||
| 83 | 72 | mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0)); | |
| 84 | |||
| 85 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 86 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
144 | "computeMinverse", &computeMinverse_min_proxy, bp::args("model", "data"), |
| 87 | "Computes the inverse of the joint space inertia matrix using an extension of the " | ||
| 88 | "Articulated Body algorithm.\n" | ||
| 89 | "The result is stored in data.Minv.\n" | ||
| 90 | "Remarks: pinocchio.aba should have been called first.\n" | ||
| 91 | "Parameters:\n" | ||
| 92 | "\t model: Model of the kinematic tree\n" | ||
| 93 | "\t data: Data related to the kinematic tree", | ||
| 94 | 72 | mimic_not_supported_function<bp::return_value_policy<bp::return_by_value>>(0)); | |
| 95 | 72 | } | |
| 96 | |||
| 97 | } // namespace python | ||
| 98 | } // namespace pinocchio | ||
| 99 |