Directory: | ./ |
---|---|
File: | unittest/factory/impulse_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_IMPULSE_COST_FACTORY_HPP_ | ||
10 | #define CROCODDYL_IMPULSE_COST_FACTORY_HPP_ | ||
11 | |||
12 | #include "activation.hpp" | ||
13 | #include "crocoddyl/core/action-base.hpp" | ||
14 | #include "crocoddyl/core/numdiff/action.hpp" | ||
15 | #include "state.hpp" | ||
16 | |||
17 | namespace crocoddyl { | ||
18 | namespace unittest { | ||
19 | |||
20 | struct ImpulseCostModelTypes { | ||
21 | enum Type { | ||
22 | CostModelResidualImpulseCoM, | ||
23 | CostModelResidualContactForce, | ||
24 | CostModelResidualContactCoPPosition, | ||
25 | CostModelResidualContactFrictionCone, | ||
26 | CostModelResidualContactWrenchCone, | ||
27 | NbImpulseCostModelTypes | ||
28 | }; | ||
29 | 23 | static std::vector<Type> init_all() { | |
30 | 23 | std::vector<Type> v; | |
31 |
1/2✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
|
23 | v.reserve(NbImpulseCostModelTypes); |
32 |
2/2✓ Branch 0 taken 115 times.
✓ Branch 1 taken 23 times.
|
138 | for (int i = 0; i < NbImpulseCostModelTypes; ++i) { |
33 |
1/2✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
|
115 | v.push_back((Type)i); |
34 | } | ||
35 | 23 | return v; | |
36 | } | ||
37 | static const std::vector<Type> all; | ||
38 | }; | ||
39 | |||
40 | std::ostream& operator<<(std::ostream& os, ImpulseCostModelTypes::Type type); | ||
41 | |||
42 | class ImpulseCostModelFactory { | ||
43 | public: | ||
44 | EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
45 | |||
46 | typedef crocoddyl::MathBaseTpl<double> MathBase; | ||
47 | typedef typename MathBase::Vector6s Vector6d; | ||
48 | |||
49 | explicit ImpulseCostModelFactory(); | ||
50 | ~ImpulseCostModelFactory(); | ||
51 | |||
52 | boost::shared_ptr<crocoddyl::ActionModelAbstract> create( | ||
53 | ImpulseCostModelTypes::Type cost_type, | ||
54 | PinocchioModelTypes::Type model_type, | ||
55 | ActivationModelTypes::Type activation_type) const; | ||
56 | }; | ||
57 | |||
58 | } // namespace unittest | ||
59 | } // namespace crocoddyl | ||
60 | |||
61 | #endif // CROCODDYL_IMPULSE_COST_FACTORY_HPP_ | ||
62 |