-
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.
Merge branch 'issue#216' into 4.0-devel
- Loading branch information
Showing
9 changed files
with
137 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <pybind11/pybind11.h> | ||
#include <pybind11/eigen.h> | ||
#include <pybind11/stl.h> | ||
#include <OpenSoT/constraints/velocity/CollisionAvoidance.h> | ||
|
||
|
||
namespace py = pybind11; | ||
using namespace OpenSoT::constraints::velocity; | ||
|
||
void pyVelocityCollisionAvoidance(py::module& m) { | ||
py::class_<CollisionAvoidance, std::shared_ptr<CollisionAvoidance>, OpenSoT::Constraint<Eigen::MatrixXd, Eigen::VectorXd>>(m, "CollisionAvoidance") | ||
.def(py::init<const XBot::ModelInterface&, int, urdf::ModelConstSharedPtr, srdf::ModelConstSharedPtr>(), | ||
py::arg(), py::arg("max_pairs") = -1, py::arg("collision_urdf") = nullptr, py::arg("collision_srdf") = nullptr) | ||
.def("getLinkPairThreshold", &CollisionAvoidance::getLinkPairThreshold) | ||
.def("getDetectionThreshold", &CollisionAvoidance::getDetectionThreshold) | ||
.def("setLinkPairThreshold", &CollisionAvoidance::setLinkPairThreshold) | ||
.def("setDetectionThreshold", &CollisionAvoidance::setDetectionThreshold) | ||
.def("update", &CollisionAvoidance::update) | ||
.def("setMaxPairs", &CollisionAvoidance::setMaxPairs) | ||
.def("setCollisionList", &CollisionAvoidance::setCollisionList) | ||
.def("collisionModelUpdated", &CollisionAvoidance::collisionModelUpdated) | ||
.def("addCollisionShape", &CollisionAvoidance::addCollisionShape) | ||
.def("moveCollisionShape", &CollisionAvoidance::moveCollisionShape) | ||
.def("setBoundScaling", &CollisionAvoidance::setBoundScaling) | ||
.def("setLinksVsEnvironment", &CollisionAvoidance::setLinksVsEnvironment) | ||
.def("getCollisionModel", (const XBot::Collision::CollisionModel& (CollisionAvoidance::*)() const) &CollisionAvoidance::getCollisionModel) | ||
.def("getOrderedWitnessPointVector", &CollisionAvoidance::getOrderedWitnessPointVector) | ||
.def("getOrderedLinkPairVector", &CollisionAvoidance::getOrderedLinkPairVector) | ||
.def("getOrderedDistanceVector", &CollisionAvoidance::getOrderedDistanceVector) | ||
.def("getCollisionJacobian", &CollisionAvoidance::getCollisionJacobian); | ||
} |
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,7 @@ | ||
#include "constraints/velocity_collision.hpp" | ||
|
||
PYBIND11_MODULE(pyopensot_collision, m) { | ||
auto m_c = m.def_submodule("constraints"); | ||
auto m_cv = m_c.def_submodule("velocity"); | ||
pyVelocityCollisionAvoidance(m_cv); | ||
} |
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); | ||
} |