Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2025, 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 |
|
|
// Auto-generated file for float |
11 |
|
|
#include "crocoddyl/multibody/actuations/full.hpp" |
12 |
|
|
|
13 |
|
|
#include "python/crocoddyl/multibody/multibody.hpp" |
14 |
|
|
|
15 |
|
|
namespace crocoddyl { |
16 |
|
|
namespace python { |
17 |
|
|
|
18 |
|
|
template <typename Model> |
19 |
|
|
struct ActuationModelFullBaseVisitor |
20 |
|
|
: public bp::def_visitor<ActuationModelFullBaseVisitor<Model>> { |
21 |
|
|
template <class PyClass> |
22 |
|
✗ |
void visit(PyClass& cl) const { |
23 |
|
✗ |
cl.def("calc", &Model::calc, bp::args("self", "data", "x", "u"), |
24 |
|
|
"Compute the actuation signal and actuation set from the joint " |
25 |
|
|
"torque input u.\n\n" |
26 |
|
|
":param data: full actuation data\n" |
27 |
|
|
":param x: state point (dim. state.nx)\n" |
28 |
|
|
":param u: joint torque input (dim. nu)") |
29 |
|
✗ |
.def("calcDiff", &Model::calcDiff, bp::args("self", "data", "x", "u"), |
30 |
|
|
"Compute the derivatives of the actuation model.\n\n" |
31 |
|
|
"It computes the partial derivatives of the full actuation. It " |
32 |
|
|
"assumes that calc has been run first. The reason is that the " |
33 |
|
|
"derivatives are constant and defined in createData. The Hessian " |
34 |
|
|
"is constant, so we don't write again this value.\n" |
35 |
|
|
":param data: full actuation data\n" |
36 |
|
|
":param x: state point (dim. state.nx)\n" |
37 |
|
|
":param u: joint torque input (dim. nu)") |
38 |
|
✗ |
.def("commands", &Model::commands, bp::args("self", "data", "x", "tau"), |
39 |
|
|
"Compute the joint torque commands from the generalized " |
40 |
|
|
"torques.\n\n" |
41 |
|
|
"It stores the results in data.u.\n" |
42 |
|
|
":param data: actuation data\n" |
43 |
|
|
":param x: state point (dim. state.nx)\n" |
44 |
|
|
":param tau: generalized torques (dim state.nv)") |
45 |
|
✗ |
.def("torqueTransform", &Model::torqueTransform, |
46 |
|
|
bp::args("self", "data", "x", "tau"), |
47 |
|
|
"Compute the torque transform from generalized torques to joint " |
48 |
|
|
"torque inputs.\n\n" |
49 |
|
|
"It stores the results in data.Mtau.\n" |
50 |
|
|
":param data: actuation data\n" |
51 |
|
|
":param x: state point (dim. state.nx)\n" |
52 |
|
|
":param tau: generalized torques (dim state.nv)") |
53 |
|
✗ |
.def("createData", &Model::createData, bp::args("self"), |
54 |
|
|
"Create the full actuation data.\n\n" |
55 |
|
|
"Each actuation model (AM) has its own data that needs to be " |
56 |
|
|
"allocated.\n" |
57 |
|
|
"This function returns the allocated data for a predefined AM.\n" |
58 |
|
|
":return AM data."); |
59 |
|
|
} |
60 |
|
|
}; |
61 |
|
|
|
62 |
|
|
#define CROCODDYL_ACTUATION_MODEL_FULL_PYTHON_BINDINGS(Scalar) \ |
63 |
|
|
typedef ActuationModelFullTpl<Scalar> Model; \ |
64 |
|
|
typedef ActuationModelAbstractTpl<Scalar> ModelBase; \ |
65 |
|
|
typedef StateAbstractTpl<Scalar> StateAbstract; \ |
66 |
|
|
bp::register_ptr_to_python<std::shared_ptr<Model>>(); \ |
67 |
|
|
bp::class_<Model, bp::bases<ModelBase>>( \ |
68 |
|
|
"ActuationModelFull", "Full actuation models.", \ |
69 |
|
|
bp::init<std::shared_ptr<StateAbstract>>( \ |
70 |
|
|
bp::args("self", "state"), \ |
71 |
|
|
"Initialize the full actuation model.\n\n" \ |
72 |
|
|
":param state: state of dynamical system")) \ |
73 |
|
|
.def(ActuationModelFullBaseVisitor<Model>()) \ |
74 |
|
|
.def(CastVisitor<Model>()) \ |
75 |
|
|
.def(PrintableVisitor<Model>()) \ |
76 |
|
|
.def(CopyableVisitor<Model>()); |
77 |
|
|
|
78 |
|
✗ |
void exposeActuationFull() { |
79 |
|
✗ |
CROCODDYL_ACTUATION_MODEL_FULL_PYTHON_BINDINGS(float) |
80 |
|
|
} |
81 |
|
|
|
82 |
|
|
} // namespace python |
83 |
|
|
} // namespace crocoddyl |
84 |
|
|
|