GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/multibody/cop-support-float.cpp
Date: 2025-04-18 16:41:15
Exec Total Coverage
Lines: 0 15 0.0%
Branches: 0 44 0.0%

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