Directory: | ./ |
---|---|
File: | unittest/factory/contact_cost.hpp |
Date: | 2025-01-16 08:47:40 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 6 | 6 | 100.0% |
Branches: | 4 | 6 | 66.7% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | ||
2 | // BSD 3-Clause License | ||
3 | // | ||
4 | // Copyright (C) 2021, University of Edinburgh | ||
5 | // Copyright note valid unless otherwise stated in individual files. | ||
6 | // All rights reserved. | ||
7 | /////////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | #ifndef CROCODDYL_CONTACT_COST_FACTORY_HPP_ | ||
10 | #define CROCODDYL_CONTACT_COST_FACTORY_HPP_ | ||
11 | |||
12 | #include "activation.hpp" | ||
13 | #include "actuation.hpp" | ||
14 | #include "crocoddyl/core/diff-action-base.hpp" | ||
15 | #include "crocoddyl/core/numdiff/diff-action.hpp" | ||
16 | #include "state.hpp" | ||
17 | |||
18 | namespace crocoddyl { | ||
19 | namespace unittest { | ||
20 | |||
21 | struct ContactCostModelTypes { | ||
22 | enum Type { | ||
23 | CostModelResidualContactForce, | ||
24 | CostModelResidualContactCoPPosition, | ||
25 | CostModelResidualContactFrictionCone, | ||
26 | CostModelResidualContactWrenchCone, | ||
27 | CostModelResidualContactControlGrav, | ||
28 | NbContactCostModelTypes | ||
29 | }; | ||
30 | 23 | static std::vector<Type> init_all() { | |
31 | 23 | std::vector<Type> v; | |
32 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | v.reserve(NbContactCostModelTypes); |
33 |
2/2✓ Branch 0 taken 115 times.
✓ Branch 1 taken 23 times.
|
138 | for (int i = 0; i < NbContactCostModelTypes; ++i) { |
34 |
1/2✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
|
115 | v.push_back((Type)i); |
35 | } | ||
36 | 23 | return v; | |
37 | } | ||
38 | static const std::vector<Type> all; | ||
39 | }; | ||
40 | |||
41 | std::ostream& operator<<(std::ostream& os, ContactCostModelTypes::Type type); | ||
42 | |||
43 | class ContactCostModelFactory { | ||
44 | public: | ||
45 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
46 | |||
47 | typedef crocoddyl::MathBaseTpl<double> MathBase; | ||
48 | |||
49 | explicit ContactCostModelFactory(); | ||
50 | ~ContactCostModelFactory(); | ||
51 | |||
52 | boost::shared_ptr<crocoddyl::DifferentialActionModelAbstract> create( | ||
53 | ContactCostModelTypes::Type cost_type, | ||
54 | PinocchioModelTypes::Type model_type, | ||
55 | ActivationModelTypes::Type activation_type, | ||
56 | ActuationModelTypes::Type actuation_type) const; | ||
57 | }; | ||
58 | |||
59 | } // namespace unittest | ||
60 | } // namespace crocoddyl | ||
61 | |||
62 | #endif // CROCODDYL_CONTACT_COST_FACTORY_HPP_ | ||
63 |