Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2024, University of Edinburgh, IRI: CSIC-UPC |
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/core/actuation/squashing/smooth-sat.hpp" |
12 |
|
|
|
13 |
|
|
#include "python/crocoddyl/core/actuation/squashing-base.hpp" |
14 |
|
|
#include "python/crocoddyl/core/core.hpp" |
15 |
|
|
#include "python/crocoddyl/utils/copyable.hpp" |
16 |
|
|
|
17 |
|
|
namespace crocoddyl { |
18 |
|
|
namespace python { |
19 |
|
|
|
20 |
|
|
template <typename Model> |
21 |
|
|
struct SquashingSmoothSatVisitor |
22 |
|
|
: public bp::def_visitor<SquashingSmoothSatVisitor<Model>> { |
23 |
|
|
template <class PyClass> |
24 |
|
✗ |
void visit(PyClass& cl) const { |
25 |
|
✗ |
cl.def("calc", &Model::calc, bp::args("self", "data", "s"), |
26 |
|
|
"Compute the squashing value for a given value of s, " |
27 |
|
|
"component-wise. \n\n" |
28 |
|
|
":param data: squashing data\n" |
29 |
|
|
":param s: control input") |
30 |
|
✗ |
.def("calcDiff", &Model::calcDiff, bp::args("self", "data", "s"), |
31 |
|
|
"Compute the derivative of the squashing function.\n\n" |
32 |
|
|
":param data: squashing data\n" |
33 |
|
|
":param s: squashing input.") |
34 |
|
✗ |
.def("createData", &Model::createData, bp::args("self"), |
35 |
|
|
"Create the squashing data.\n\n") |
36 |
|
✗ |
.add_property("smooth", bp::make_function(&Model::get_smooth), |
37 |
|
|
bp::make_function(&Model::set_smooth), |
38 |
|
|
"Smoothness parameter of the smooth sat. function"); |
39 |
|
|
} |
40 |
|
|
}; |
41 |
|
|
|
42 |
|
|
#define CROCODDYL_SQUASHING_SMOOTH_SAT_PYTHON_BINDINGS(Scalar) \ |
43 |
|
|
typedef SquashingModelSmoothSatTpl<Scalar> Model; \ |
44 |
|
|
typedef SquashingModelAbstractTpl<Scalar> ModelBase; \ |
45 |
|
|
typedef Model::VectorXs VectorXs; \ |
46 |
|
|
bp::register_ptr_to_python<std::shared_ptr<Model>>(); \ |
47 |
|
|
bp::class_<Model, bp::bases<ModelBase>>( \ |
48 |
|
|
"SquashingModelSmoothSat", "Smooth Sat squashing model", \ |
49 |
|
|
bp::init<VectorXs, VectorXs, std::size_t>( \ |
50 |
|
|
bp::args("self", "u_lb", "u_ub", "ns"), \ |
51 |
|
|
"Initialize the squashing model.\n\n" \ |
52 |
|
|
":param u_lb: output lower bound\n" \ |
53 |
|
|
":param u_ub: output upper bound\n" \ |
54 |
|
|
":param ns: dimension of the input vector")) \ |
55 |
|
|
.def(SquashingSmoothSatVisitor<Model>()) \ |
56 |
|
|
.def(CastVisitor<Model>()) \ |
57 |
|
|
.def(PrintableVisitor<Model>()) \ |
58 |
|
|
.def(CopyableVisitor<Model>()); |
59 |
|
|
|
60 |
|
✗ |
void exposeSquashingSmoothSat() { |
61 |
|
✗ |
CROCODDYL_SQUASHING_SMOOTH_SAT_PYTHON_BINDINGS(float) |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
} // namespace python |
65 |
|
|
} // namespace crocoddyl |
66 |
|
|
|