1 |
|
|
// |
2 |
|
|
// Copyright (c) 2017 CNRS |
3 |
|
|
// |
4 |
|
|
// This file is part of tsid |
5 |
|
|
// tsid is free software: you can redistribute it |
6 |
|
|
// and/or modify it under the terms of the GNU Lesser General Public |
7 |
|
|
// License as published by the Free Software Foundation, either version |
8 |
|
|
// 3 of the License, or (at your option) any later version. |
9 |
|
|
// tsid is distributed in the hope that it will be |
10 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty |
11 |
|
|
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 |
|
|
// General Lesser Public License for more details. You should have |
13 |
|
|
// received a copy of the GNU Lesser General Public License along with |
14 |
|
|
// tsid If not, see |
15 |
|
|
// <http://www.gnu.org/licenses/>. |
16 |
|
|
// |
17 |
|
|
|
18 |
|
|
#ifndef __invdyn_solvers_fwd_hpp__ |
19 |
|
|
#define __invdyn_solvers_fwd_hpp__ |
20 |
|
|
|
21 |
|
|
#include <memory> |
22 |
|
|
|
23 |
|
|
#include "tsid/config.hh" |
24 |
|
|
#include "tsid/math/fwd.hpp" |
25 |
|
|
#include "tsid/solvers/solver-qpData.hpp" |
26 |
|
|
#include <pinocchio/container/aligned-vector.hpp> |
27 |
|
|
|
28 |
|
|
#define DEFAULT_HESSIAN_REGULARIZATION 1e-8 |
29 |
|
|
|
30 |
|
|
namespace tsid { |
31 |
|
|
namespace solvers { |
32 |
|
|
|
33 |
|
|
/** |
34 |
|
|
* Available HQP solvers. |
35 |
|
|
*/ |
36 |
|
|
enum TSID_DLLAPI SolverHQP { |
37 |
|
|
SOLVER_HQP_EIQUADPROG = 0, |
38 |
|
|
SOLVER_HQP_EIQUADPROG_FAST = 1, |
39 |
|
|
SOLVER_HQP_EIQUADPROG_RT = 2 |
40 |
|
|
#ifdef TSID_QPMAD_FOUND |
41 |
|
|
, |
42 |
|
|
SOLVER_HQP_QPMAD |
43 |
|
|
#endif |
44 |
|
|
#ifdef TSID_WITH_PROXSUITE |
45 |
|
|
, |
46 |
|
|
SOLVER_HQP_PROXQP |
47 |
|
|
#endif |
48 |
|
|
#ifdef TSID_WITH_OSQP |
49 |
|
|
, |
50 |
|
|
SOLVER_HQP_OSQP |
51 |
|
|
#endif |
52 |
|
|
#ifdef QPOASES_FOUND |
53 |
|
|
, |
54 |
|
|
SOLVER_HQP_OASES |
55 |
|
|
#endif |
56 |
|
|
}; |
57 |
|
|
|
58 |
|
|
/** |
59 |
|
|
* Possible states of an HQP solver. |
60 |
|
|
*/ |
61 |
|
|
enum TSID_DLLAPI HQPStatus { |
62 |
|
|
HQP_STATUS_UNKNOWN = -1, |
63 |
|
|
HQP_STATUS_OPTIMAL = 0, |
64 |
|
|
HQP_STATUS_INFEASIBLE = 1, |
65 |
|
|
HQP_STATUS_UNBOUNDED = 2, |
66 |
|
|
HQP_STATUS_MAX_ITER_REACHED = 3, |
67 |
|
|
HQP_STATUS_ERROR = 4 |
68 |
|
|
}; |
69 |
|
|
|
70 |
|
|
class HQPOutput; |
71 |
|
|
|
72 |
|
|
class TSID_DLLAPI SolverHQPBase; |
73 |
|
|
|
74 |
|
|
template <int nVars, int nEqCon, int nIneqCon> |
75 |
|
|
class TSID_DLLAPI SolverHQuadProgRT; |
76 |
|
|
|
77 |
|
|
template <typename T1, typename T2> |
78 |
|
|
class aligned_pair { |
79 |
|
|
public: |
80 |
|
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW |
81 |
|
|
|
82 |
|
16 |
aligned_pair(const T1& t1, const T2& t2) : first(t1), second(t2) {} |
83 |
|
|
|
84 |
|
|
T1 first; |
85 |
|
|
T2 second; |
86 |
|
|
}; |
87 |
|
|
|
88 |
|
|
template <typename T1, typename T2> |
89 |
|
16 |
inline aligned_pair<T1, T2> make_pair(const T1& t1, const T2& t2) { |
90 |
|
16 |
return aligned_pair<T1, T2>(t1, t2); |
91 |
|
|
} |
92 |
|
|
|
93 |
|
|
typedef pinocchio::container::aligned_vector< |
94 |
|
|
aligned_pair<double, std::shared_ptr<math::ConstraintBase> > > |
95 |
|
|
ConstraintLevel; |
96 |
|
|
typedef pinocchio::container::aligned_vector< |
97 |
|
|
aligned_pair<double, std::shared_ptr<const math::ConstraintBase> > > |
98 |
|
|
ConstConstraintLevel; |
99 |
|
|
typedef pinocchio::container::aligned_vector<ConstraintLevel> HQPData; |
100 |
|
|
typedef pinocchio::container::aligned_vector<ConstConstraintLevel> ConstHQPData; |
101 |
|
|
|
102 |
|
|
typedef QPDataTpl<double> QPData; |
103 |
|
|
typedef QPDataBaseTpl<double> QPDataBase; |
104 |
|
|
typedef QPDataQuadProgTpl<double> QPDataQuadProg; |
105 |
|
|
|
106 |
|
|
} // namespace solvers |
107 |
|
|
} // namespace tsid |
108 |
|
|
|
109 |
|
|
#endif // ifndef __invdyn_solvers_fwd_hpp__ |