| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-contact-jacobian.cpp |
| Date: | 2025-04-30 16:14:33 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 8 | 19 | 42.1% |
| Branches: | 4 | 20 | 20.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2021 INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | #include "pinocchio/algorithm/contact-jacobian.hpp" | ||
| 7 | |||
| 8 | #include "pinocchio/bindings/python/utils/std-vector.hpp" | ||
| 9 | #include "pinocchio/bindings/python/utils/model-checker.hpp" | ||
| 10 | |||
| 11 | namespace bp = boost::python; | ||
| 12 | |||
| 13 | namespace pinocchio | ||
| 14 | { | ||
| 15 | namespace python | ||
| 16 | { | ||
| 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 context::MatrixXs getConstraintJacobian_proxy( | |
| 24 | const context::Model & model, | ||
| 25 | const context::Data & data, | ||
| 26 | const context::RigidConstraintModel & contact_model, | ||
| 27 | context::RigidConstraintData & contact_data) | ||
| 28 | { | ||
| 29 | ✗ | context::MatrixXs J(contact_model.size(), model.nv); | |
| 30 | ✗ | J.setZero(); | |
| 31 | ✗ | getConstraintJacobian(model, data, contact_model, contact_data, J); | |
| 32 | ✗ | return J; | |
| 33 | } | ||
| 34 | |||
| 35 | ✗ | static context::MatrixXs getConstraintsJacobian_proxy( | |
| 36 | const context::Model & model, | ||
| 37 | const context::Data & data, | ||
| 38 | const RigidConstraintModelVector & contact_models, | ||
| 39 | RigidConstraintDataVector & contact_datas) | ||
| 40 | { | ||
| 41 | ✗ | const Eigen::DenseIndex constraint_size = getTotalConstraintSize(contact_models); | |
| 42 | ✗ | context::MatrixXs J(constraint_size, model.nv); | |
| 43 | ✗ | J.setZero(); | |
| 44 | ✗ | getConstraintsJacobian(model, data, contact_models, contact_datas, J); | |
| 45 | ✗ | return J; | |
| 46 | } | ||
| 47 | |||
| 48 | 72 | void exposeContactJacobian() | |
| 49 | { | ||
| 50 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 51 | "getConstraintJacobian", getConstraintJacobian_proxy, | ||
| 52 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
144 | bp::args("model", "data", "contact_model", "contact_data"), |
| 53 | "Computes the kinematic Jacobian associatied to a given constraint model.", | ||
| 54 | 72 | mimic_not_supported_function<>(0)); | |
| 55 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 56 | "getConstraintsJacobian", getConstraintsJacobian_proxy, | ||
| 57 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
144 | bp::args("model", "data", "contact_models", "contact_datas"), |
| 58 | "Computes the kinematic Jacobian associatied to a given set of constraint models.", | ||
| 59 | 72 | mimic_not_supported_function<>(0)); | |
| 60 | 72 | } | |
| 61 | } // namespace python | ||
| 62 | } // namespace pinocchio | ||
| 63 |