Directory: | ./ |
---|---|
File: | bindings/python/algorithm/expose-contact-jacobian.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 17 | 35.3% |
Branches: | 2 | 16 | 12.5% |
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 | |||
10 | namespace bp = boost::python; | ||
11 | |||
12 | namespace pinocchio | ||
13 | { | ||
14 | namespace python | ||
15 | { | ||
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 | ✗ | static context::MatrixXs getConstraintJacobian_proxy( | |
23 | const context::Model & model, | ||
24 | const context::Data & data, | ||
25 | const context::RigidConstraintModel & contact_model, | ||
26 | context::RigidConstraintData & contact_data) | ||
27 | { | ||
28 | ✗ | context::MatrixXs J(contact_model.size(), model.nv); | |
29 | ✗ | J.setZero(); | |
30 | ✗ | getConstraintJacobian(model, data, contact_model, contact_data, J); | |
31 | ✗ | return J; | |
32 | } | ||
33 | |||
34 | ✗ | static context::MatrixXs getConstraintsJacobian_proxy( | |
35 | const context::Model & model, | ||
36 | const context::Data & data, | ||
37 | const RigidConstraintModelVector & contact_models, | ||
38 | RigidConstraintDataVector & contact_datas) | ||
39 | { | ||
40 | ✗ | const Eigen::DenseIndex constraint_size = getTotalConstraintSize(contact_models); | |
41 | ✗ | context::MatrixXs J(constraint_size, model.nv); | |
42 | ✗ | J.setZero(); | |
43 | ✗ | getConstraintsJacobian(model, data, contact_models, contact_datas, J); | |
44 | ✗ | return J; | |
45 | } | ||
46 | |||
47 | 20 | void exposeContactJacobian() | |
48 | { | ||
49 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
50 | "getConstraintJacobian", getConstraintJacobian_proxy, | ||
51 | 40 | bp::args("model", "data", "contact_model", "contact_data"), | |
52 | "Computes the kinematic Jacobian associatied to a given constraint model."); | ||
53 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
54 | "getConstraintsJacobian", getConstraintsJacobian_proxy, | ||
55 | 40 | bp::args("model", "data", "contact_models", "contact_datas"), | |
56 | "Computes the kinematic Jacobian associatied to a given set of constraint models."); | ||
57 | 20 | } | |
58 | } // namespace python | ||
59 | } // namespace pinocchio | ||
60 |