Directory: | ./ |
---|---|
File: | bindings/python/multibody/expose-liegroups.cpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 13 | 17 | 76.5% |
Branches: | 11 | 30 | 36.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2015-2020 CNRS INRIA | ||
3 | // | ||
4 | |||
5 | #include "pinocchio/bindings/python/fwd.hpp" | ||
6 | #include "pinocchio/bindings/python/multibody/liegroups.hpp" | ||
7 | #include "pinocchio/bindings/python/utils/namespace.hpp" | ||
8 | |||
9 | #include <eigenpy/memory.hpp> | ||
10 | |||
11 | namespace pinocchio | ||
12 | { | ||
13 | namespace python | ||
14 | { | ||
15 | |||
16 | namespace bp = boost::python; | ||
17 | |||
18 | template<typename LgType> | ||
19 | CartesianProductOperationVariantTpl< | ||
20 | context::Scalar, | ||
21 | context::Options, | ||
22 | LieGroupCollectionDefaultTpl> | ||
23 | ✗ | makeLieGroup() | |
24 | { | ||
25 | return CartesianProductOperationVariantTpl< | ||
26 | ✗ | context::Scalar, context::Options, LieGroupCollectionDefaultTpl>(LgType()); | |
27 | } | ||
28 | |||
29 | CartesianProductOperationVariantTpl< | ||
30 | context::Scalar, | ||
31 | context::Options, | ||
32 | LieGroupCollectionDefaultTpl> | ||
33 | ✗ | makeRn(int n) | |
34 | { | ||
35 | return CartesianProductOperationVariantTpl< | ||
36 | context::Scalar, context::Options, LieGroupCollectionDefaultTpl>( | ||
37 | ✗ | VectorSpaceOperationTpl<Eigen::Dynamic, context::Scalar, context::Options>(n)); | |
38 | } | ||
39 | |||
40 | /* --- Expose --------------------------------------------------------- */ | ||
41 | 20 | void exposeLieGroups() | |
42 | { | ||
43 | LieGroupPythonVisitor<CartesianProductOperationVariantTpl< | ||
44 | 20 | context::Scalar, context::Options, LieGroupCollectionDefaultTpl>>::expose("LieGroup"); | |
45 | |||
46 | { | ||
47 | // Switch the scope to the submodule, add methods and classes. | ||
48 |
3/6✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
|
40 | bp::scope submoduleScope = getOrCreatePythonNamespace("liegroups"); |
49 | |||
50 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def("R1", makeLieGroup<VectorSpaceOperationTpl<1, context::Scalar, context::Options>>); |
51 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def("R2", makeLieGroup<VectorSpaceOperationTpl<2, context::Scalar, context::Options>>); |
52 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def("R3", makeLieGroup<VectorSpaceOperationTpl<3, context::Scalar, context::Options>>); |
53 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def("Rn", makeRn); |
54 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
55 | "SO2", makeLieGroup<SpecialOrthogonalOperationTpl<2, context::Scalar, context::Options>>); | ||
56 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
57 | "SO3", makeLieGroup<SpecialOrthogonalOperationTpl<3, context::Scalar, context::Options>>); | ||
58 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
59 | "SE2", makeLieGroup<SpecialEuclideanOperationTpl<2, context::Scalar, context::Options>>); | ||
60 |
1/2✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 | bp::def( |
61 | "SE3", makeLieGroup<SpecialEuclideanOperationTpl<3, context::Scalar, context::Options>>); | ||
62 | 20 | } | |
63 | 20 | } | |
64 | } // namespace python | ||
65 | } // namespace pinocchio | ||
66 |