| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////// | ||
| 2 | // BSD 3-Clause License | ||
| 3 | // | ||
| 4 | // Copyright (C) 2019-2024, University of Edinburgh, CTU, INRIA, | ||
| 5 | // Heriot-Watt University | ||
| 6 | // Copyright note valid unless otherwise stated in individual files. | ||
| 7 | // All rights reserved. | ||
| 8 | /////////////////////////////////////////////////////////////////////////////// | ||
| 9 | |||
| 10 | #ifndef CROCODDYL_DIFF_ACTION_FACTORY_HPP_ | ||
| 11 | #define CROCODDYL_DIFF_ACTION_FACTORY_HPP_ | ||
| 12 | |||
| 13 | #include "actuation.hpp" | ||
| 14 | #include "constraint.hpp" | ||
| 15 | #include "contact.hpp" | ||
| 16 | #include "cost.hpp" | ||
| 17 | #include "crocoddyl/core/diff-action-base.hpp" | ||
| 18 | #include "crocoddyl/core/numdiff/diff-action.hpp" | ||
| 19 | #include "crocoddyl/multibody/actions/contact-fwddyn.hpp" | ||
| 20 | #include "crocoddyl/multibody/actions/contact-invdyn.hpp" | ||
| 21 | #include "crocoddyl/multibody/actions/free-fwddyn.hpp" | ||
| 22 | #include "crocoddyl/multibody/actions/free-invdyn.hpp" | ||
| 23 | #include "state.hpp" | ||
| 24 | |||
| 25 | namespace crocoddyl { | ||
| 26 | namespace unittest { | ||
| 27 | |||
| 28 | struct DifferentialActionModelTypes { | ||
| 29 | enum Type { | ||
| 30 | DifferentialActionModelLQR, | ||
| 31 | DifferentialActionModelLQRDriftFree, | ||
| 32 | DifferentialActionModelRandomLQR, | ||
| 33 | DifferentialActionModelFreeFwdDynamics_Hector, | ||
| 34 | DifferentialActionModelFreeFwdDynamics_TalosArm, | ||
| 35 | DifferentialActionModelFreeFwdDynamics_TalosArm_Squashed, | ||
| 36 | DifferentialActionModelFreeInvDynamics_Hector, | ||
| 37 | DifferentialActionModelFreeInvDynamics_TalosArm, | ||
| 38 | DifferentialActionModelFreeInvDynamics_TalosArm_Squashed, | ||
| 39 | DifferentialActionModelContactFwdDynamics_TalosArm, | ||
| 40 | DifferentialActionModelContact2DFwdDynamics_TalosArm, | ||
| 41 | DifferentialActionModelContactFwdDynamics_HyQ, | ||
| 42 | DifferentialActionModelContactFwdDynamics_Talos, | ||
| 43 | DifferentialActionModelContactFwdDynamicsWithFriction_TalosArm, | ||
| 44 | DifferentialActionModelContact2DFwdDynamicsWithFriction_TalosArm, | ||
| 45 | DifferentialActionModelContactFwdDynamicsWithFriction_HyQ, | ||
| 46 | DifferentialActionModelContactFwdDynamicsWithFriction_Talos, | ||
| 47 | DifferentialActionModelContactInvDynamics_TalosArm, | ||
| 48 | DifferentialActionModelContactInvDynamics_HyQ, | ||
| 49 | DifferentialActionModelContactInvDynamics_Talos, | ||
| 50 | DifferentialActionModelContactInvDynamicsWithFriction_TalosArm, | ||
| 51 | DifferentialActionModelContactInvDynamicsWithFriction_HyQ, | ||
| 52 | DifferentialActionModelContactInvDynamicsWithFriction_Talos, | ||
| 53 | NbDifferentialActionModelTypes | ||
| 54 | }; | ||
| 55 | ✗ | static std::vector<Type> init_all() { | |
| 56 | ✗ | std::vector<Type> v; | |
| 57 | ✗ | v.reserve(NbDifferentialActionModelTypes); | |
| 58 | ✗ | for (int i = 0; i < NbDifferentialActionModelTypes; ++i) { | |
| 59 | ✗ | v.push_back((Type)i); | |
| 60 | } | ||
| 61 | ✗ | return v; | |
| 62 | ✗ | } | |
| 63 | static const std::vector<Type> all; | ||
| 64 | }; | ||
| 65 | |||
| 66 | std::ostream& operator<<(std::ostream& os, | ||
| 67 | DifferentialActionModelTypes::Type type); | ||
| 68 | |||
| 69 | class DifferentialActionModelFactory { | ||
| 70 | public: | ||
| 71 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
| 72 | |||
| 73 | explicit DifferentialActionModelFactory(); | ||
| 74 | ~DifferentialActionModelFactory(); | ||
| 75 | |||
| 76 | std::shared_ptr<crocoddyl::DifferentialActionModelAbstract> create( | ||
| 77 | DifferentialActionModelTypes::Type type, | ||
| 78 | bool with_baumgarte = true) const; | ||
| 79 | |||
| 80 | std::shared_ptr<crocoddyl::DifferentialActionModelFreeFwdDynamics> | ||
| 81 | create_freeFwdDynamics(StateModelTypes::Type state_type, | ||
| 82 | ActuationModelTypes::Type actuation_type, | ||
| 83 | bool constraints = true) const; | ||
| 84 | |||
| 85 | std::shared_ptr<crocoddyl::DifferentialActionModelFreeInvDynamics> | ||
| 86 | create_freeInvDynamics(StateModelTypes::Type state_type, | ||
| 87 | ActuationModelTypes::Type actuation_type, | ||
| 88 | bool constraints = true) const; | ||
| 89 | |||
| 90 | std::shared_ptr<crocoddyl::DifferentialActionModelContactFwdDynamics> | ||
| 91 | create_contactFwdDynamics(StateModelTypes::Type state_type, | ||
| 92 | ActuationModelTypes::Type actuation_type, | ||
| 93 | bool with_friction = true, | ||
| 94 | bool with_baumgarte = true) const; | ||
| 95 | |||
| 96 | std::shared_ptr<crocoddyl::DifferentialActionModelContactInvDynamics> | ||
| 97 | create_contactInvDynamics(StateModelTypes::Type state_type, | ||
| 98 | ActuationModelTypes::Type actuation_type, | ||
| 99 | bool with_friction = true, | ||
| 100 | bool with_baumgarte = true) const; | ||
| 101 | }; | ||
| 102 | |||
| 103 | } // namespace unittest | ||
| 104 | } // namespace crocoddyl | ||
| 105 | |||
| 106 | #endif // CROCODDYL_DIFF_ACTION_FACTORY_HPP_ | ||
| 107 |