wbc
OsqpSolver.hpp
Go to the documentation of this file.
1#ifndef WBC_OSQP_SOLVER_HPP
2#define WBC_OSQP_SOLVER_HPP
3
4#include <Eigen/Sparse>
5#include <OsqpEigen/Solver.hpp>
8
9namespace wbc {
10
11class OsqpSolver : public QPSolver{
12public:
13 OsqpSolver();
15
16 virtual void solve(const HierarchicalQP& hierarchical_qp, base::VectorXd& solver_output);
17
18protected:
20 OsqpEigen::Solver solver;
21
22 Eigen::MatrixXd hessian_dense;
23 Eigen::SparseMatrix<double> hessian_sparse;
24 Eigen::MatrixXd constraint_mat_dense;
25 Eigen::SparseMatrix<double> constraint_mat_sparse;
26 Eigen::VectorXd gradient;
27 Eigen::VectorXd lower_bound;
28 Eigen::VectorXd upper_bound;
29
30 void resetData(uint nq, uint nc);
31 std::string exitFlagToString(OsqpEigen::ErrorExitFlag flag){
32 switch(flag){
33 case OsqpEigen::ErrorExitFlag::DataValidationError: return "DataValidationError";
34 case OsqpEigen::ErrorExitFlag::SettingsValidationError: return "SettingsValidationError";
35 case OsqpEigen::ErrorExitFlag::LinsysSolverLoadError: return "LinsysSolverLoadError";
36 case OsqpEigen::ErrorExitFlag::LinsysSolverInitError: return "LinsysSolverInitError";
37 case OsqpEigen::ErrorExitFlag::NonCvxError: return "NonCvxError";
38 case OsqpEigen::ErrorExitFlag::MemAllocError: return "MemAllocError";
39 case OsqpEigen::ErrorExitFlag::WorkspaceNotInitError: return "WorkspaceNotInitError";
40 default: return "NoError";
41 }
42 }
43};
44
45}
46
47#endif
Definition OsqpSolver.hpp:11
OsqpSolver()
Definition OsqpSolver.cpp:6
virtual void solve(const HierarchicalQP &hierarchical_qp, base::VectorXd &solver_output)
solve Solve the given quadratic program
Definition OsqpSolver.cpp:12
void resetData(uint nq, uint nc)
Eigen::VectorXd upper_bound
Definition OsqpSolver.hpp:28
std::string exitFlagToString(OsqpEigen::ErrorExitFlag flag)
Definition OsqpSolver.hpp:31
Eigen::MatrixXd constraint_mat_dense
Definition OsqpSolver.hpp:24
Eigen::VectorXd gradient
Definition OsqpSolver.hpp:26
Eigen::MatrixXd hessian_dense
Definition OsqpSolver.hpp:22
OsqpEigen::Solver solver
Definition OsqpSolver.hpp:20
~OsqpSolver()
Definition OsqpSolver.cpp:9
Eigen::SparseMatrix< double > hessian_sparse
Definition OsqpSolver.hpp:23
bool configured
Definition OsqpSolver.hpp:19
Eigen::SparseMatrix< double > constraint_mat_sparse
Definition OsqpSolver.hpp:25
Eigen::VectorXd lower_bound
Definition OsqpSolver.hpp:27
Definition QPSolver.hpp:14
Definition ContactsAccelerationConstraint.cpp:3
Describes a hierarchy of quadratic programs.
Definition QuadraticProgram.hpp:57