GCC Code Coverage Report


Directory: ./
File: bindings/python/crocoddyl/multibody/friction-cone-float.cpp
Date: 2025-04-18 16:41:15
Exec Total Coverage
Lines: 0 21 0.0%
Branches: 0 74 0.0%

Line Branch Exec Source
1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (C) 2019-2025, University of Edinburgh, University of Oxford,
5 // Heriot-Watt University
6 // Copyright note valid unless otherwise stated in individual files.
7 // All rights reserved.
8 ///////////////////////////////////////////////////////////////////////////////
9
10 // Auto-generated file for float
11 #include "crocoddyl/multibody/friction-cone.hpp"
12
13 #include "python/crocoddyl/multibody/multibody.hpp"
14 #include "python/crocoddyl/utils/deprecate.hpp"
15
16 namespace crocoddyl {
17 namespace python {
18
19 template <typename Model>
20 struct FrictionConeVisitor
21 : public bp::def_visitor<FrictionConeVisitor<Model>> {
22 typedef typename Model::Scalar Scalar;
23 typedef typename Model::Vector3s Vector3s;
24 template <class PyClass>
25 void visit(PyClass& cl) const {
26 cl.def(bp::init<>(bp::args("self"),
27 "Default initialization of the friction cone."))
28 .def("update", static_cast<void (Model::*)()>(&Model::update),
29 bp::args("self"),
30 "Update the linear inequality (matrix and bounds).\n\n"
31 "Run this function if you have changed one of the parameters.")
32 .def("update",
33 static_cast<void (Model::*)(const Vector3s&, const Scalar,
34 const bool, const Scalar,
35 const Scalar)>(&Model::update),
36 deprecated<>("Deprecated. Use update()."),
37 bp::args("self", "nsurf", "mu", "inner_appr", "min_nforce",
38 "max_nforce"),
39 "Update the linear inequality (matrix and bounds).\n\n"
40 ":param nsurf: surface normal vector (it defines the cone "
41 "orientation)\n"
42 ":param mu: friction coefficient\n"
43 ":param inner_appr: inner or outer approximation (default True)\n"
44 ":param min_nforce: minimum normal force (default 0.)\n"
45 ":param max_nforce: maximum normal force (default "
46 "sys.float_info.max)")
47 .add_property(
48 "A",
49 bp::make_function(&Model::get_A, bp::return_internal_reference<>()),
50 "inequality matrix")
51 .add_property("ub",
52 bp::make_function(&Model::get_ub,
53 bp::return_internal_reference<>()),
54 "inequality upper bound")
55 .add_property("lb",
56 bp::make_function(&Model::get_lb,
57 bp::return_internal_reference<>()),
58 "inequality lower bound")
59 .add_property(
60 "nf",
61 bp::make_function(&Model::get_nf,
62 bp::return_value_policy<bp::return_by_value>()),
63 "number of facets (run update() if you have changed the value)")
64 .add_property(
65 "R",
66 bp::make_function(&Model::get_R, bp::return_internal_reference<>()),
67 bp::make_function(&Model::set_R),
68 "rotation matrix that defines the cone orientation w.r.t. "
69 "the inertial frame (run update() if you "
70 "have changed the value)")
71 .add_property(
72 "mu", bp::make_function(&Model::get_mu),
73 bp::make_function(&Model::set_mu),
74 "friction coefficient (run update() if you have changed the value)")
75 .add_property("inner_appr", bp::make_function(&Model::get_inner_appr),
76 bp::make_function(&Model::set_inner_appr),
77 "type of cone approximation (run update() if you have "
78 "changed the value)")
79 .add_property(
80 "min_nforce", bp::make_function(&Model::get_min_nforce),
81 bp::make_function(&Model::set_min_nforce),
82 "minimum normal force (run update() if you have changed the value)")
83 .add_property("max_nforce", bp::make_function(&Model::get_max_nforce),
84 bp::make_function(&Model::set_max_nforce),
85 "maximum normal force (run update() if you have changed "
86 "the value)");
87 }
88 };
89
90 #define CROCODDYL_FRICTION_CONE_PYTHON_BINDINGS(Scalar) \
91 typedef FrictionConeTpl<Scalar> Model; \
92 typedef typename Model::Matrix3s Matrix3s; \
93 bp::register_ptr_to_python<std::shared_ptr<Model>>(); \
94 bp::class_<Model>( \
95 "FrictionCone", "Model of the friction cone as lb <= Af <= ub", \
96 bp::init<Matrix3s, Scalar, \
97 bp::optional<std::size_t, bool, Scalar, Scalar>>( \
98 bp::args("self", "R", "mu", "nf", "inner_appr", "min_nforce", \
99 "max_nforce"), \
100 "Initialize the linearize friction cone.\n\n" \
101 ":param R: rotation matrix that defines the cone orientation " \
102 "w.r.t. the inertial frame\n" \
103 ":param mu: friction coefficient\n" \
104 ":param nf: number of facets (default 4)\n" \
105 ":param inner_appr: inner or outer approximation (default True)\n" \
106 ":param min_nforce: minimum normal force (default 0.)\n" \
107 ":param max_nforce: maximum normal force (default " \
108 "sys.float_info.max)")) \
109 .def(FrictionConeVisitor<Model>()) \
110 .def(CastVisitor<Model>()) \
111 .def(PrintableVisitor<Model>()) \
112 .def(CopyableVisitor<Model>());
113
114 void exposeFrictionCone() {
115 #pragma GCC diagnostic push // TODO: Remove once the deprecated update call has
116 // been removed in a future release
117 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
118
119 CROCODDYL_FRICTION_CONE_PYTHON_BINDINGS(float)
120
121 #pragma GCC diagnostic pop
122 }
123
124 } // namespace python
125 } // namespace crocoddyl
126