Directory: | ./ |
---|---|
File: | bindings/python/algorithm/expose-constrained-dynamics-derivatives.cpp |
Date: | 2025-02-12 21:03:38 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 5 | 9 | 55.6% |
Branches: | 11 | 34 | 32.4% |
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 | |||
11 | namespace bp = boost::python; | ||
12 | |||
13 | namespace pinocchio | ||
14 | { | ||
15 | namespace python | ||
16 | { | ||
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 | ✗ | bp::tuple computeConstraintDynamicsDerivatives_proxy( | |
23 | const context::Model & model, | ||
24 | context::Data & data, | ||
25 | const RigidConstraintModelVector & contact_models, | ||
26 | RigidConstraintDataVector & contact_datas, | ||
27 | const context::ProximalSettings & settings = context::ProximalSettings()) | ||
28 | { | ||
29 | ✗ | pinocchio::computeConstraintDynamicsDerivatives( | |
30 | model, data, contact_models, contact_datas, | ||
31 | const_cast<context::ProximalSettings &>(settings)); | ||
32 | |||
33 | return bp::make_tuple( | ||
34 | ✗ | make_ref(data.ddq_dq), make_ref(data.ddq_dv), make_ref(data.ddq_dtau), | |
35 | ✗ | make_ref(data.dlambda_dq), make_ref(data.dlambda_dv), make_ref(data.dlambda_dtau)); | |
36 | } | ||
37 | |||
38 | 69 | void exposeConstraintDynamicsDerivatives() | |
39 | { | ||
40 | using namespace Eigen; | ||
41 | |||
42 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
43 | "computeConstraintDynamicsDerivatives", computeConstraintDynamicsDerivatives_proxy, | ||
44 |
6/12✓ 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.
|
207 | (bp::arg("model"), bp::arg("data"), bp::arg("contact_models"), bp::arg("contact_datas"), |
45 |
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("settings") = context::ProximalSettings()), |
46 | "Computes the derivatives of the forward dynamics with kinematic constraints (given in the " | ||
47 | "list of constraint models).\n" | ||
48 | "Assumes that constraintDynamics has been called first. See constraintDynamics for more " | ||
49 | "details.\n" | ||
50 | "This function returns the derivatives of joint acceleration (ddq) and contact forces " | ||
51 | "(lambda_c) of the system with respect to q, v and tau.\n" | ||
52 | "The output is a tuple with ddq_dq, ddq_dv, ddq_da, dlambda_dq, dlambda_dv, dlambda_da."); | ||
53 | 69 | } | |
54 | } // namespace python | ||
55 | } // namespace pinocchio | ||
56 |