GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/multibody/cop-support.cpp
Date: 2025-01-16 08:47:40
Exec Total Coverage
Lines: 25 27 92.6%
Branches: 21 42 50.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2021-2023, University of Edinburgh, Heriot-Watt University
5 // Copyright note valid unless otherwise stated in individual files.
6 // All rights reserved.
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #include "crocoddyl/multibody/cop-support.hpp"
10
11 #include "python/crocoddyl/multibody/multibody.hpp"
12 #include "python/crocoddyl/utils/copyable.hpp"
13 #include "python/crocoddyl/utils/printable.hpp"
14
15 namespace crocoddyl {
16 namespace python {
17
18 10 void exposeCoPSupport() {
19 10 bp::register_ptr_to_python<boost::shared_ptr<CoPSupport> >();
20
21 #pragma GCC diagnostic push // TODO: Remove once the deprecated update call has
22 // been removed in a future release
23 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
24
25
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::class_<CoPSupport>(
26 "CoPSupport", "Model of the CoP support as lb <= Af <= ub",
27
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::init<Eigen::Matrix3d, Eigen::Vector2d>(
28 20 bp::args("self", "R", "box"),
29 "Initialize the CoP support.\n\n"
30 ":param R: rotation matrix that defines the cone orientation\n"
31 ":param box: dimension of the foot surface dim = (length, width)\n"))
32
3/6
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 10 times.
✗ Branch 8 not taken.
20 .def(bp::init<>(bp::args("self"),
33 "Default initialization of the CoP support."))
34
2/4
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
20 .def("update", &CoPSupport::update, bp::args("self"),
35 "Update the linear inequality (matrix and bounds).\n\n"
36 "Run this function if you have changed one of the parameters.")
37
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .add_property("A",
38
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::make_function(&CoPSupport::get_A,
39 10 bp::return_internal_reference<>()),
40 "inequality matrix")
41
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .add_property("ub",
42
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::make_function(&CoPSupport::get_ub,
43 10 bp::return_internal_reference<>()),
44 "inequality upper bound")
45
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .add_property("lb",
46
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::make_function(&CoPSupport::get_lb,
47 10 bp::return_internal_reference<>()),
48 "inequality lower bound")
49
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .add_property("R",
50
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::make_function(&CoPSupport::get_R,
51 bp::return_internal_reference<>()),
52
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::make_function(&CoPSupport::set_R), "rotation matrix")
53
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .add_property("box",
54
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 bp::make_function(&CoPSupport::get_box,
55 bp::return_internal_reference<>()),
56
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
20 bp::make_function(&CoPSupport::set_box),
57 "box size used to define the sole")
58
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def(CopyableVisitor<CoPSupport>())
59
1/2
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
10 .def(PrintableVisitor<CoPSupport>());
60
61 #pragma GCC diagnostic pop
62 10 }
63
64 } // namespace python
65 } // namespace crocoddyl
66