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