| Directory: | ./ |
|---|---|
| File: | bindings/python/multibody/expose-liegroups.cpp |
| Date: | 2025-02-12 21:03:38 |
| Exec | Total | Coverage | |
|---|---|---|---|
| Lines: | 17 | 17 | 100.0% |
| Branches: | 15 | 30 | 50.0% |
| 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 | 60 | makeLieGroup() | |
| 24 | { | ||
| 25 | return CartesianProductOperationVariantTpl< | ||
| 26 |
2/4✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 30 times.
✗ Branch 6 not taken.
|
60 | context::Scalar, context::Options, LieGroupCollectionDefaultTpl>(LgType()); |
| 27 | } | ||
| 28 | |||
| 29 | CartesianProductOperationVariantTpl< | ||
| 30 | context::Scalar, | ||
| 31 | context::Options, | ||
| 32 | LieGroupCollectionDefaultTpl> | ||
| 33 | 1 | makeRn(int n) | |
| 34 | { | ||
| 35 | return CartesianProductOperationVariantTpl< | ||
| 36 | context::Scalar, context::Options, LieGroupCollectionDefaultTpl>( | ||
| 37 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | VectorSpaceOperationTpl<Eigen::Dynamic, context::Scalar, context::Options>(n)); |
| 38 | } | ||
| 39 | |||
| 40 | /* --- Expose --------------------------------------------------------- */ | ||
| 41 | 69 | void exposeLieGroups() | |
| 42 | { | ||
| 43 | LieGroupPythonVisitor<CartesianProductOperationVariantTpl< | ||
| 44 | 69 | 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 69 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 69 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 69 times.
✗ Branch 9 not taken.
|
138 | bp::scope submoduleScope = getOrCreatePythonNamespace("liegroups"); |
| 49 | |||
| 50 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def("R1", makeLieGroup<VectorSpaceOperationTpl<1, context::Scalar, context::Options>>); |
| 51 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def("R2", makeLieGroup<VectorSpaceOperationTpl<2, context::Scalar, context::Options>>); |
| 52 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def("R3", makeLieGroup<VectorSpaceOperationTpl<3, context::Scalar, context::Options>>); |
| 53 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def("Rn", makeRn); |
| 54 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 55 | "SO2", makeLieGroup<SpecialOrthogonalOperationTpl<2, context::Scalar, context::Options>>); | ||
| 56 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 57 | "SO3", makeLieGroup<SpecialOrthogonalOperationTpl<3, context::Scalar, context::Options>>); | ||
| 58 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 59 | "SE2", makeLieGroup<SpecialEuclideanOperationTpl<2, context::Scalar, context::Options>>); | ||
| 60 |
1/2✓ Branch 1 taken 69 times.
✗ Branch 2 not taken.
|
69 | bp::def( |
| 61 | "SE3", makeLieGroup<SpecialEuclideanOperationTpl<3, context::Scalar, context::Options>>); | ||
| 62 | 69 | } | |
| 63 | 69 | } | |
| 64 | } // namespace python | ||
| 65 | } // namespace pinocchio | ||
| 66 |