Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2019-2023, University of Edinburgh, Heriot-Watt University |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef CROCODDYL_CONTACTS_FACTORY_HPP_ |
10 |
|
|
#define CROCODDYL_CONTACTS_FACTORY_HPP_ |
11 |
|
|
|
12 |
|
|
#include "crocoddyl/multibody/contact-base.hpp" |
13 |
|
|
#include "crocoddyl/multibody/contacts/multiple-contacts.hpp" |
14 |
|
|
#include "crocoddyl/multibody/numdiff/contact.hpp" |
15 |
|
|
#include "state.hpp" |
16 |
|
|
|
17 |
|
|
namespace crocoddyl { |
18 |
|
|
namespace unittest { |
19 |
|
|
|
20 |
|
|
struct ContactModelTypes { |
21 |
|
|
enum Type { |
22 |
|
|
ContactModel1D_LOCAL, |
23 |
|
|
ContactModel1D_WORLD, |
24 |
|
|
ContactModel1D_LWA, |
25 |
|
|
ContactModel2D, |
26 |
|
|
ContactModel3D_LOCAL, |
27 |
|
|
ContactModel3D_WORLD, |
28 |
|
|
ContactModel3D_LWA, |
29 |
|
|
ContactModel6D_LOCAL, |
30 |
|
|
ContactModel6D_WORLD, |
31 |
|
|
ContactModel6D_LWA, |
32 |
|
|
NbContactModelTypes |
33 |
|
|
}; |
34 |
|
✗ |
static std::vector<Type> init_all() { |
35 |
|
✗ |
std::vector<Type> v; |
36 |
|
✗ |
v.reserve(NbContactModelTypes); |
37 |
|
✗ |
for (int i = 0; i < NbContactModelTypes; ++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, const ContactModelTypes::Type& type); |
46 |
|
|
|
47 |
|
|
class ContactModelFactory { |
48 |
|
|
public: |
49 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
50 |
|
|
|
51 |
|
|
explicit ContactModelFactory(); |
52 |
|
|
~ContactModelFactory(); |
53 |
|
|
|
54 |
|
|
std::shared_ptr<crocoddyl::ContactModelAbstract> create( |
55 |
|
|
ContactModelTypes::Type contact_type, |
56 |
|
|
PinocchioModelTypes::Type model_type, Eigen::Vector2d gains, |
57 |
|
|
const std::string frame_name = std::string(""), |
58 |
|
|
const std::size_t nu = std::numeric_limits<std::size_t>::max()) const; |
59 |
|
|
}; |
60 |
|
|
|
61 |
|
|
std::shared_ptr<crocoddyl::ContactModelAbstract> create_random_contact(); |
62 |
|
|
|
63 |
|
|
} // namespace unittest |
64 |
|
|
} // namespace crocoddyl |
65 |
|
|
|
66 |
|
|
#endif // CROCODDYL_CONTACTS_FACTORY_HPP_ |
67 |
|
|
|