Verified Commit 0a515d49 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python: enhance exposition of Joints

parent 292b3011
Pipeline #14247 failed with stage
in 81 minutes and 35 seconds
......@@ -18,7 +18,7 @@ namespace pinocchio
template<class JointModelDerived>
struct JointModelDerivedPythonVisitor
: public boost::python::def_visitor< JointModelDerivedPythonVisitor<JointModelDerived> >
: public boost::python::def_visitor< JointModelDerivedPythonVisitor<JointModelDerived> >
{
public:
......@@ -26,14 +26,21 @@ namespace pinocchio
void visit(PyClass& cl) const
{
cl
.def(bp::init<>(bp::arg("self")))
// All are add_properties cause ReadOnly
.add_property("id",&get_id)
.add_property("idx_q",&get_idx_q)
.add_property("idx_v",&get_idx_v)
.add_property("nq",&get_nq)
.add_property("nv",&get_nv)
.def("setIndexes",&JointModelDerived::setIndexes)
.def("shortname",&JointModelDerived::shortname)
.add_property("id",&getId)
.add_property("idx_q",&getIdx_q)
.add_property("idx_v",&getIdx_v)
.add_property("nq",&getNq)
.add_property("nv",&getNv)
.def("setIndexes",
&JointModel::setIndexes,
bp::args("self","id","idx_q","idx_v"))
.def("hasSameIndexes",
&JointModel::hasSameIndexes,
bp::args("self","other"),
"Check if this has same indexes than other.")
.def("shortname",&JointModel::shortname,bp::arg("self"))
.def(bp::self == bp::self)
.def(bp::self != bp::self)
......@@ -58,7 +65,7 @@ namespace pinocchio
template<class JointDataDerived>
struct JointDataDerivedPythonVisitor
: public boost::python::def_visitor< JointDataDerivedPythonVisitor<JointDataDerived> >
: public boost::python::def_visitor< JointDataDerivedPythonVisitor<JointDataDerived> >
{
public:
......
......@@ -31,8 +31,14 @@ namespace pinocchio
.add_property("idx_v",&getIdx_v)
.add_property("nq",&getNq)
.add_property("nv",&getNv)
.def("setIndexes",&JointModel::setIndexes)
.def("shortname",&JointModel::shortname)
.def("setIndexes",
&JointModel::setIndexes,
bp::args("self","id","idx_q","idx_v"))
.def("hasSameIndexes",
&JointModel::hasSameIndexes,
bp::args("self","other"),
"Check if this has same indexes than other.")
.def("shortname",&JointModel::shortname,bp::arg("self"))
.def(bp::self == bp::self)
.def(bp::self != bp::self)
......
......@@ -57,7 +57,7 @@ namespace pinocchio
expose_joint_model<T>(
bp::class_<T>(T::classname().c_str(),
T::classname().c_str(),
bp::init<>())
bp::no_init)
.def(JointModelDerivedPythonVisitor<T>())
.def(PrintableVisitor<T>())
);
......
Markdown is supported
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