tsid  1.8.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
solver-osqp.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
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 __solvers_osqp_hpp__
19 #define __solvers_osqp_hpp__
20 
22 #include "OsqpEigen/OsqpEigen.h"
23 #include <Eigen/Sparse>
24 
25 #ifdef PROFILE_OSQP
26 #define START_PROFILER_OSQP(x) START_PROFILER(x)
27 #define STOP_PROFILER_OSQP(x) STOP_PROFILER(x)
28 #else
29 #define START_PROFILER_OSQP(x)
30 #define STOP_PROFILER_OSQP(x)
31 #endif
32 
33 namespace tsid {
34 namespace solvers {
39  public:
40  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
41 
47 
48  SolverOSQP(const std::string& name);
49  SolverOSQP(const SolverOSQP& other);
50 
51  void resize(unsigned int n, unsigned int neq, unsigned int nin) override;
52 
54  void retrieveQPData(const HQPData& problemData,
55  const bool hessianRegularization = false) override;
56 
58  const QPData getQPData() const { return m_qpData; }
59 
61  const HQPOutput& solve(const HQPData& problemData) override;
62 
64  double getObjectiveValue() override;
65 
67  bool setMaximumIterations(unsigned int maxIter) override;
68 
69  void setSigma(double sigma);
70  void setAlpha(double alpha);
71  void setRho(double rho);
72  void setEpsilonAbsolute(double epsAbs);
73  void setEpsilonRelative(double epsRel);
74  void setVerbose(bool isVerbose = false);
75 
76  protected:
77  void sendMsg(const std::string& s);
78 
79  double m_objValue;
81 
82  OsqpEigen::Solver m_solver;
83 
84  unsigned int m_neq;
85  unsigned int m_nin;
86  unsigned int m_n;
87 
89 
90  double m_rho;
91  double m_sigma;
92  double m_alpha;
93  double m_epsAbs;
94  double m_epsRel;
97 };
98 } // namespace solvers
99 } // namespace tsid
100 
101 #endif // ifndef __solvers_osqp_hpp__
Definition: solver-HQP-output.hpp:29
Abstract interface for a Quadratic Program (HQP) solver.
Definition: solver-HQP-base.hpp:34
Definition: solver-osqp.hpp:38
math::ConstRefVector ConstRefVector
Definition: solver-osqp.hpp:45
double m_rho
Definition: solver-osqp.hpp:90
const QPData getQPData() const
Definition: solver-osqp.hpp:58
double m_objValue
Definition: solver-osqp.hpp:79
bool m_isVerbose
Definition: solver-osqp.hpp:95
double m_epsAbs
Definition: solver-osqp.hpp:93
OsqpEigen::Solver m_solver
Definition: solver-osqp.hpp:82
double m_hessian_regularization
Definition: solver-osqp.hpp:80
math::ConstRefMatrix ConstRefMatrix
Definition: solver-osqp.hpp:46
unsigned int m_n
number of inequality constraints
Definition: solver-osqp.hpp:86
math::Vector Vector
Definition: solver-osqp.hpp:43
unsigned int m_nin
number of equality constraints
Definition: solver-osqp.hpp:85
unsigned int m_neq
Definition: solver-osqp.hpp:84
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef math::Matrix Matrix
Definition: solver-osqp.hpp:42
double m_sigma
Definition: solver-osqp.hpp:91
QPDataTpl< double > m_qpData
number of variables
Definition: solver-osqp.hpp:88
double m_epsRel
Definition: solver-osqp.hpp:94
math::RefVector RefVector
Definition: solver-osqp.hpp:44
bool m_isDataInitialized
Definition: solver-osqp.hpp:96
double m_alpha
Definition: solver-osqp.hpp:92
#define TSID_DLLAPI
Definition: config.hh:88
const Eigen::Ref< const Matrix > ConstRefMatrix
Definition: fwd.hpp:51
const Eigen::Ref< const Vector > ConstRefVector
Definition: fwd.hpp:48
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
Definition: fwd.hpp:35
Eigen::Ref< Vector > RefVector
Definition: fwd.hpp:47
Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
Definition: fwd.hpp:36
pinocchio::container::aligned_vector< ConstraintLevel > HQPData
Definition: fwd.hpp:99
Definition: constraint-bound.hpp:25