-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved hcod solver outside pyopensot.cpp file in order to make binding…
…s compile when the flag OPENSOT_SOTH_FRONT_END is False. Tested hcod solver in panda_ik.example. HCOD bindings are now in pyopnesot_hcod python lib.
- Loading branch information
1 parent
4dbd5be
commit 2622e6a
Showing
6 changed files
with
64 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#include "solver_hcod.hpp" | ||
|
||
PYBIND11_MODULE(pyopensot_hcod, m) { | ||
pyHCOD(m); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/eigen.h> | ||
#include <pybind11/stl.h> | ||
|
||
#include <OpenSoT/solvers/HCOD.h> | ||
|
||
namespace py = pybind11; | ||
using namespace OpenSoT; | ||
|
||
template <class MatrixType, class VectorType> | ||
class pySolverTrampoline : public Solver<MatrixType, VectorType> { | ||
public: | ||
using Solver<MatrixType, VectorType>::Solver; | ||
typedef Solver<MatrixType, VectorType> SMV; | ||
|
||
bool solve(VectorType& solution) override { | ||
PYBIND11_OVERLOAD_PURE(bool, SMV, solve, solution); | ||
} | ||
}; | ||
|
||
template<typename MatrixType, typename VectorType> | ||
VectorType solve(Solver<MatrixType, VectorType>& solver) | ||
{ | ||
VectorType solution; | ||
solver.solve(solution); | ||
return solution; | ||
} | ||
|
||
|
||
void pyHCOD(py::module& m) { | ||
py::class_<solvers::HCOD, std::shared_ptr<solvers::HCOD>, OpenSoT::Solver<Eigen::MatrixXd, Eigen::VectorXd>>(m, "HCOD") | ||
.def(py::init<OpenSoT::AutoStack&, const double>()) | ||
.def(py::init<OpenSoT::Solver<Eigen::MatrixXd, Eigen::VectorXd>::Stack&, OpenSoT::Solver<Eigen::MatrixXd, Eigen::VectorXd>::ConstraintPtr, const double>()) | ||
.def("solve", solve<Eigen::MatrixXd, Eigen::VectorXd>) | ||
.def("setDisableWeightsComputation", &solvers::HCOD::setDisableWeightsComputation) | ||
.def("getDisableWeightsComputation", &solvers::HCOD::getDisableWeightsComputation) | ||
.def("setDamping", &solvers::HCOD::setDamping) | ||
.def("printSOT", &solvers::HCOD::printSOT); | ||
} |