5#ifndef __pinocchio_python_multibody_joint_joint_base_hpp__
6#define __pinocchio_python_multibody_joint_joint_base_hpp__
8#include <boost/python.hpp>
9#include <eigenpy/exception.hpp>
11#include "pinocchio/bindings/python/fwd.hpp"
12#include "pinocchio/multibody/joint/joint-collection.hpp"
18 namespace bp = boost::python;
20 template<
class Jo
intModelDerived>
21 struct JointModelBasePythonVisitor
22 :
public boost::python::def_visitor<JointModelBasePythonVisitor<JointModelDerived>>
25 typedef typename JointModelDerived::JointDataDerived JointDataDerived;
27 template<
class PyClass>
28 void visit(PyClass & cl)
const
30 cl.def(bp::init<>(bp::arg(
"self")))
32 .add_property(
"id", &get_id)
33 .add_property(
"idx_q", &get_idx_q)
34 .add_property(
"idx_v", &get_idx_v)
35 .add_property(
"idx_vExtended", &get_idx_vExtended)
36 .add_property(
"nq", &get_nq)
37 .add_property(
"nv", &get_nv)
38 .add_property(
"nvExtended", &get_nvExtended)
40 "hasConfigurationLimit", &JointModelDerived::hasConfigurationLimit,
41 "Return vector of boolean if joint has configuration limits.")
43 "hasConfigurationLimitInTangent", &JointModelDerived::hasConfigurationLimitInTangent,
44 "Return vector of boolean if joint has configuration limits in tangent space.")
45 .def(
"setIndexes", &setIndexes0, bp::args(
"self",
"joint_id",
"idx_q",
"idx_v"))
47 "setIndexes", &setIndexes1,
48 bp::args(
"self",
"joint_id",
"idx_q",
"idx_v",
"idx_vExtended"))
49 .def(
"classname", &JointModelDerived::classname)
50 .staticmethod(
"classname")
51 .def(
"calc", &calc0, bp::args(
"self",
"jdata",
"q"))
52 .def(
"calc", &calc1, bp::args(
"self",
"jdata",
"q",
"v"))
54 "createData", &JointModelDerived::createData, bp::arg(
"self"),
55 "Create data associated to the joint model.")
57 "hasSameIndexes", &JointModelDerived::template hasSameIndexes<JointModelDerived>,
58 bp::args(
"self",
"other"),
"Check if this has same indexes than other.")
60 "shortname", &JointModelDerived::shortname, bp::arg(
"self"),
61 "Returns string indicating the joint type (class name):"
62 "\n\t- JointModelR[*]: Revolute Joint, with rotation axis [*] ∈ [X,Y,Z]"
63 "\n\t- JointModelRevoluteUnaligned: Revolute Joint, with rotation axis not aligned "
65 "\n\t- JointModelRUB[*]: Unbounded revolute Joint (without position limits), with "
66 "rotation axis [*] ∈ [X,Y,Z]"
67 "\n\t- JointModelRevoluteUnboundedUnaligned: Unbounded revolute Joint, with "
68 "rotation axis not aligned with X, Y, nor Z"
69 "\n\t- JointModelP[*]: Prismatic Joint, with rotation axis [*] ∈ [X,Y,Z]"
70 "\n\t- JointModelPlanar: Planar joint"
71 "\n\t- JointModelPrismaticUnaligned: Prismatic joint, with translation axis not "
72 "aligned with X, Y, nor Z"
73 "\n\t- JointModelSphericalZYX: Spherical joint (3D rotation)"
74 "\n\t- JointModelTranslation: Translation joint (3D translation)"
75 "\n\t- JointModelFreeFlyer: Joint enabling 3D rotation and translations.")
77#ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
78 .def(bp::self == bp::self)
79 .def(bp::self != bp::self)
84 static JointIndex get_id(
const JointModelDerived & self)
88 static int get_idx_q(
const JointModelDerived & self)
92 static int get_idx_v(
const JointModelDerived & self)
96 static int get_idx_vExtended(
const JointModelDerived & self)
98 return self.idx_vExtended();
100 static int get_nq(
const JointModelDerived & self)
104 static int get_nv(
const JointModelDerived & self)
108 static int get_nvExtended(
const JointModelDerived & self)
110 return self.nvExtended();
114 calc0(
const JointModelDerived & self, JointDataDerived & jdata,
const context::VectorXs & q)
119 const JointModelDerived & self,
120 JointDataDerived & jdata,
121 const context::VectorXs & q,
122 const context::VectorXs & v)
124 self.calc(jdata, q, v);
128 setIndexes0(JointModelDerived & self,
const int &
id,
const int &
idx_q,
const int &
idx_v)
133 static void setIndexes1(
134 JointModelDerived & self,
144 template<
class Jo
intDataDerived>
145 struct JointDataBasePythonVisitor
146 :
public boost::python::def_visitor<JointDataBasePythonVisitor<JointDataDerived>>
149 template<
class PyClass>
150 void visit(PyClass & cl)
const
154 .add_property(
"joint_q", &get_joint_q)
155 .add_property(
"joint_v", &get_joint_v)
156 .add_property(
"S", &get_S)
157 .add_property(
"M", &get_M)
158 .add_property(
"v", &get_v)
159 .add_property(
"c", &get_c)
160 .add_property(
"U", &get_U)
161 .add_property(
"Dinv", &get_Dinv)
162 .add_property(
"UDinv", &get_UDinv)
163 .def(
"shortname", &JointDataDerived::shortname, bp::arg(
"self"))
165#ifndef PINOCCHIO_PYTHON_SKIP_COMPARISON_OPERATIONS
166 .def(bp::self == bp::self)
167 .def(bp::self != bp::self)
172 static typename JointDataDerived::ConfigVector_t get_joint_q(
const JointDataDerived & self)
174 return self.joint_q_accessor();
176 static typename JointDataDerived::TangentVector_t get_joint_v(
const JointDataDerived & self)
178 return self.joint_v_accessor();
182 static typename JointDataDerived::Constraint_t::DenseBase get_S(
const JointDataDerived & self)
184 return self.S_accessor().matrix();
186 static typename JointDataDerived::Transformation_t get_M(
const JointDataDerived & self)
188 return self.M_accessor();
190 static typename JointDataDerived::Motion_t get_v(
const JointDataDerived & self)
192 return self.v_accessor();
194 static typename JointDataDerived::Bias_t get_c(
const JointDataDerived & self)
196 return self.c_accessor();
198 static typename JointDataDerived::U_t get_U(
const JointDataDerived & self)
200 return self.U_accessor();
202 static typename JointDataDerived::D_t get_Dinv(
const JointDataDerived & self)
204 return self.Dinv_accessor();
206 static typename JointDataDerived::UD_t get_UDinv(
const JointDataDerived & self)
208 return self.UDinv_accessor();
Main pinocchio namespace.
int idx_v(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxVVisitor to get the index in the model tangent space correspond...
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
int idx_vExtended(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdvExtendedVisitor to get the index in the model extended tangent ...