1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2023, LAAS-CNRS, University of Edinburgh |
5 |
|
|
// Heriot-Watt University |
6 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
7 |
|
|
// All rights reserved. |
8 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
9 |
|
|
|
10 |
|
|
#include "crocoddyl/multibody/actuations/full.hpp" |
11 |
|
|
|
12 |
|
|
#include "python/crocoddyl/multibody/multibody.hpp" |
13 |
|
|
#include "python/crocoddyl/utils/copyable.hpp" |
14 |
|
|
|
15 |
|
|
namespace crocoddyl { |
16 |
|
|
namespace python { |
17 |
|
|
|
18 |
|
10 |
void exposeActuationFull() { |
19 |
|
|
bp::register_ptr_to_python< |
20 |
|
10 |
boost::shared_ptr<crocoddyl::ActuationModelFull> >(); |
21 |
|
|
|
22 |
✓✗ |
10 |
bp::class_<ActuationModelFull, bp::bases<ActuationModelAbstract> >( |
23 |
|
|
"ActuationModelFull", "Full actuation models.", |
24 |
✓✗ |
10 |
bp::init<boost::shared_ptr<StateAbstract> >( |
25 |
|
20 |
bp::args("self", "state"), |
26 |
|
|
"Initialize the full actuation model.\n\n" |
27 |
|
|
":param state: state of dynamical system")) |
28 |
|
|
.def("calc", &ActuationModelFull::calc, |
29 |
✓✗ |
20 |
bp::args("self", "data", "x", "u"), |
30 |
|
|
"Compute the actuation signal and actuation set from the joint " |
31 |
|
|
"torque input u.\n\n" |
32 |
|
|
":param data: full actuation data\n" |
33 |
|
|
":param x: state point (dim. state.nx)\n" |
34 |
✓✗ |
10 |
":param u: joint torque input (dim. nu)") |
35 |
|
|
.def("calcDiff", &ActuationModelFull::calcDiff, |
36 |
✓✗ |
20 |
bp::args("self", "data", "x", "u"), |
37 |
|
|
"Compute the derivatives of the actuation model.\n\n" |
38 |
|
|
"It computes the partial derivatives of the full actuation. It " |
39 |
|
|
"assumes that calc\n" |
40 |
|
|
"has been run first. The reason is that the derivatives are " |
41 |
|
|
"constant and\n" |
42 |
|
|
"defined in createData. The Hessian is constant, so we don't write " |
43 |
|
|
"again this value.\n" |
44 |
|
|
":param data: full actuation data\n" |
45 |
|
|
":param x: state point (dim. state.nx)\n" |
46 |
✓✗ |
10 |
":param u: joint torque input (dim. nu)") |
47 |
|
|
.def("commands", &ActuationModelFull::commands, |
48 |
✓✗ |
20 |
bp::args("self", "data", "x", "tau"), |
49 |
|
|
"Compute the joint torque commands from the generalized torques.\n\n" |
50 |
|
|
"It stores the results in data.u.\n" |
51 |
|
|
":param data: actuation data\n" |
52 |
|
|
":param x: state point (dim. state.nx)\n" |
53 |
✓✗ |
10 |
":param tau: generalized torques (dim state.nv)") |
54 |
|
|
.def("torqueTransform", &ActuationModelFull::torqueTransform, |
55 |
✓✗ |
20 |
bp::args("self", "data", "x", "tau"), |
56 |
|
|
"Compute the torque transform from generalized torques to joint " |
57 |
|
|
"torque inputs.\n\n" |
58 |
|
|
"It stores the results in data.Mtau.\n" |
59 |
|
|
":param data: actuation data\n" |
60 |
|
|
":param x: state point (dim. state.nx)\n" |
61 |
✓✗ |
10 |
":param tau: generalized torques (dim state.nv)") |
62 |
✓✗ |
20 |
.def("createData", &ActuationModelFull::createData, bp::args("self"), |
63 |
|
|
"Create the full actuation data.\n\n" |
64 |
|
|
"Each actuation model (AM) has its own data that needs to be " |
65 |
|
|
"allocated.\n" |
66 |
|
|
"This function returns the allocated data for a predefined AM.\n" |
67 |
✓✗ |
10 |
":return AM data.") |
68 |
✓✗ |
10 |
.def(CopyableVisitor<ActuationModelFull>()); |
69 |
|
10 |
} |
70 |
|
|
|
71 |
|
|
} // namespace python |
72 |
|
|
} // namespace crocoddyl |