1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2023, 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 |
|
|
DifferentialActionModelFreeFwdDynamics_Hector, |
33 |
|
|
DifferentialActionModelFreeFwdDynamics_TalosArm, |
34 |
|
|
DifferentialActionModelFreeFwdDynamics_TalosArm_Squashed, |
35 |
|
|
DifferentialActionModelFreeInvDynamics_Hector, |
36 |
|
|
DifferentialActionModelFreeInvDynamics_TalosArm, |
37 |
|
|
DifferentialActionModelFreeInvDynamics_TalosArm_Squashed, |
38 |
|
|
DifferentialActionModelContactFwdDynamics_TalosArm, |
39 |
|
|
DifferentialActionModelContact2DFwdDynamics_TalosArm, |
40 |
|
|
DifferentialActionModelContactFwdDynamics_HyQ, |
41 |
|
|
DifferentialActionModelContactFwdDynamics_Talos, |
42 |
|
|
DifferentialActionModelContactFwdDynamicsWithFriction_TalosArm, |
43 |
|
|
DifferentialActionModelContact2DFwdDynamicsWithFriction_TalosArm, |
44 |
|
|
DifferentialActionModelContactFwdDynamicsWithFriction_HyQ, |
45 |
|
|
DifferentialActionModelContactFwdDynamicsWithFriction_Talos, |
46 |
|
|
DifferentialActionModelContactInvDynamics_TalosArm, |
47 |
|
|
DifferentialActionModelContactInvDynamics_HyQ, |
48 |
|
|
DifferentialActionModelContactInvDynamics_Talos, |
49 |
|
|
DifferentialActionModelContactInvDynamicsWithFriction_TalosArm, |
50 |
|
|
DifferentialActionModelContactInvDynamicsWithFriction_HyQ, |
51 |
|
|
DifferentialActionModelContactInvDynamicsWithFriction_Talos, |
52 |
|
|
NbDifferentialActionModelTypes |
53 |
|
|
}; |
54 |
|
23 |
static std::vector<Type> init_all() { |
55 |
|
23 |
std::vector<Type> v; |
56 |
✓✗ |
23 |
v.reserve(NbDifferentialActionModelTypes); |
57 |
✓✓ |
529 |
for (int i = 0; i < NbDifferentialActionModelTypes; ++i) { |
58 |
✓✗ |
506 |
v.push_back((Type)i); |
59 |
|
|
} |
60 |
|
23 |
return v; |
61 |
|
|
} |
62 |
|
|
static const std::vector<Type> all; |
63 |
|
|
}; |
64 |
|
|
|
65 |
|
|
std::ostream& operator<<(std::ostream& os, |
66 |
|
|
DifferentialActionModelTypes::Type type); |
67 |
|
|
|
68 |
|
|
class DifferentialActionModelFactory { |
69 |
|
|
public: |
70 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
71 |
|
|
|
72 |
|
|
explicit DifferentialActionModelFactory(); |
73 |
|
|
~DifferentialActionModelFactory(); |
74 |
|
|
|
75 |
|
|
boost::shared_ptr<crocoddyl::DifferentialActionModelAbstract> create( |
76 |
|
|
DifferentialActionModelTypes::Type type, |
77 |
|
|
bool with_baumgarte = true) const; |
78 |
|
|
|
79 |
|
|
boost::shared_ptr<crocoddyl::DifferentialActionModelFreeFwdDynamics> |
80 |
|
|
create_freeFwdDynamics(StateModelTypes::Type state_type, |
81 |
|
|
ActuationModelTypes::Type actuation_type, |
82 |
|
|
bool constraints = true) const; |
83 |
|
|
|
84 |
|
|
boost::shared_ptr<crocoddyl::DifferentialActionModelFreeInvDynamics> |
85 |
|
|
create_freeInvDynamics(StateModelTypes::Type state_type, |
86 |
|
|
ActuationModelTypes::Type actuation_type, |
87 |
|
|
bool constraints = true) const; |
88 |
|
|
|
89 |
|
|
boost::shared_ptr<crocoddyl::DifferentialActionModelContactFwdDynamics> |
90 |
|
|
create_contactFwdDynamics(StateModelTypes::Type state_type, |
91 |
|
|
ActuationModelTypes::Type actuation_type, |
92 |
|
|
bool with_friction = true, |
93 |
|
|
bool with_baumgarte = true) const; |
94 |
|
|
|
95 |
|
|
boost::shared_ptr<crocoddyl::DifferentialActionModelContactInvDynamics> |
96 |
|
|
create_contactInvDynamics(StateModelTypes::Type state_type, |
97 |
|
|
ActuationModelTypes::Type actuation_type, |
98 |
|
|
bool with_friction = true, |
99 |
|
|
bool with_baumgarte = true) const; |
100 |
|
|
}; |
101 |
|
|
|
102 |
|
|
} // namespace unittest |
103 |
|
|
} // namespace crocoddyl |
104 |
|
|
|
105 |
|
|
#endif // CROCODDYL_DIFF_ACTION_FACTORY_HPP_ |