GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/multibody/expose-liegroups.cpp Lines: 12 16 75.0 %
Date: 2024-04-26 13:14:21 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<double,0,LieGroupCollectionDefaultTpl>
20
makeLieGroup()
21
{
22
  return CartesianProductOperationVariantTpl<double,0,LieGroupCollectionDefaultTpl> (LgType());
23
}
24
25
CartesianProductOperationVariantTpl<double,0,LieGroupCollectionDefaultTpl>
26
makeRn(int n)
27
{
28
  return CartesianProductOperationVariantTpl<double,0,LieGroupCollectionDefaultTpl> (
29
      VectorSpaceOperationTpl<Eigen::Dynamic,double,0>(n));
30
}
31
32
33
/* --- Expose --------------------------------------------------------- */
34
19
void exposeLieGroups()
35
{
36
  LieGroupPythonVisitor<
37
    CartesianProductOperationVariantTpl<double,0,LieGroupCollectionDefaultTpl>
38
19
    >::expose("LieGroup");
39
40
  {
41
    // Switch the scope to the submodule, add methods and classes.
42

57
    bp::scope submoduleScope = getOrCreatePythonNamespace("liegroups");
43
44
19
    bp::def("R1", makeLieGroup<VectorSpaceOperationTpl<1,double,0> >);
45
19
    bp::def("R2", makeLieGroup<VectorSpaceOperationTpl<2,double,0> >);
46
19
    bp::def("R3", makeLieGroup<VectorSpaceOperationTpl<3,double,0> >);
47
19
    bp::def("Rn", makeRn);
48
19
    bp::def("SO2", makeLieGroup<SpecialOrthogonalOperationTpl<2,double,0> >);
49
19
    bp::def("SO3", makeLieGroup<SpecialOrthogonalOperationTpl<3,double,0> >);
50
19
    bp::def("SE2", makeLieGroup<SpecialEuclideanOperationTpl<2,double,0> >);
51
19
    bp::def("SE3", makeLieGroup<SpecialEuclideanOperationTpl<3,double,0> >);
52
  }
53
19
}
54
} // namespace python
55
} // namespace pinocchio