Directory: | ./ |
---|---|
File: | bindings/python/crocoddyl/crocoddyl.cpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 16 | 16 | 100.0% |
Branches: | 22 | 44 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2019-2024, LAAS-CNRS, University of Edinburgh, INRIA, | ||
5 | // Heriot-Watt University | ||
6 | // University of Oxford Copyright note valid unless otherwise stated in | ||
7 | // individual files. All rights reserved. | ||
8 | /////////////////////////////////////////////////////////////////////////////// | ||
9 | |||
10 | #include "crocoddyl/core/utils/version.hpp" | ||
11 | #include "python/crocoddyl/fwd.hpp" | ||
12 | #include "python/crocoddyl/utils/set-converter.hpp" | ||
13 | #include "python/crocoddyl/utils/vector-converter.hpp" | ||
14 | |||
15 | namespace crocoddyl { | ||
16 | namespace python { | ||
17 | |||
18 | namespace bp = boost::python; | ||
19 | |||
20 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
|
40 | BOOST_PYTHON_MODULE(libcrocoddyl_pywrap) { |
21 |
5/10✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 10 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 10 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 10 times.
✗ Branch 15 not taken.
|
20 | bp::scope().attr("__version__") = crocoddyl::printVersion(); |
22 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 10 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 10 times.
✗ Branch 9 not taken.
|
20 | bp::scope().attr("__raw_version__") = bp::str(CROCODDYL_VERSION); |
23 | |||
24 | 20 | eigenpy::enableEigenPy(); | |
25 | |||
26 | typedef double Scalar; | ||
27 | typedef Eigen::Matrix<Scalar, 4, 1> Vector4; | ||
28 | typedef Eigen::Matrix<Scalar, 6, 1> Vector6; | ||
29 | typedef Eigen::Matrix<Scalar, 4, 6> Matrix46; | ||
30 | typedef Eigen::Matrix<Scalar, 6, Eigen::Dynamic> Matrix6x; | ||
31 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 3> MatrixX3; | ||
32 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> VectorX; | ||
33 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX; | ||
34 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> | ||
35 | RowMatrixX; | ||
36 | |||
37 | 20 | eigenpy::enableEigenPySpecific<Vector4>(); | |
38 | 20 | eigenpy::enableEigenPySpecific<Vector6>(); | |
39 | 20 | eigenpy::enableEigenPySpecific<Matrix46>(); | |
40 | 20 | eigenpy::enableEigenPySpecific<MatrixX3>(); | |
41 | 20 | eigenpy::enableEigenPySpecific<Matrix6x>(); | |
42 | |||
43 | // Register converters between std::vector and Python list | ||
44 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
|
20 | StdVectorPythonVisitor<std::vector<VectorX>, true>::expose("StdVec_VectorX"); |
45 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
|
20 | StdVectorPythonVisitor<std::vector<MatrixX>, true>::expose("StdVec_MatrixX"); |
46 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
|
20 | StdVectorPythonVisitor<std::vector<RowMatrixX>, true>::expose( |
47 | "StdVec_RowMatrixX"); | ||
48 | |||
49 | // Register converters between std::set and Python set | ||
50 | StdSetPythonVisitor<std::string, std::less<std::string>, | ||
51 | std::allocator<std::string>, | ||
52 |
3/6✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 10 times.
✗ Branch 10 not taken.
|
20 | true>::expose("StdSet_String"); |
53 | |||
54 | 20 | exposeCore(); | |
55 | 20 | exposeMultibody(); | |
56 | 20 | } | |
57 | |||
58 | } // namespace python | ||
59 | } // namespace crocoddyl | ||
60 |