| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-impulse-dynamics.cpp |
| Date: | 2025-02-12 21:03:38 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 6 | 9 | 66.7% |
| Branches: | 18 | 40 | 45.0% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2020-2021 CNRS INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | #include "pinocchio/bindings/python/utils/std-vector.hpp" | ||
| 7 | #include "pinocchio/algorithm/impulse-dynamics.hpp" | ||
| 8 | |||
| 9 | namespace bp = boost::python; | ||
| 10 | |||
| 11 | namespace pinocchio | ||
| 12 | { | ||
| 13 | namespace python | ||
| 14 | { | ||
| 15 | |||
| 16 | #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_IMPULSE_DYNAMICS | ||
| 17 | typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintModel) | ||
| 18 | RigidConstraintModelVector; | ||
| 19 | typedef PINOCCHIO_STD_VECTOR_WITH_EIGEN_ALLOCATOR(context::RigidConstraintData) | ||
| 20 | RigidConstraintDataVector; | ||
| 21 | |||
| 22 | ✗ | static const context::VectorXs impulseDynamics_proxy( | |
| 23 | const context::Model & model, | ||
| 24 | context::Data & data, | ||
| 25 | const context::VectorXs & q, | ||
| 26 | const context::VectorXs & v, | ||
| 27 | const RigidConstraintModelVector & contact_models, | ||
| 28 | RigidConstraintDataVector & contact_datas, | ||
| 29 | const context::Scalar r_coeff, | ||
| 30 | const context::ProximalSettings & prox_settings) | ||
| 31 | { | ||
| 32 | ✗ | return impulseDynamics( | |
| 33 | ✗ | model, data, q, v, contact_models, contact_datas, r_coeff, prox_settings); | |
| 34 | } | ||
| 35 | #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_IMPULSE_DYNAMICS | ||
| 36 | |||
| 37 | 69 | void exposeImpulseDynamics() | |
| 38 | { | ||
| 39 | #ifndef PINOCCHIO_PYTHON_SKIP_ALGORITHM_IMPULSE_DYNAMICS | ||
| 40 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 41 | "impulseDynamics", impulseDynamics_proxy, | ||
| 42 |
9/18✓ 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.
✓ Branch 23 taken 69 times.
✗ Branch 24 not taken.
✓ Branch 26 taken 69 times.
✗ Branch 27 not taken.
|
207 | (bp::arg("model"), bp::arg("data"), bp::arg("q"), bp::arg("v"), bp::arg("contact_models"), |
| 43 |
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.
|
276 | bp::arg("contact_datas"), bp::arg("r_coeff") = 0, |
| 44 |
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.
|
138 | bp::arg("prox_settings") = context::ProximalSettings()), |
| 45 | "Computes the impulse dynamics with contact constraints according to a given list of " | ||
| 46 | "Contact information.\n" | ||
| 47 | "When using impulseDynamics for the first time, you should call first " | ||
| 48 | "initConstraintDynamics to initialize the internal memory used in the algorithm.\n" | ||
| 49 | "This function returns the after-impulse velocity of the system. The impulses acting " | ||
| 50 | "on the contacts are stored in the list data.contact_forces."); | ||
| 51 | #endif // PINOCCHIO_PYTHON_SKIP_ALGORITHM_IMPULSE_DYNAMICS | ||
| 52 | 69 | } | |
| 53 | } // namespace python | ||
| 54 | } // namespace pinocchio | ||
| 55 |