Directory: | ./ |
---|---|
File: | bindings/python/crocoddyl/core/actuation/squashing/smooth-sat.cpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 15 | 15 | 100.0% |
Branches: | 12 | 24 | 50.0% |
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 | #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 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::class_<SquashingModelSmoothSat, bp::bases<SquashingModelAbstract> >( |
23 | "SquashingModelSmoothSat", "Smooth Sat squashing model", | ||
24 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::init<Eigen::VectorXd, Eigen::VectorXd, std::size_t>( |
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 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("calc", &SquashingModelSmoothSat::calc, |
31 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 | ":param s: control input") | ||
36 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("calcDiff", &SquashingModelSmoothSat::calcDiff, |
37 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::args("self", "data", "s"), |
38 | "Compute the derivative of the squashing function.\n\n" | ||
39 | ":param data: squashing data\n" | ||
40 | ":param s: squashing input.") | ||
41 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
20 | .def("createData", &SquashingModelSmoothSat::createData, bp::args("self"), |
42 | "Create the squashing data.\n\n") | ||
43 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .add_property("smooth", |
44 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::make_function(&SquashingModelSmoothSat::get_smooth), |
45 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
20 | bp::make_function(&SquashingModelSmoothSat::set_smooth), |
46 | "Smoothness parameter of the smooth sat. function") | ||
47 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def(CopyableVisitor<SquashingModelSmoothSat>()); |
48 | 10 | } | |
49 | |||
50 | } // namespace python | ||
51 | } // namespace crocoddyl | ||
52 |