tsid 1.9.0
Efficient Task Space Inverse Dynamics for Multi-body Systems based on Pinocchio
Loading...
Searching...
No Matches
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 __tsid_python_solver_osqp_hpp__
19#define __tsid_python_solver_osqp_hpp__
20
22
24
28
29namespace tsid {
30namespace python {
31namespace bp = boost::python;
32
33template <typename Solver>
35 : public boost::python::def_visitor<SolverOSQPPythonVisitor<Solver> > {
36 template <class PyClass>
37
38 void visit(PyClass& cl) const {
39 cl.def(bp::init<const std::string&>((bp::arg("name")),
40 "Default Constructor with name"))
42 bp::args("n", "neq", "nin"))
43 .add_property("ObjVal", &Solver::getObjectiveValue, "return obj value")
44 .def("solve", &SolverOSQPPythonVisitor::solve, bp::args("HQPData"))
46 bp::args("HQPData for Python"))
47 .add_property("qpData", &Solver::getQPData, "return QP Data object")
48 .def("retrieveQPData", &SolverOSQPPythonVisitor::retrieveQPData,
49 bp::args("HQPData for Python"))
50 .def("set_maximum_iterations", &Solver::setMaximumIterations)
51 .def("set_sigma", &Solver::setSigma)
52 .def("set_alpha", &Solver::setAlpha)
53 .def("set_rho", &Solver::setRho)
54 .def("set_epsilon_absolute", &Solver::setEpsilonAbsolute)
55 .def("set_epsilon_relative", &Solver::setEpsilonRelative)
56 .def("set_verbose", &Solver::setVerbose);
57 }
58
59 static void resize(Solver& self, unsigned int n, unsigned int neq,
60 unsigned int nin) {
61 return self.resize(n, neq, nin);
62 }
63 static solvers::HQPOutput solve(Solver& self,
64 const solvers::HQPData& problemData) {
66 output = self.solve(problemData);
67 return output;
68 }
72
73 output = self.solve(data);
74
75 return output;
76 }
77
80 self.retrieveQPData(data);
81 return self.getQPData();
82 }
83
84 static void expose(const std::string& class_name) {
85 std::string doc = "Solver osqp info.";
86 bp::class_<Solver>(class_name.c_str(), doc.c_str(), bp::no_init)
88 }
89};
90
91} // namespace python
92} // namespace tsid
93
94#endif // ifndef __tsid_python_solver_osqp_hpp__
Definition container.hpp:80
HQPData & get()
Definition container.hpp:116
Definition solver-HQP-output.hpp:29
Definition constraint-bound.hpp:26
QPDataTpl< double > QPData
Definition fwd.hpp:102
pinocchio::container::aligned_vector< ConstraintLevel > HQPData
Definition fwd.hpp:99
Definition constraint-bound.hpp:25
Definition solver-osqp.hpp:35
static solvers::HQPOutput solver_helper(Solver &self, HQPDatas &HQPDatas)
Definition solver-osqp.hpp:69
static solvers::HQPOutput solve(Solver &self, const solvers::HQPData &problemData)
Definition solver-osqp.hpp:63
static solvers::QPData retrieveQPData(Solver &self, HQPDatas &HQPDatas)
Definition solver-osqp.hpp:78
void visit(PyClass &cl) const
Definition solver-osqp.hpp:38
static void expose(const std::string &class_name)
Definition solver-osqp.hpp:84
static void resize(Solver &self, unsigned int n, unsigned int neq, unsigned int nin)
Definition solver-osqp.hpp:59