| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /////////////////////////////////////////////////////////////////////////////// | ||
| 2 | // BSD 3-Clause License | ||
| 3 | // | ||
| 4 | // Copyright (C) 2019-2024, 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 | #ifndef CROCODDYL_ACTION_FACTORY_HPP_ | ||
| 11 | #define CROCODDYL_ACTION_FACTORY_HPP_ | ||
| 12 | |||
| 13 | #include <iterator> | ||
| 14 | |||
| 15 | #include "crocoddyl/core/action-base.hpp" | ||
| 16 | #include "crocoddyl/core/numdiff/action.hpp" | ||
| 17 | #include "crocoddyl/multibody/actions/impulse-fwddyn.hpp" | ||
| 18 | #include "state.hpp" | ||
| 19 | |||
| 20 | namespace crocoddyl { | ||
| 21 | namespace unittest { | ||
| 22 | |||
| 23 | struct ActionModelTypes { | ||
| 24 | enum Type { | ||
| 25 | ActionModelUnicycle, | ||
| 26 | ActionModelLQRDriftFree, | ||
| 27 | ActionModelLQR, | ||
| 28 | ActionModelRandomLQR, | ||
| 29 | ActionModelRandomLQRwithTerminalConstraint, | ||
| 30 | ActionModelImpulseFwdDynamics_HyQ, | ||
| 31 | ActionModelImpulseFwdDynamics_Talos, | ||
| 32 | NbActionModelTypes | ||
| 33 | }; | ||
| 34 | ✗ | static std::vector<Type> init_all() { | |
| 35 | ✗ | std::vector<Type> v; | |
| 36 | ✗ | v.reserve(NbActionModelTypes); | |
| 37 | ✗ | for (int i = 0; i < NbActionModelTypes; ++i) { | |
| 38 | ✗ | v.push_back((Type)i); | |
| 39 | } | ||
| 40 | ✗ | return v; | |
| 41 | ✗ | } | |
| 42 | static const std::vector<Type> all; | ||
| 43 | }; | ||
| 44 | |||
| 45 | std::ostream& operator<<(std::ostream& os, ActionModelTypes::Type type); | ||
| 46 | |||
| 47 | class ActionModelFactory { | ||
| 48 | public: | ||
| 49 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
| 50 | |||
| 51 | explicit ActionModelFactory(); | ||
| 52 | ~ActionModelFactory(); | ||
| 53 | |||
| 54 | enum Instance { First, Second, Terminal }; | ||
| 55 | |||
| 56 | std::shared_ptr<crocoddyl::ActionModelAbstract> create( | ||
| 57 | ActionModelTypes::Type type, Instance instance = Instance::First) const; | ||
| 58 | |||
| 59 | std::shared_ptr<crocoddyl::ActionModelImpulseFwdDynamics> | ||
| 60 | create_impulseFwdDynamics(StateModelTypes::Type state_type) const; | ||
| 61 | }; | ||
| 62 | |||
| 63 | } // namespace unittest | ||
| 64 | } // namespace crocoddyl | ||
| 65 | |||
| 66 | #endif // CROCODDYL_ACTION_FACTORY_HPP_ | ||
| 67 |