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("idx_vExtended", &getIdx_vExtended)
31  .add_property("nq", &getNq)
32  .add_property("nv", &getNv)
33  .add_property("nvExtended", &getNvExtended)
34  .def(
35  "hasConfigurationLimit", &JointModel::hasConfigurationLimit,
36  "Return vector of boolean if joint has configuration limits.")
37  .def(
38  "hasConfigurationLimitInTangent", &JointModel::hasConfigurationLimitInTangent,
39  "Return vector of boolean if joint has configuration limits in tangent space.")
40  .def("setIndexes", setIndexes0, bp::args("self", "id", "idx_q", "idx_v"))
41  .def("setIndexes", setIndexes1, bp::args("self", "id", "idx_q", "idx_v", "idx_vExtended"))
42  .def(
43  "hasSameIndexes", &JointModel::hasSameIndexes<JointModel>, bp::args("self", "other"),
44  "Check if this has same indexes than other.")
45  .def(
46  "shortname", &JointModel::shortname, bp::arg("self"),
47  "Returns string indicating the joint type (class name):"
48  "\n\t- JointModelR[*]: Revolute Joint, with rotation axis [*] ∈ [X,Y,Z]"
49  "\n\t- JointModelRevoluteUnaligned: Revolute Joint, with rotation axis not aligned "
50  "with X, Y, nor Z"
51  "\n\t- JointModelRUB[*]: Unbounded revolute Joint (without position limits), with "
52  "rotation axis [*] ∈ [X,Y,Z]"
53  "\n\t- JointModelRevoluteUnboundedUnaligned: Unbounded revolute Joint, with "
54  "rotation axis not aligned with X, Y, nor Z"
55  "\n\t- JointModelP[*]: Prismatic Joint, with rotation axis [*] ∈ [X,Y,Z]"
56  "\n\t- JointModelPlanar: Planar joint"
57  "\n\t- JointModelPrismaticUnaligned: Prismatic joint, with translation axis not "
58  "aligned with X, Y, nor Z"
59  "\n\t- JointModelSphericalZYX: Spherical joint (3D rotation)"
60  "\n\t- JointModelTranslation: Translation joint (3D translation)"
61  "\n\t- JointModelFreeFlyer: Joint enabling 3D rotation and translations.")
62 
63  .def(bp::self == bp::self)
64  .def(bp::self != bp::self);
65  }
66 
67  static JointIndex getId(const JointModel & self)
68  {
69  return self.id();
70  }
71  static int getIdx_q(const JointModel & self)
72  {
73  return self.idx_q();
74  }
75  static int getIdx_v(const JointModel & self)
76  {
77  return self.idx_v();
78  }
79  static int getIdx_vExtended(const JointModel & self)
80  {
81  return self.idx_vExtended();
82  }
83  static int getNq(const JointModel & self)
84  {
85  return self.nq();
86  }
87  static int getNv(const JointModel & self)
88  {
89  return self.nv();
90  }
91  static int getNvExtended(const JointModel & self)
92  {
93  return self.nvExtended();
94  }
95 
96  static void
97  setIndexes0(JointModelDerived & self, const int & id, const int & idx_q, const int & idx_v)
98  {
99  self.setIndexes(id, idx_q, idx_v);
100  }
101 
102  static void setIndexes1(
103  JointModelDerived & self,
104  const int & id,
105  const int & idx_q,
106  const int & idx_v,
107  const int & idx_vExtended)
108  {
109  self.setIndexes(id, idx_q, idx_v, idx_vExtended);
110  }
111 
112  static void expose()
113  {
114  bp::class_<JointModel>("JointModel", "Generic Joint Model", bp::no_init)
115  .def(bp::init<JointModel>(bp::args("self", "other")))
118  }
119  };
120 
121  } // namespace python
122 } // namespace pinocchio
123 
124 #endif // ifndef __pinocchio_python_multibody_joint_joint_hpp__
pinocchio::python::JointModelPythonVisitor::getNvExtended
static int getNvExtended(const JointModel &self)
Definition: joint.hpp:91
boost::python
pinocchio::JointModelTpl::hasConfigurationLimitInTangent
const std::vector< bool > hasConfigurationLimitInTangent() const
Definition: joint-generic.hpp:297
pinocchio::python::JointModelPythonVisitor::getNq
static int getNq(const JointModel &self)
Definition: joint.hpp:83
pinocchio::idx_q
int idx_q(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxQVisitor to get the index in the full model configuration space...
pinocchio::idx_v
int idx_v(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdxVVisitor to get the index in the model tangent space correspond...
pinocchio::python::JointModelPythonVisitor::getIdx_q
static int getIdx_q(const JointModel &self)
Definition: joint.hpp:71
pinocchio::python::JointModelPythonVisitor::setIndexes1
static void setIndexes1(JointModelDerived &self, const int &id, const int &idx_q, const int &idx_v, const int &idx_vExtended)
Definition: joint.hpp:102
pinocchio::JointModelTpl::hasConfigurationLimit
const std::vector< bool > hasConfigurationLimit() const
Definition: joint-generic.hpp:292
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:67
pinocchio::python::JointModelPythonVisitor::setIndexes0
static void setIndexes0(JointModelDerived &self, const int &id, const int &idx_q, const int &idx_v)
Definition: joint.hpp:97
pinocchio::python::JointModelPythonVisitor::getNv
static int getNv(const JointModel &self)
Definition: joint.hpp:87
joint-generic.hpp
python
pinocchio::JointModelTpl
Definition: multibody/joint/fwd.hpp:169
pinocchio::python::JointModelPythonVisitor
Definition: joint-model.hpp:38
pinocchio::idx_vExtended
int idx_vExtended(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointIdvExtendedVisitor to get the index in the model extended tangent ...
pinocchio::python::JointModelPythonVisitor::getIdx_v
static int getIdx_v(const JointModel &self)
Definition: joint.hpp:75
pinocchio::python::JointModelPythonVisitor::visit
void visit(PyClass &cl) const
Definition: joint.hpp:23
cl
cl
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::python::JointModelPythonVisitor::getIdx_vExtended
static int getIdx_vExtended(const JointModel &self)
Definition: joint.hpp:79
printable.hpp
pinocchio::python::JointModelPythonVisitor::expose
static void expose()
Definition: joint.hpp:112
pinocchio::JointModelTpl::shortname
std::string shortname() const
Definition: joint-generic.hpp:410
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:33


pinocchio
Author(s):
autogenerated on Thu Apr 10 2025 02:42:20