Line |
Branch |
Exec |
Source |
1 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
2 |
|
|
// BSD 3-Clause License |
3 |
|
|
// |
4 |
|
|
// Copyright (C) 2021-2025, University of Edinburgh, LAAS-CNRS |
5 |
|
|
// Copyright note valid unless otherwise stated in individual files. |
6 |
|
|
// All rights reserved. |
7 |
|
|
/////////////////////////////////////////////////////////////////////////////// |
8 |
|
|
|
9 |
|
|
#ifndef CROCODDYL_RESIDUAL_FACTORY_HPP_ |
10 |
|
|
#define CROCODDYL_RESIDUAL_FACTORY_HPP_ |
11 |
|
|
|
12 |
|
|
#include "crocoddyl/core/numdiff/residual.hpp" |
13 |
|
|
#include "crocoddyl/core/residual-base.hpp" |
14 |
|
|
#include "crocoddyl/multibody/states/multibody.hpp" |
15 |
|
|
#include "state.hpp" |
16 |
|
|
|
17 |
|
|
namespace crocoddyl { |
18 |
|
|
namespace unittest { |
19 |
|
|
|
20 |
|
|
struct ResidualModelTypes { |
21 |
|
|
enum Type { |
22 |
|
|
ResidualModelState, |
23 |
|
|
ResidualModelControl, |
24 |
|
|
ResidualModelCoMPosition, |
25 |
|
|
ResidualModelCentroidalMomentum, |
26 |
|
|
ResidualModelFramePlacement, |
27 |
|
|
ResidualModelFrameRotation, |
28 |
|
|
ResidualModelFrameTranslation, |
29 |
|
|
ResidualModelFrameVelocity, |
30 |
|
|
ResidualModelControlGrav, |
31 |
|
|
#ifdef PINOCCHIO_WITH_HPP_FCL |
32 |
|
|
#ifdef CROCODDYL_WITH_PAIR_COLLISION |
33 |
|
|
ResidualModelPairCollision, |
34 |
|
|
#endif // CROCODDYL_WITH_PAIR_COLLISION |
35 |
|
|
#endif // PINOCCHIO_WITH_HPP_FCL |
36 |
|
|
NbResidualModelTypes |
37 |
|
|
}; |
38 |
|
✗ |
static std::vector<Type> init_all() { |
39 |
|
✗ |
std::vector<Type> v; |
40 |
|
✗ |
for (int i = 0; i < NbResidualModelTypes; ++i) { |
41 |
|
✗ |
v.push_back((Type)i); |
42 |
|
|
} |
43 |
|
✗ |
return v; |
44 |
|
|
} |
45 |
|
|
static const std::vector<Type> all; |
46 |
|
|
}; |
47 |
|
|
|
48 |
|
|
std::ostream& operator<<(std::ostream& os, ResidualModelTypes::Type type); |
49 |
|
|
|
50 |
|
|
class ResidualModelFactory { |
51 |
|
|
public: |
52 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
53 |
|
|
|
54 |
|
|
typedef crocoddyl::MathBaseTpl<double> MathBase; |
55 |
|
|
typedef typename MathBase::Vector6s Vector6d; |
56 |
|
|
typedef pinocchio::GeometryObject::CollisionGeometryPtr CollisionGeometryPtr; |
57 |
|
|
|
58 |
|
|
explicit ResidualModelFactory(); |
59 |
|
|
~ResidualModelFactory(); |
60 |
|
|
|
61 |
|
|
std::shared_ptr<crocoddyl::ResidualModelAbstract> create( |
62 |
|
|
ResidualModelTypes::Type residual_type, StateModelTypes::Type state_type, |
63 |
|
|
std::size_t nu = std::numeric_limits<std::size_t>::max()) const; |
64 |
|
|
}; |
65 |
|
|
|
66 |
|
|
std::shared_ptr<crocoddyl::ResidualModelAbstract> create_random_residual( |
67 |
|
|
StateModelTypes::Type state_type); |
68 |
|
|
|
69 |
|
|
} // namespace unittest |
70 |
|
|
} // namespace crocoddyl |
71 |
|
|
|
72 |
|
|
#endif // CROCODDYL_RESIDUAL_FACTORY_HPP_ |
73 |
|
|
|