Verified Commit d82946b0 authored by Justin Carpentier's avatar Justin Carpentier
Browse files

python: minor refactoring of Joint exposers

parent a97adba1
......@@ -16,11 +16,11 @@ namespace pinocchio
static void exposeVariants()
{
boost::mpl::for_each<JointModelVariant::types>(ModelExposer());
boost::mpl::for_each<JointModelVariant::types>(JointModelExposer());
bp::to_python_converter<pinocchio::JointModelVariant,
JointVariantVisitor<pinocchio::JointModelVariant > >();
boost::mpl::for_each<JointDataVariant::types>(DataExposer());
boost::mpl::for_each<JointDataVariant::types>(JointDataExposer());
bp::to_python_converter<pinocchio::JointDataVariant,
JointVariantVisitor<pinocchio::JointDataVariant > >();
}
......
//
// Copyright (c) 2015 CNRS
// Copyright (c) 2015-2020 CNRS INRIA
//
#ifndef __pinocchio_python_joint_dense_hpp__
#define __pinocchio_python_joint_dense_hpp__
#ifndef __pinocchio_python_joint_variants_hpp__
#define __pinocchio_python_joint_variants_hpp__
#include <boost/python.hpp>
#include <eigenpy/exception.hpp>
......@@ -27,27 +27,29 @@ namespace pinocchio
{
cl
// All are add_properties cause ReadOnly
.add_property("id",&JointModelDerivedPythonVisitor::getId)
.add_property("idx_q",&JointModelDerivedPythonVisitor::getIdx_q)
.add_property("idx_v",&JointModelDerivedPythonVisitor::getIdx_v)
.add_property("nq",&JointModelDerivedPythonVisitor::getNq)
.add_property("nv",&JointModelDerivedPythonVisitor::getNv)
.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)
;
}
static JointIndex getId( const JointModelDerived & self ) { return self.id(); }
static int getIdx_q(const JointModelDerived & self) {return self.idx_q();}
static int getIdx_v(const JointModelDerived & self) {return self.idx_v();}
static int getNq(const JointModelDerived & self) {return self.nq();}
static int getNv(const JointModelDerived & self) {return self.nv();}
static JointIndex get_id(const JointModelDerived & self)
{ return self.id(); }
static int get_idx_q(const JointModelDerived & self)
{ return self.idx_q(); }
static int get_idx_v(const JointModelDerived & self)
{ return self.idx_v(); }
static int get_nq(const JointModelDerived & self)
{ return self.nq(); }
static int get_nv(const JointModelDerived & self)
{ return self.nv(); }
static void expose()
{
}
{}
};
......@@ -62,42 +64,37 @@ namespace pinocchio
{
cl
// All are add_properties cause ReadOnly
.add_property("S",&JointDataDerivedPythonVisitor::getS)
.add_property("M",&JointDataDerivedPythonVisitor::getM)
.add_property("v",&JointDataDerivedPythonVisitor::getv)
.add_property("c",&JointDataDerivedPythonVisitor::getc)
.add_property("U",&JointDataDerivedPythonVisitor::getU)
.add_property("Dinv",&JointDataDerivedPythonVisitor::getDinv)
.add_property("UDinv",&JointDataDerivedPythonVisitor::getUDinv)
.add_property("S",&get_S)
.add_property("M",&get_M)
.add_property("v",&get_v)
.add_property("c",&get_c)
.add_property("U",&get_U)
.add_property("Dinv",&get_Dinv)
.add_property("UDinv",&get_UDinv)
.def("shortname",&JointDataDerived::shortname)
;
}
static typename JointDataDerived::Constraint_t getS(const JointDataDerived & self )
static typename JointDataDerived::Constraint_t get_S(const JointDataDerived & self)
{ return self.S_accessor(); }
static typename JointDataDerived::Transformation_t getM(const JointDataDerived & self )
static typename JointDataDerived::Transformation_t get_M(const JointDataDerived & self)
{ return self.M_accessor(); }
static typename JointDataDerived::Motion_t getv(const JointDataDerived & self )
static typename JointDataDerived::Motion_t get_v(const JointDataDerived & self)
{ return self.v_accessor(); }
static typename JointDataDerived::Bias_t getc(const JointDataDerived & self )
static typename JointDataDerived::Bias_t get_c(const JointDataDerived & self)
{ return self.c_accessor(); }
static typename JointDataDerived::U_t getU(const JointDataDerived & self )
static typename JointDataDerived::U_t get_U(const JointDataDerived & self)
{ return self.U_accessor(); }
static typename JointDataDerived::D_t getDinv(const JointDataDerived & self )
static typename JointDataDerived::D_t get_Dinv(const JointDataDerived & self)
{ return self.Dinv_accessor(); }
static typename JointDataDerived::UD_t getUDinv(const JointDataDerived & self )
static typename JointDataDerived::UD_t get_UDinv(const JointDataDerived & self)
{ return self.UDinv_accessor(); }
static void expose()
{
}
{}
};
}} // namespace pinocchio::python
#endif // ifndef __pinocchio_python_joint_dense_hpp__
#endif // ifndef __pinocchio_python_joint_variants_hpp__
......@@ -33,7 +33,7 @@ namespace pinocchio
}
};
struct DataExposer
struct JointDataExposer
{
template<class T>
void operator()(T)
......@@ -49,7 +49,7 @@ namespace pinocchio
}
};
struct ModelExposer
struct JointModelExposer
{
template<class T>
void operator()(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