joint.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_multibody_joint_joint_hpp__
6 #define __pinocchio_python_multibody_joint_joint_hpp__
7 
8 #include <boost/python.hpp>
9 
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17  namespace bp = boost::python;
18 
19  struct JointModelPythonVisitor : public boost::python::def_visitor<JointModelPythonVisitor>
20  {
21 
22  template<class PyClass>
23  void visit(PyClass & cl) const
24  {
25  cl.def(bp::init<>(bp::arg("self")))
26  // All are add_properties cause ReadOnly
27  .add_property("id", &getId)
28  .add_property("idx_q", &getIdx_q)
29  .add_property("idx_v", &getIdx_v)
30  .add_property("nq", &getNq)
31  .add_property("nv", &getNv)
32  .def(
33  "hasConfigurationLimit", &JointModel::hasConfigurationLimit,
34  "Return vector of boolean if joint has configuration limits.")
35  .def(
36  "hasConfigurationLimitInTangent", &JointModel::hasConfigurationLimitInTangent,
37  "Return vector of boolean if joint has configuration limits in tangent space.")
38  .def("setIndexes", &JointModel::setIndexes, bp::args("self", "id", "idx_q", "idx_v"))
39  .def(
40  "hasSameIndexes", &JointModel::hasSameIndexes<JointModel>, bp::args("self", "other"),
41  "Check if this has same indexes than other.")
42  .def(
43  "shortname", &JointModel::shortname, bp::arg("self"),
44  "Returns string indicating the joint type (class name):"
45  "\n\t- JointModelR[*]: Revolute Joint, with rotation axis [*] ∈ [X,Y,Z]"
46  "\n\t- JointModelRevoluteUnaligned: Revolute Joint, with rotation axis not aligned "
47  "with X, Y, nor Z"
48  "\n\t- JointModelRUB[*]: Unbounded revolute Joint (without position limits), with "
49  "rotation axis [*] ∈ [X,Y,Z]"
50  "\n\t- JointModelRevoluteUnboundedUnaligned: Unbounded revolute Joint, with "
51  "rotation axis not aligned with X, Y, nor Z"
52  "\n\t- JointModelP[*]: Prismatic Joint, with rotation axis [*] ∈ [X,Y,Z]"
53  "\n\t- JointModelPlanar: Planar joint"
54  "\n\t- JointModelPrismaticUnaligned: Prismatic joint, with translation axis not "
55  "aligned with X, Y, nor Z"
56  "\n\t- JointModelSphericalZYX: Spherical joint (3D rotation)"
57  "\n\t- JointModelTranslation: Translation joint (3D translation)"
58  "\n\t- JointModelFreeFlyer: Joint enabling 3D rotation and translations.")
59 
60  .def(bp::self == bp::self)
61  .def(bp::self != bp::self);
62  }
63 
64  static JointIndex getId(const JointModel & self)
65  {
66  return self.id();
67  }
68  static int getIdx_q(const JointModel & self)
69  {
70  return self.idx_q();
71  }
72  static int getIdx_v(const JointModel & self)
73  {
74  return self.idx_v();
75  }
76  static int getNq(const JointModel & self)
77  {
78  return self.nq();
79  }
80  static int getNv(const JointModel & self)
81  {
82  return self.nv();
83  }
84 
85  static void expose()
86  {
87  bp::class_<JointModel>("JointModel", "Generic Joint Model", bp::no_init)
88  .def(bp::init<JointModel>(bp::args("self", "other")))
91  }
92  };
93 
94  } // namespace python
95 } // namespace pinocchio
96 
97 #endif // ifndef __pinocchio_python_multibody_joint_joint_hpp__
boost::python
pinocchio::JointModelTpl< context::Scalar >::hasConfigurationLimitInTangent
const std::vector< bool > hasConfigurationLimitInTangent() const
Definition: joint-generic.hpp:294
pinocchio::python::JointModelPythonVisitor::getNq
static int getNq(const JointModel &self)
Definition: joint.hpp:76
pinocchio::python::JointModelPythonVisitor::getIdx_q
static int getIdx_q(const JointModel &self)
Definition: joint.hpp:68
pinocchio::JointModelTpl< context::Scalar >::hasConfigurationLimit
const std::vector< bool > hasConfigurationLimit() const
Definition: joint-generic.hpp:289
pinocchio::JointModelTpl< context::Scalar >::setIndexes
void setIndexes(JointIndex id, int nq, int nv)
Definition: joint-generic.hpp:414
pinocchio::python::PrintableVisitor
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
pinocchio::python::JointModelPythonVisitor::getId
static JointIndex getId(const JointModel &self)
Definition: joint.hpp:64
pinocchio::python::JointModelPythonVisitor::getNv
static int getNv(const JointModel &self)
Definition: joint.hpp:80
joint-generic.hpp
python
pinocchio::JointModelTpl< context::Scalar >
pinocchio::python::JointModelPythonVisitor
Definition: joint-model.hpp:38
pinocchio::python::JointModelPythonVisitor::getIdx_v
static int getIdx_v(const JointModel &self)
Definition: joint.hpp:72
pinocchio::python::JointModelPythonVisitor::visit
void visit(PyClass &cl) const
Definition: joint.hpp:23
cl
cl
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
printable.hpp
pinocchio::python::JointModelPythonVisitor::expose
static void expose()
Definition: joint.hpp:85
pinocchio::JointModelTpl< context::Scalar >::shortname
std::string shortname() const
Definition: joint-generic.hpp:382
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:11