1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2020, LAAS-CNRS, University of Edinburgh |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef CROCODDYL_ACTION_FACTORY_HPP_ |
10 |
|
|
#define CROCODDYL_ACTION_FACTORY_HPP_ |
11 |
|
|
|
12 |
|
|
#include <iterator> |
13 |
|
|
|
14 |
|
|
#include "crocoddyl/core/action-base.hpp" |
15 |
|
|
#include "crocoddyl/core/numdiff/action.hpp" |
16 |
|
|
#include "crocoddyl/multibody/actions/impulse-fwddyn.hpp" |
17 |
|
|
#include "state.hpp" |
18 |
|
|
|
19 |
|
|
namespace crocoddyl { |
20 |
|
|
namespace unittest { |
21 |
|
|
|
22 |
|
|
struct ActionModelTypes { |
23 |
|
|
enum Type { |
24 |
|
|
ActionModelUnicycle, |
25 |
|
|
ActionModelLQRDriftFree, |
26 |
|
|
ActionModelLQR, |
27 |
|
|
ActionModelImpulseFwdDynamics_HyQ, |
28 |
|
|
ActionModelImpulseFwdDynamics_Talos, |
29 |
|
|
NbActionModelTypes |
30 |
|
|
}; |
31 |
|
23 |
static std::vector<Type> init_all() { |
32 |
|
23 |
std::vector<Type> v; |
33 |
✓✗ |
23 |
v.reserve(NbActionModelTypes); |
34 |
✓✓ |
138 |
for (int i = 0; i < NbActionModelTypes; ++i) { |
35 |
✓✗ |
115 |
v.push_back((Type)i); |
36 |
|
|
} |
37 |
|
23 |
return v; |
38 |
|
|
} |
39 |
|
|
static const std::vector<Type> all; |
40 |
|
|
}; |
41 |
|
|
|
42 |
|
|
std::ostream& operator<<(std::ostream& os, ActionModelTypes::Type type); |
43 |
|
|
|
44 |
|
|
class ActionModelFactory { |
45 |
|
|
public: |
46 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
47 |
|
|
|
48 |
|
|
explicit ActionModelFactory(); |
49 |
|
|
~ActionModelFactory(); |
50 |
|
|
|
51 |
|
|
boost::shared_ptr<crocoddyl::ActionModelAbstract> create( |
52 |
|
|
ActionModelTypes::Type type, bool secondInstance = false) const; |
53 |
|
|
|
54 |
|
|
boost::shared_ptr<crocoddyl::ActionModelImpulseFwdDynamics> |
55 |
|
|
create_impulseFwdDynamics(StateModelTypes::Type state_type) const; |
56 |
|
|
}; |
57 |
|
|
|
58 |
|
|
} // namespace unittest |
59 |
|
|
} // namespace crocoddyl |
60 |
|
|
|
61 |
|
|
#endif // CROCODDYL_ACTION_FACTORY_HPP_ |