| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////// | ||
| 2 | // BSD 3-Clause License | ||
| 3 | // | ||
| 4 | // Copyright (C) 2020-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/core/activations/smooth-2norm.hpp" | ||
| 12 | |||
| 13 | #include "python/crocoddyl/core/activation-base.hpp" | ||
| 14 | #include "python/crocoddyl/core/core.hpp" | ||
| 15 | |||
| 16 | namespace crocoddyl { | ||
| 17 | namespace python { | ||
| 18 | |||
| 19 | template <typename Model> | ||
| 20 | struct ActivationModelSmooth2NormVisitor | ||
| 21 | : public bp::def_visitor<ActivationModelSmooth2NormVisitor<Model>> { | ||
| 22 | typedef typename Model::Scalar Scalar; | ||
| 23 | template <class PyClass> | ||
| 24 | ✗ | void visit(PyClass& cl) const { | |
| 25 | ✗ | cl.def("calc", &Model::calc, bp::args("self", "data", "r"), | |
| 26 | "Compute the smooth-2norm function.\n\n" | ||
| 27 | ":param data: activation data\n" | ||
| 28 | ":param r: residual vector") | ||
| 29 | ✗ | .def("calcDiff", &Model::calcDiff, bp::args("self", "data", "r"), | |
| 30 | "Compute the derivatives of a smooth-2norm function.\n\n" | ||
| 31 | "It assumes that calc has been run first.\n" | ||
| 32 | ":param data: activation data\n" | ||
| 33 | ":param r: residual vector \n") | ||
| 34 | ✗ | .def("createData", &Model::createData, bp::args("self"), | |
| 35 | "Create the smooth-2norm activation data.\n\n"); | ||
| 36 | ✗ | } | |
| 37 | }; | ||
| 38 | |||
| 39 | #define CROCODDYL_ACTIVATION_MODEL_SMOOTH2NORM_PYTHON_BINDINGS(Scalar) \ | ||
| 40 | typedef ActivationModelSmooth2NormTpl<Scalar> Model; \ | ||
| 41 | typedef ActivationModelAbstractTpl<Scalar> ModelBase; \ | ||
| 42 | bp::register_ptr_to_python<std::shared_ptr<Model>>(); \ | ||
| 43 | bp::class_<Model, bp::bases<ModelBase>>( \ | ||
| 44 | "ActivationModelSmooth2Norm", \ | ||
| 45 | "Smooth-2Norm activation model.\n\n" \ | ||
| 46 | "It describes a smooth representation of a 2-norm, i.e., sqrt{eps + " \ | ||
| 47 | "sum^nr_{i=0} ||ri||^2}, where ri is the scalar residual for the i " \ | ||
| 48 | "constraints, and nr is the dimension of the residual vector.", \ | ||
| 49 | bp::init<std::size_t, bp::optional<Scalar>>( \ | ||
| 50 | bp::args("self", "nr", "eps"), \ | ||
| 51 | "Initialize the activation model.\n\n" \ | ||
| 52 | ":param nr: dimension of the residual vector\n" \ | ||
| 53 | ":param eps: smoothing factor (default: 1.)")) \ | ||
| 54 | .def(ActivationModelSmooth2NormVisitor<Model>()) \ | ||
| 55 | .def(CastVisitor<Model>()) \ | ||
| 56 | .def(PrintableVisitor<Model>()) \ | ||
| 57 | .def(CopyableVisitor<Model>()); | ||
| 58 | |||
| 59 | ✗ | void exposeActivationSmooth2Norm() { | |
| 60 | ✗ | CROCODDYL_ACTIVATION_MODEL_SMOOTH2NORM_PYTHON_BINDINGS(double) | |
| 61 | ✗ | } | |
| 62 | |||
| 63 | } // namespace python | ||
| 64 | } // namespace crocoddyl | ||
| 65 |