Commit eda373b0 authored by Julian Viereck's avatar Julian Viereck
Browse files

Rename existing contact binding to Contact6DPythonVisitor

parent 96433843
......@@ -15,7 +15,7 @@
// <http://www.gnu.org/licenses/>.
//
#include "tsid/bindings/python/contacts/contact.hpp"
#include "tsid/bindings/python/contacts/contact-6d.hpp"
#include "tsid/bindings/python/contacts/expose-contact.hpp"
namespace tsid
......@@ -24,7 +24,7 @@ namespace tsid
{
void exposeContact6d()
{
ContactPythonVisitor<tsid::contacts::Contact6d>::expose("Contact6d");
Contact6DPythonVisitor<tsid::contacts::Contact6d>::expose("Contact6d");
}
}
}
#ifndef __tsid_python_contact_hpp__
#define __tsid_python_contact_hpp__
#ifndef __tsid_python_contact_6d_hpp__
#define __tsid_python_contact_6d_hpp__
#include <boost/python.hpp>
#include <string>
......@@ -37,8 +37,8 @@ namespace tsid
namespace bp = boost::python;
template<typename Contact6d>
struct ContactPythonVisitor
: public boost::python::def_visitor< ContactPythonVisitor<Contact6d> >
struct Contact6DPythonVisitor
: public boost::python::def_visitor< Contact6DPythonVisitor<Contact6d> >
{
template<class PyClass>
......@@ -49,32 +49,32 @@ namespace tsid
.def(bp::init<std::string, robots::RobotWrapper &, std::string, Eigen::MatrixXd, Eigen::VectorXd, double, double, double, double> ((bp::arg("name"), bp::arg("robot"), bp::arg("framename"), bp::arg("contactPoint"), bp::arg("contactNormal"), bp::arg("frictionCoeff"), bp::arg("minForce"), bp::arg("maxForce"), bp::arg("regWeight")), "Default Constructor"))
.add_property("n_motion", &Contact6d::n_motion, "return number of motion")
.add_property("n_force", &Contact6d::n_force, "return number of force")
.add_property("name", &ContactPythonVisitor::name, "return name")
.def("computeMotionTask", &ContactPythonVisitor::computeMotionTask, bp::args("t", "q", "v", "data"))
.def("computeForceTask", &ContactPythonVisitor::computeForceTask, bp::args("t", "q", "v", "data"))
.def("computeForceRegularizationTask", &ContactPythonVisitor::computeForceRegularizationTask, bp::args("t", "q", "v", "data"))
.add_property("name", &Contact6DPythonVisitor::name, "return name")
.def("computeMotionTask", &Contact6DPythonVisitor::computeMotionTask, bp::args("t", "q", "v", "data"))
.def("computeForceTask", &Contact6DPythonVisitor::computeForceTask, bp::args("t", "q", "v", "data"))
.def("computeForceRegularizationTask", &Contact6DPythonVisitor::computeForceRegularizationTask, bp::args("t", "q", "v", "data"))
.add_property("getForceGeneratorMatrix", bp::make_function(&ContactPythonVisitor::getForceGeneratorMatrix, bp::return_value_policy<bp::copy_const_reference>()))
.add_property("getForceGeneratorMatrix", bp::make_function(&Contact6DPythonVisitor::getForceGeneratorMatrix, bp::return_value_policy<bp::copy_const_reference>()))
.add_property("getForceRegularizationWeight", &Contact6d::getForceRegularizationWeight, "return force reg weight")
.def("getNormalForce", &ContactPythonVisitor::getNormalForce, bp::arg("vec"))
.def("getNormalForce", &Contact6DPythonVisitor::getNormalForce, bp::arg("vec"))
.add_property("getMinNormalForce", &Contact6d::getMinNormalForce)
.add_property("getMaxNormalForce", &Contact6d::getMaxNormalForce)
.add_property("Kp", bp::make_function(&ContactPythonVisitor::Kp, bp::return_value_policy<bp::copy_const_reference>()))
.add_property("Kd", bp::make_function(&ContactPythonVisitor::Kd, bp::return_value_policy<bp::copy_const_reference>()))
.def("setKp", &ContactPythonVisitor::setKp, bp::arg("Kp"))
.def("setKd", &ContactPythonVisitor::setKd, bp::arg("Kd"))
.add_property("Kp", bp::make_function(&Contact6DPythonVisitor::Kp, bp::return_value_policy<bp::copy_const_reference>()))
.add_property("Kd", bp::make_function(&Contact6DPythonVisitor::Kd, bp::return_value_policy<bp::copy_const_reference>()))
.def("setKp", &Contact6DPythonVisitor::setKp, bp::arg("Kp"))
.def("setKd", &Contact6DPythonVisitor::setKd, bp::arg("Kd"))
.def("setContactPoints", &ContactPythonVisitor::setContactPoints, bp::args("vec"))
.def("setContactNormal", &ContactPythonVisitor::setContactNormal, bp::args("vec"))
.def("setFrictionCoefficient", &ContactPythonVisitor::setFrictionCoefficient, bp::args("friction_coeff"))
.def("setMinNormalForce", &ContactPythonVisitor::setMinNormalForce, bp::args("min_force"))
.def("setMaxNormalForce", &ContactPythonVisitor::setMaxNormalForce, bp::args("max_force"))
.def("setRegularizationTaskWeight", &ContactPythonVisitor::setRegularizationTaskWeight, bp::args("double"))
.def("setReference", &ContactPythonVisitor::setReference, bp::args("SE3"))
.def("setForceReference", &ContactPythonVisitor::setForceReference, bp::args("f_vec"))
.def("setRegularizationTaskWeightVector", &ContactPythonVisitor::setRegularizationTaskWeightVector, bp::args("w_vec"))
.def("setContactPoints", &Contact6DPythonVisitor::setContactPoints, bp::args("vec"))
.def("setContactNormal", &Contact6DPythonVisitor::setContactNormal, bp::args("vec"))
.def("setFrictionCoefficient", &Contact6DPythonVisitor::setFrictionCoefficient, bp::args("friction_coeff"))
.def("setMinNormalForce", &Contact6DPythonVisitor::setMinNormalForce, bp::args("min_force"))
.def("setMaxNormalForce", &Contact6DPythonVisitor::setMaxNormalForce, bp::args("max_force"))
.def("setRegularizationTaskWeight", &Contact6DPythonVisitor::setRegularizationTaskWeight, bp::args("double"))
.def("setReference", &Contact6DPythonVisitor::setReference, bp::args("SE3"))
.def("setForceReference", &Contact6DPythonVisitor::setForceReference, bp::args("f_vec"))
.def("setRegularizationTaskWeightVector", &Contact6DPythonVisitor::setRegularizationTaskWeightVector, bp::args("w_vec"))
;
}
static std::string name(Contact6d & self){
......@@ -150,7 +150,7 @@ namespace tsid
bp::class_<Contact6d>(class_name.c_str(),
doc.c_str(),
bp::no_init)
.def(ContactPythonVisitor<Contact6d>());
.def(Contact6DPythonVisitor<Contact6d>());
}
};
}
......
......@@ -18,13 +18,14 @@
#ifndef __tsid_python_expose_contact_hpp__
#define __tsid_python_expose_contact_hpp__
#include "tsid/bindings/python/contacts/contact.hpp"
#include "tsid/bindings/python/contacts/contact-6d.hpp"
namespace tsid
{
namespace python
{
void exposeContact6d();
inline void exposeContact()
{
exposeContact6d();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment