| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////// | ||
| 2 | // BSD 3-Clause License | ||
| 3 | // | ||
| 4 | // Copyright (C) 2022-2025, University of Edinburgh, Heriot-Watt University | ||
| 5 | // Copyright note valid unless otherwise stated in individual files. | ||
| 6 | // All rights reserved. | ||
| 7 | /////////////////////////////////////////////////////////////////////////////// | ||
| 8 | |||
| 9 | // Auto-generated file for double | ||
| 10 | #include "crocoddyl/core/data/joint.hpp" | ||
| 11 | |||
| 12 | #include "python/crocoddyl/core/core.hpp" | ||
| 13 | |||
| 14 | namespace crocoddyl { | ||
| 15 | namespace python { | ||
| 16 | |||
| 17 | template <typename Data> | ||
| 18 | struct JointDataAbstractVisitor | ||
| 19 | : public bp::def_visitor<JointDataAbstractVisitor<Data>> { | ||
| 20 | template <class PyClass> | ||
| 21 | ✗ | void visit(PyClass& cl) const { | |
| 22 | ✗ | cl.add_property( | |
| 23 | ✗ | "tau", bp::make_getter(&Data::tau, bp::return_internal_reference<>()), | |
| 24 | ✗ | bp::make_setter(&Data::tau), "joint efforts") | |
| 25 | ✗ | .add_property( | |
| 26 | ✗ | "a", bp::make_getter(&Data::a, bp::return_internal_reference<>()), | |
| 27 | ✗ | bp::make_setter(&Data::a), "generalized joint accelerations") | |
| 28 | ✗ | .add_property( | |
| 29 | "dtau_dx", | ||
| 30 | ✗ | bp::make_getter(&Data::dtau_dx, bp::return_internal_reference<>()), | |
| 31 | ✗ | bp::make_setter(&Data::dtau_dx), | |
| 32 | "partial derivatives of the joint efforts w.r.t. the state point") | ||
| 33 | ✗ | .add_property( | |
| 34 | "dtau_du", | ||
| 35 | ✗ | bp::make_getter(&Data::dtau_du, bp::return_internal_reference<>()), | |
| 36 | ✗ | bp::make_setter(&Data::dtau_du), | |
| 37 | "partial derivatives of the joint efforts w.r.t. the control input") | ||
| 38 | ✗ | .add_property( | |
| 39 | "da_dx", | ||
| 40 | ✗ | bp::make_getter(&Data::da_dx, bp::return_internal_reference<>()), | |
| 41 | ✗ | bp::make_setter(&Data::da_dx), | |
| 42 | "partial derivatives of the generalized joint accelerations w.r.t. " | ||
| 43 | "the state point") | ||
| 44 | ✗ | .add_property( | |
| 45 | "da_du", | ||
| 46 | ✗ | bp::make_getter(&Data::da_du, bp::return_internal_reference<>()), | |
| 47 | ✗ | bp::make_setter(&Data::da_du), | |
| 48 | "partial derivatives of the generalized joint accelerations w.r.t. " | ||
| 49 | "the control input"); | ||
| 50 | ✗ | } | |
| 51 | }; | ||
| 52 | |||
| 53 | template <typename Data> | ||
| 54 | struct DataCollectorJointVisitor | ||
| 55 | : public bp::def_visitor<DataCollectorJointVisitor<Data>> { | ||
| 56 | template <class PyClass> | ||
| 57 | ✗ | void visit(PyClass& cl) const { | |
| 58 | ✗ | cl.add_property( | |
| 59 | "joint", | ||
| 60 | ✗ | bp::make_getter(&Data::joint, | |
| 61 | ✗ | bp::return_value_policy<bp::return_by_value>()), | |
| 62 | "joint data"); | ||
| 63 | ✗ | } | |
| 64 | }; | ||
| 65 | |||
| 66 | #define CROCODDYL_JOINT_DATA_ABSTRACT_PYTHON_BINDINGS(Scalar) \ | ||
| 67 | typedef JointDataAbstractTpl<Scalar> JointData; \ | ||
| 68 | typedef typename JointData::StateAbstract State; \ | ||
| 69 | typedef typename JointData::ActuationModelAbstract Actuation; \ | ||
| 70 | bp::register_ptr_to_python<std::shared_ptr<JointData>>(); \ | ||
| 71 | bp::class_<JointData>( \ | ||
| 72 | "JointDataAbstract", \ | ||
| 73 | "Abstract class for joint datas.\n\n" \ | ||
| 74 | "A joint data contains all the required information about joint " \ | ||
| 75 | "efforts and accelerations. The joint data typically is allocated once " \ | ||
| 76 | "by running model.createData().", \ | ||
| 77 | bp::init<std::shared_ptr<State>, std::shared_ptr<Actuation>, \ | ||
| 78 | std::size_t>( \ | ||
| 79 | bp::args("self", "state", "actuation", "nu"), \ | ||
| 80 | "Create the joint data.\n\n" \ | ||
| 81 | "The joint data uses the model in order to first process it.\n" \ | ||
| 82 | ":param state: state description\n" \ | ||
| 83 | ":param actuation: actuation model\n" \ | ||
| 84 | ":param nu: dimension of control vector.")) \ | ||
| 85 | .def(JointDataAbstractVisitor<JointData>()) \ | ||
| 86 | .def(CopyableVisitor<JointData>()); | ||
| 87 | |||
| 88 | #define CROCODDYL_DATA_COLLECTOR_JOINT_PYTHON_BINDINGS(Scalar) \ | ||
| 89 | typedef DataCollectorJointTpl<Scalar> Data; \ | ||
| 90 | typedef DataCollectorAbstractTpl<Scalar> DataBase; \ | ||
| 91 | typedef JointDataAbstractTpl<Scalar> JointData; \ | ||
| 92 | bp::register_ptr_to_python<std::shared_ptr<Data>>(); \ | ||
| 93 | bp::class_<Data, bp::bases<DataBase>>( \ | ||
| 94 | "DataCollectorJoint", "Joint data collector.\n\n", \ | ||
| 95 | bp::init<std::shared_ptr<JointData>>(bp::args("self", "joint"), \ | ||
| 96 | "Create joint data collection.\n\n" \ | ||
| 97 | ":param joint: joint data")) \ | ||
| 98 | .def(DataCollectorJointVisitor<Data>()) \ | ||
| 99 | .def(CopyableVisitor<Data>()); | ||
| 100 | |||
| 101 | #define CROCODDYL_DATA_COLLECTOR_ACTUATION_PYTHON_BINDINGS(Scalar) \ | ||
| 102 | typedef DataCollectorJointActuationTpl<Scalar> AData; \ | ||
| 103 | typedef DataCollectorActuationTpl<Scalar> ADataBase; \ | ||
| 104 | typedef ActuationDataAbstractTpl<Scalar> ActuationData; \ | ||
| 105 | typedef JointDataAbstractTpl<Scalar> JointData; \ | ||
| 106 | bp::register_ptr_to_python<std::shared_ptr<AData>>(); \ | ||
| 107 | bp::class_<AData, bp::bases<ADataBase>>( \ | ||
| 108 | "DataCollectorJointActuation", "Joint-actuation data collector.\n\n", \ | ||
| 109 | bp::init<std::shared_ptr<ActuationData>, std::shared_ptr<JointData>>( \ | ||
| 110 | bp::args("self", "actuation", "joint"), \ | ||
| 111 | "Create joint-actuation data collection.\n\n" \ | ||
| 112 | ":param actuation: actuation data" \ | ||
| 113 | ":param joint: joint data")) \ | ||
| 114 | .def(CopyableVisitor<AData>()); | ||
| 115 | |||
| 116 | ✗ | void exposeDataCollectorJoint() { | |
| 117 | ✗ | CROCODDYL_JOINT_DATA_ABSTRACT_PYTHON_BINDINGS(double) | |
| 118 | ✗ | CROCODDYL_DATA_COLLECTOR_JOINT_PYTHON_BINDINGS(double) | |
| 119 | ✗ | CROCODDYL_DATA_COLLECTOR_ACTUATION_PYTHON_BINDINGS(double) | |
| 120 | ✗ | } | |
| 121 | |||
| 122 | } // namespace python | ||
| 123 | } // namespace crocoddyl | ||
| 124 |