1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2023, 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 |
|
|
#include "crocoddyl/core/actuation/squashing/smooth-sat.hpp" |
11 |
|
|
|
12 |
|
|
#include "python/crocoddyl/core/actuation/squashing-base.hpp" |
13 |
|
|
#include "python/crocoddyl/core/core.hpp" |
14 |
|
|
#include "python/crocoddyl/utils/copyable.hpp" |
15 |
|
|
|
16 |
|
|
namespace crocoddyl { |
17 |
|
|
namespace python { |
18 |
|
|
|
19 |
|
10 |
void exposeSquashingSmoothSat() { |
20 |
|
10 |
bp::register_ptr_to_python<boost::shared_ptr<SquashingModelSmoothSat> >(); |
21 |
|
|
|
22 |
✓✗ |
10 |
bp::class_<SquashingModelSmoothSat, bp::bases<SquashingModelAbstract> >( |
23 |
|
|
"SquashingModelSmoothSat", "Smooth Sat squashing model", |
24 |
✓✗ |
10 |
bp::init<Eigen::VectorXd, Eigen::VectorXd, int>( |
25 |
|
20 |
bp::args("self", "u_lb", "u_ub", "ns"), |
26 |
|
|
"Initialize the squashing model. \n\n" |
27 |
|
|
":param u_lb: output lower bound" |
28 |
|
|
":param u_ub: output upper bound" |
29 |
|
|
":param ns: dimension of the input vector")) |
30 |
|
|
.def("calc", &SquashingModelSmoothSat::calc, |
31 |
✓✗ |
20 |
bp::args("self", "data", "s"), |
32 |
|
|
"Compute the squashing value for a given value of s, " |
33 |
|
|
"component-wise. \n\n" |
34 |
|
|
":param data: squashing data\n" |
35 |
✓✗ |
10 |
":param s: control input") |
36 |
|
|
.def("calcDiff", &SquashingModelSmoothSat::calcDiff, |
37 |
✓✗ |
20 |
bp::args("self", "data", "s"), |
38 |
|
|
"Compute the derivative of the squashing function.\n\n" |
39 |
|
|
":param data: squashing data\n" |
40 |
✓✗ |
10 |
":param s: squashing input.") |
41 |
✓✗ |
20 |
.def("createData", &SquashingModelSmoothSat::createData, bp::args("self"), |
42 |
✓✗ |
10 |
"Create the squashing data.\n\n") |
43 |
|
|
.add_property("smooth", |
44 |
✓✗ |
10 |
bp::make_function(&SquashingModelSmoothSat::get_smooth), |
45 |
✓✗ |
20 |
bp::make_function(&SquashingModelSmoothSat::set_smooth), |
46 |
✓✗ |
10 |
"Smoothness parameter of the smooth sat. function") |
47 |
✓✗ |
10 |
.def(CopyableVisitor<SquashingModelSmoothSat>()); |
48 |
|
10 |
} |
49 |
|
|
|
50 |
|
|
} // namespace python |
51 |
|
|
} // namespace crocoddyl |