| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-delassus.cpp |
| Date: | 2025-04-30 16:14:33 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 10 | 22 | 45.5% |
| Branches: | 26 | 72 | 36.1% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2020-2021 INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | |||
| 7 | #include "pinocchio/bindings/python/utils/eigen.hpp" | ||
| 8 | #include "pinocchio/bindings/python/utils/std-vector.hpp" | ||
| 9 | #include "pinocchio/bindings/python/utils/model-checker.hpp" | ||
| 10 | |||
| 11 | #include "pinocchio/algorithm/delassus.hpp" | ||
| 12 | |||
| 13 | namespace bp = boost::python; | ||
| 14 | |||
| 15 | namespace pinocchio | ||
| 16 | { | ||
| 17 | namespace python | ||
| 18 | { | ||
| 19 | typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintModel) | ||
| 20 | RigidConstraintModelVector; | ||
| 21 | typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintData) | ||
| 22 | RigidConstraintDataVector; | ||
| 23 | |||
| 24 | ✗ | static const context::MatrixXs computeDelassusMatrix_proxy( | |
| 25 | const context::Model & model, | ||
| 26 | context::Data & data, | ||
| 27 | const context::VectorXs & q, | ||
| 28 | const RigidConstraintModelVector & contact_models, | ||
| 29 | RigidConstraintDataVector & contact_datas, | ||
| 30 | const context::Scalar mu = context::Scalar(0)) | ||
| 31 | { | ||
| 32 | ✗ | const size_t constraint_size = getTotalConstraintSize(contact_models); | |
| 33 | ✗ | context::MatrixXs delassus(constraint_size, constraint_size); | |
| 34 | ✗ | computeDelassusMatrix(model, data, q, contact_models, contact_datas, delassus, mu); | |
| 35 | ✗ | make_symmetric(delassus); | |
| 36 | ✗ | return delassus; | |
| 37 | } | ||
| 38 | |||
| 39 | ✗ | static const context::MatrixXs computeDampedDelassusMatrixInverse_proxy( | |
| 40 | const context::Model & model, | ||
| 41 | context::Data & data, | ||
| 42 | const context::VectorXs & q, | ||
| 43 | const RigidConstraintModelVector & contact_models, | ||
| 44 | RigidConstraintDataVector & contact_datas, | ||
| 45 | const context::Scalar mu, | ||
| 46 | const bool scaled = false) | ||
| 47 | { | ||
| 48 | ✗ | const size_t constraint_size = getTotalConstraintSize(contact_models); | |
| 49 | ✗ | context::MatrixXs delassus_inverse(constraint_size, constraint_size); | |
| 50 | ✗ | computeDampedDelassusMatrixInverse( | |
| 51 | model, data, q, contact_models, contact_datas, delassus_inverse, mu, scaled); | ||
| 52 | ✗ | make_symmetric(delassus_inverse); | |
| 53 | ✗ | return delassus_inverse; | |
| 54 | } | ||
| 55 | |||
| 56 | 72 | void exposeDelassus() | |
| 57 | { | ||
| 58 | using namespace Eigen; | ||
| 59 | |||
| 60 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 61 | "computeDelassusMatrix", computeDelassusMatrix_proxy, | ||
| 62 |
8/16✓ 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.
|
216 | (bp::arg("model"), bp::arg("data"), bp::arg("q"), bp::arg("contact_models"), |
| 63 |
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("contact_datas"), bp::arg("mu") = 0), |
| 64 | "Computes the Delassus matrix associated to a set of given constraints.", | ||
| 65 | 72 | mimic_not_supported_function<>(0)); | |
| 66 | |||
| 67 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 68 | "computeDampedDelassusMatrixInverse", computeDampedDelassusMatrixInverse_proxy, | ||
| 69 |
8/16✓ 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.
|
216 | (bp::arg("model"), bp::arg("data"), bp::arg("q"), bp::arg("contact_models"), |
| 70 |
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("contact_datas"), bp::arg("mu") = 0), |
| 71 | "Computes the inverse of the Delassus matrix associated to a set of given constraints.", | ||
| 72 | 72 | mimic_not_supported_function<>(0)); | |
| 73 | 72 | } | |
| 74 | } // namespace python | ||
| 75 | } // namespace pinocchio | ||
| 76 |