Directory: | ./ |
---|---|
File: | bindings/python/crocoddyl/multibody/actuations/full.cpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 16 | 16 | 100.0% |
Branches: | 13 | 26 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
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 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | bp::class_<ActuationModelFull, bp::bases<ActuationModelAbstract> >( |
23 | "ActuationModelFull", "Full actuation models.", | ||
24 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("calc", &ActuationModelFull::calc, |
29 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 | ":param u: joint torque input (dim. nu)") | ||
35 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("calcDiff", &ActuationModelFull::calcDiff, |
36 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 | ":param u: joint torque input (dim. nu)") | ||
47 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("commands", &ActuationModelFull::commands, |
48 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 | ":param tau: generalized torques (dim state.nv)") | ||
54 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def("torqueTransform", &ActuationModelFull::torqueTransform, |
55 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
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 | ":param tau: generalized torques (dim state.nv)") | ||
62 |
2/4✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
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 | ":return AM data.") | ||
68 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | .def(CopyableVisitor<ActuationModelFull>()); |
69 | 10 | } | |
70 | |||
71 | } // namespace python | ||
72 | } // namespace crocoddyl | ||
73 |