1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2021, LAAS-CNRS, University of Edinburgh, University of Trento |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef CROCODDYL_INTEGRATOR_FACTORY_HPP_ |
10 |
|
|
#define CROCODDYL_INTEGRATOR_FACTORY_HPP_ |
11 |
|
|
|
12 |
|
|
#include <iterator> |
13 |
|
|
|
14 |
|
|
#include "control.hpp" |
15 |
|
|
#include "crocoddyl/core/integ-action-base.hpp" |
16 |
|
|
|
17 |
|
|
namespace crocoddyl { |
18 |
|
|
namespace unittest { |
19 |
|
|
|
20 |
|
|
struct IntegratorTypes { |
21 |
|
|
enum Type { |
22 |
|
|
IntegratorEuler, |
23 |
|
|
IntegratorRK2, |
24 |
|
|
IntegratorRK3, |
25 |
|
|
IntegratorRK4, |
26 |
|
|
NbIntegratorTypes |
27 |
|
|
}; |
28 |
|
23 |
static std::vector<Type> init_all() { |
29 |
|
23 |
std::vector<Type> v; |
30 |
✓✗ |
23 |
v.reserve(NbIntegratorTypes); |
31 |
✓✓ |
115 |
for (int i = 0; i < NbIntegratorTypes; ++i) { |
32 |
✓✗ |
92 |
v.push_back((Type)i); |
33 |
|
|
} |
34 |
|
23 |
return v; |
35 |
|
|
} |
36 |
|
|
static const std::vector<Type> all; |
37 |
|
|
}; |
38 |
|
|
|
39 |
|
|
std::ostream& operator<<(std::ostream& os, IntegratorTypes::Type type); |
40 |
|
|
|
41 |
|
|
class IntegratorFactory { |
42 |
|
|
public: |
43 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
44 |
|
|
|
45 |
|
|
explicit IntegratorFactory(); |
46 |
|
|
~IntegratorFactory(); |
47 |
|
|
|
48 |
|
|
boost::shared_ptr<crocoddyl::IntegratedActionModelAbstract> create( |
49 |
|
|
IntegratorTypes::Type type, |
50 |
|
|
boost::shared_ptr<DifferentialActionModelAbstract> model) const; |
51 |
|
|
|
52 |
|
|
boost::shared_ptr<crocoddyl::IntegratedActionModelAbstract> create( |
53 |
|
|
IntegratorTypes::Type type, |
54 |
|
|
boost::shared_ptr<DifferentialActionModelAbstract> model, |
55 |
|
|
boost::shared_ptr<ControlParametrizationModelAbstract> control) const; |
56 |
|
|
}; |
57 |
|
|
|
58 |
|
|
} // namespace unittest |
59 |
|
|
} // namespace crocoddyl |
60 |
|
|
|
61 |
|
|
#endif // CROCODDYL_INTEGRATOR_FACTORY_HPP_ |