GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: bindings/python/crocoddyl/crocoddyl.cpp Lines: 15 15 100.0 %
Date: 2024-02-13 11:12:33 Branches: 19 38 50.0 %

Line Branch Exec Source
1
///////////////////////////////////////////////////////////////////////////////
2
// BSD 3-Clause License
3
//
4
// Copyright (C) 2019-2021, LAAS-CNRS, University of Edinburgh, INRIA,
5
// University of Oxford Copyright note valid unless otherwise stated in
6
// individual files. All rights reserved.
7
///////////////////////////////////////////////////////////////////////////////
8
9
#include "crocoddyl/core/utils/version.hpp"
10
#include "python/crocoddyl/fwd.hpp"
11
#include "python/crocoddyl/utils/set-converter.hpp"
12
#include "python/crocoddyl/utils/vector-converter.hpp"
13
14
namespace crocoddyl {
15
namespace python {
16
17
namespace bp = boost::python;
18
19

40
BOOST_PYTHON_MODULE(libcrocoddyl_pywrap) {
20


20
  bp::scope().attr("__version__") = printVersion();
21
22
20
  eigenpy::enableEigenPy();
23
24
  typedef double Scalar;
25
  typedef Eigen::Matrix<Scalar, 4, 1> Vector4;
26
  typedef Eigen::Matrix<Scalar, 6, 1> Vector6;
27
  typedef Eigen::Matrix<Scalar, 4, 6> Matrix46;
28
  typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic> Matrix6x;
29
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 3> MatrixX3;
30
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX;
31
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;
32
  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>
33
      RowMatrixX;
34
35
20
  eigenpy::enableEigenPySpecific<Vector4>();
36
20
  eigenpy::enableEigenPySpecific<Vector6>();
37
20
  eigenpy::enableEigenPySpecific<Matrix46>();
38
20
  eigenpy::enableEigenPySpecific<MatrixX3>();
39
20
  eigenpy::enableEigenPySpecific<Matrix6x>();
40
41
  // Register converters between std::vector and Python list
42

20
  StdVectorPythonVisitor<std::vector<VectorX>, true>::expose("StdVec_VectorX");
43

20
  StdVectorPythonVisitor<std::vector<MatrixX>, true>::expose("StdVec_MatrixX");
44

20
  StdVectorPythonVisitor<std::vector<RowMatrixX>, true>::expose(
45
      "StdVec_RowMatrixX");
46
47
  // Register converters between std::set and Python set
48
  StdSetPythonVisitor<std::string, std::less<std::string>,
49
                      std::allocator<std::string>,
50

20
                      true>::expose("StdSet_String");
51
52
20
  exposeCore();
53
20
  exposeMultibody();
54
20
}
55
56
}  // namespace python
57
}  // namespace crocoddyl