4#ifndef __multicontact_api_python_scenario_contact_model_planar_hpp__
5#define __multicontact_api_python_scenario_contact_model_planar_hpp__
7#include <eigenpy/eigenpy.hpp>
18namespace bp = boost::python;
20template <
typename ContactModel>
22 :
public boost::python::def_visitor<
23 ContactModelPythonVisitor<ContactModel> > {
24 typedef typename ContactModel::Scalar
Scalar;
26 typedef typename ContactModel::Matrix3X
Matrix3X;
27 typedef typename ContactModel::Matrix6X
Matrix6X;
29 template <
class PyClass>
32 .def(bp::init<Scalar>(bp::args(
"mu")))
33 .def(bp::init<Scalar, ContactType>(bp::args(
"mu",
"contact_type")))
34 .def(bp::init<ContactModel>(bp::args(
"other"),
"Copy contructor."))
35 .def_readwrite(
"mu", &ContactModel::m_mu,
"Friction coefficient.")
36 .def_readwrite(
"contact_type", &ContactModel::m_contact_type,
37 "Enum that define the type of contact.")
39 "num_contact_points", &getNumContact, &setNumContact,
40 "The number of contact points used to model this contact. \n"
41 "Changing this value will clear the contact_points_positions "
43 .add_property(
"contact_points_positions", &getContactPositions,
45 "3xnum_contact_points matrix defining the contact points "
46 "positions in the frame of the contact "
48 "num_contact_points is automatically updated to the "
49 "number of columns of this matrix.")
50 .def(
"generatorMatrix", &ContactModel::generatorMatrix,
51 "generatorMatrix Return a 6x(num_contact_points*3) matrix"
52 "containing the generator used to compute contact forces.")
53 .def(bp::self == bp::self)
54 .def(bp::self != bp::self)
55 .def(
"copy", ©,
"Returns a copy of *this.");
58 static void expose(
const std::string& class_name) {
59 std::string doc =
"Contact Model";
60 bp::class_<ContactModel>(class_name.c_str(), doc.c_str(), bp::no_init)
65 ENABLE_SPECIFIC_MATRIX_TYPE(
Matrix3X);
66 ENABLE_SPECIFIC_MATRIX_TYPE(
Matrix6X);
70 static ContactModel copy(
const ContactModel& self) {
71 return ContactModel(self);
74 static size_t getNumContact(ContactModel& self) {
75 return self.num_contact_points();
77 static void setNumContact(ContactModel& self,
const size_t num) {
78 self.num_contact_points(num);
80 static Matrix3X getContactPositions(ContactModel& self) {
81 return self.contact_points_positions();
83 static void setContactPositions(ContactModel& self,
const Matrix3X& pos) {
84 self.contact_points_positions(pos);