| 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 double | ||
| 11 | #include "crocoddyl/multibody/actuations/floating-base.hpp" | ||
| 12 | |||
| 13 | #include "python/crocoddyl/multibody/multibody.hpp" | ||
| 14 | |||
| 15 | namespace crocoddyl { | ||
| 16 | namespace python { | ||
| 17 | |||
| 18 | template <typename Model> | ||
| 19 | struct ActuationModelFloatingBaseVisitor | ||
| 20 | : public bp::def_visitor<ActuationModelFloatingBaseVisitor<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 floating-base actuation signal and actuation set from " | ||
| 25 | "the joint torque input u.\n\n" | ||
| 26 | "It describes the time-continuos evolution of the floating-base " | ||
| 27 | "actuation model.\n" | ||
| 28 | ":param data: floating-base actuation data\n" | ||
| 29 | ":param x: state point (dim. state.nx)\n" | ||
| 30 | ":param u: joint-torque input (dim. nu)") | ||
| 31 | ✗ | .def("calcDiff", &Model::calcDiff, bp::args("self", "data", "x", "u"), | |
| 32 | "Compute the Jacobians of the floating-base actuation model.\n\n" | ||
| 33 | "It computes the partial derivatives of the floating-base " | ||
| 34 | "actuation. It assumes that calc\n" | ||
| 35 | "has been run first. The reason is that the derivatives are " | ||
| 36 | "constant and defined in createData. The derivatives are " | ||
| 37 | "constant, so we don't write again these values.\n" | ||
| 38 | ":param data: floating-base actuation data\n" | ||
| 39 | ":param x: state point (dim. state.nx)\n" | ||
| 40 | ":param u: joint-torque input (dim. nu)") | ||
| 41 | ✗ | .def("commands", &Model::commands, bp::args("self", "data", "x", "tau"), | |
| 42 | "Compute the joint-torque commands from the generalized " | ||
| 43 | "torques.\n\n" | ||
| 44 | "It stores the results in data.u.\n" | ||
| 45 | ":param data: actuation data\n" | ||
| 46 | ":param x: state point (dim. state.nx)\n" | ||
| 47 | ":param tau: generalized torques (dim state.nv)") | ||
| 48 | ✗ | .def("torqueTransform", &Model::torqueTransform, | |
| 49 | bp::args("self", "data", "x", "tau"), | ||
| 50 | "Compute the torque transform from generalized torques to " | ||
| 51 | "joint-torque inputs.\n\n" | ||
| 52 | "It stores the results in data.Mtau.\n" | ||
| 53 | ":param data: actuation data\n" | ||
| 54 | ":param x: state point (dim. state.nx)\n" | ||
| 55 | ":param tau: generalized torques (dim state.nv)") | ||
| 56 | ✗ | .def("createData", &Model::createData, bp::args("self"), | |
| 57 | "Create the floating-base actuation data.\n\n" | ||
| 58 | "Each actuation model (AM) has its own data that needs to be " | ||
| 59 | "allocated.\n" | ||
| 60 | "This function returns the allocated data for a predefined AM.\n" | ||
| 61 | ":return AM data."); | ||
| 62 | ✗ | } | |
| 63 | }; | ||
| 64 | |||
| 65 | #define CROCODDYL_ACTUATION_MODEL_FLOATINGBASE_PYTHON_BINDINGS(Scalar) \ | ||
| 66 | typedef ActuationModelFloatingBaseTpl<Scalar> Model; \ | ||
| 67 | typedef ActuationModelAbstractTpl<Scalar> ModelBase; \ | ||
| 68 | typedef StateMultibodyTpl<Scalar> StateMultibody; \ | ||
| 69 | bp::register_ptr_to_python<std::shared_ptr<Model>>(); \ | ||
| 70 | bp::class_<Model, bp::bases<ModelBase>>( \ | ||
| 71 | "ActuationModelFloatingBase", \ | ||
| 72 | "Floating-base actuation models.\n\n" \ | ||
| 73 | "It considers the first joint, defined in the Pinocchio model, as the " \ | ||
| 74 | "floating-base joints. Then, this joint (that might have various DoFs) " \ | ||
| 75 | "is unactuated.", \ | ||
| 76 | bp::init<std::shared_ptr<StateMultibody>>( \ | ||
| 77 | bp::args("self", "state"), \ | ||
| 78 | "Initialize the floating-base actuation model.\n\n" \ | ||
| 79 | ":param state: state of multibody system")) \ | ||
| 80 | .def(ActuationModelFloatingBaseVisitor<Model>()) \ | ||
| 81 | .def(CastVisitor<Model>()) \ | ||
| 82 | .def(PrintableVisitor<Model>()) \ | ||
| 83 | .def(CopyableVisitor<Model>()); | ||
| 84 | |||
| 85 | ✗ | void exposeActuationFloatingBase() { | |
| 86 | ✗ | CROCODDYL_ACTUATION_MODEL_FLOATINGBASE_PYTHON_BINDINGS(double) | |
| 87 | ✗ | } | |
| 88 | |||
| 89 | } // namespace python | ||
| 90 | } // namespace crocoddyl | ||
| 91 |