| Directory: | ./ |
|---|---|
| File: | bindings/python/algorithm/expose-constrained-dynamics-derivatives.cpp |
| Date: | 2025-04-30 16:14:33 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 6 | 10 | 60.0% |
| Branches: | 12 | 36 | 33.3% |
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2021-2022 INRIA | ||
| 3 | // | ||
| 4 | |||
| 5 | #include "pinocchio/bindings/python/algorithm/algorithms.hpp" | ||
| 6 | #include "pinocchio/algorithm/constrained-dynamics-derivatives.hpp" | ||
| 7 | |||
| 8 | #include "pinocchio/bindings/python/utils/std-vector.hpp" | ||
| 9 | #include "pinocchio/bindings/python/utils/eigen.hpp" | ||
| 10 | #include "pinocchio/bindings/python/utils/model-checker.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 | ✗ | bp::tuple computeConstraintDynamicsDerivatives_proxy( | |
| 24 | const context::Model & model, | ||
| 25 | context::Data & data, | ||
| 26 | const RigidConstraintModelVector & contact_models, | ||
| 27 | RigidConstraintDataVector & contact_datas, | ||
| 28 | const context::ProximalSettings & settings = context::ProximalSettings()) | ||
| 29 | { | ||
| 30 | ✗ | pinocchio::computeConstraintDynamicsDerivatives( | |
| 31 | model, data, contact_models, contact_datas, | ||
| 32 | const_cast<context::ProximalSettings &>(settings)); | ||
| 33 | |||
| 34 | return bp::make_tuple( | ||
| 35 | ✗ | make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.ddq_dtau), | |
| 36 | ✗ | make_ref(data.dlambda_dq), make_ref(data.dlambda_dv), make_ref(data.dlambda_dtau)); | |
| 37 | } | ||
| 38 | |||
| 39 | 72 | void exposeConstraintDynamicsDerivatives() | |
| 40 | { | ||
| 41 | using namespace Eigen; | ||
| 42 | |||
| 43 |
1/2✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
|
72 | bp::def( |
| 44 | "computeConstraintDynamicsDerivatives", computeConstraintDynamicsDerivatives_proxy, | ||
| 45 |
7/14✓ 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.
|
216 | (bp::arg("model"), bp::arg("data"), bp::arg("contact_models"), bp::arg("contact_datas"), |
| 46 |
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.
|
144 | bp::arg("settings") = context::ProximalSettings()), |
| 47 | "Computes the derivatives of the forward dynamics with kinematic constraints (given in the " | ||
| 48 | "list of constraint models).\n" | ||
| 49 | "Assumes that constraintDynamics has been called first. See constraintDynamics for more " | ||
| 50 | "details.\n" | ||
| 51 | "This function returns the derivatives of joint acceleration (ddq) and contact forces " | ||
| 52 | "(lambda_c) of the system with respect to q, v and tau.\n" | ||
| 53 | "The output is a tuple with ddq_dq, ddq_dv, ddq_da, dlambda_dq, dlambda_dv, dlambda_da.", | ||
| 54 | 72 | mimic_not_supported_function<>(0)); | |
| 55 | 72 | } | |
| 56 | } // namespace python | ||
| 57 | } // namespace pinocchio | ||
| 58 |