joint-derived.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_joint_variants_hpp__
6 #define __pinocchio_python_joint_variants_hpp__
7 
8 #include <boost/python.hpp>
9 #include <eigenpy/exception.hpp>
10 
11 #include "pinocchio/multibody/joint/joint-collection.hpp"
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17  namespace bp = boost::python;
18 
19  template<class JointModelDerived>
21  : public boost::python::def_visitor< JointModelDerivedPythonVisitor<JointModelDerived> >
22  {
23  public:
24 
25  template<class PyClass>
26  void visit(PyClass& cl) const
27  {
28  cl
29  .def(bp::init<>(bp::arg("self")))
30  // All are add_properties cause ReadOnly
31  .add_property("id",&get_id)
32  .add_property("idx_q",&get_idx_q)
33  .add_property("idx_v",&get_idx_v)
34  .add_property("nq",&get_nq)
35  .add_property("nv",&get_nv)
36  .def("setIndexes",
38  bp::args("self","id","idx_q","idx_v"))
39  .def("hasSameIndexes",
40  &JointModelDerived::template hasSameIndexes<JointModelDerived>,
41  bp::args("self","other"),
42  "Check if this has same indexes than other.")
43  .def("shortname",&JointModelDerived::shortname,bp::arg("self"))
44 
45  .def(bp::self == bp::self)
46  .def(bp::self != bp::self)
47  ;
48  }
49 
50  static JointIndex get_id(const JointModelDerived & self)
51  { return self.id(); }
52  static int get_idx_q(const JointModelDerived & self)
53  { return self.idx_q(); }
54  static int get_idx_v(const JointModelDerived & self)
55  { return self.idx_v(); }
56  static int get_nq(const JointModelDerived & self)
57  { return self.nq(); }
58  static int get_nv(const JointModelDerived & self)
59  { return self.nv(); }
60 
61  };
62 
63  template<class JointDataDerived>
65  : public boost::python::def_visitor< JointDataDerivedPythonVisitor<JointDataDerived> >
66  {
67  public:
68 
69  template<class PyClass>
70  void visit(PyClass& cl) const
71  {
72  cl
73  // All are add_properties cause ReadOnly
74  .add_property("S",&get_S)
75  .add_property("M",&get_M)
76  .add_property("v",&get_v)
77  .add_property("c",&get_c)
78  .add_property("U",&get_U)
79  .add_property("Dinv",&get_Dinv)
80  .add_property("UDinv",&get_UDinv)
81  .def("shortname",&JointDataDerived::shortname)
82 
83  .def(bp::self == bp::self)
84  .def(bp::self != bp::self)
85  ;
86  }
87 
88  static typename JointDataDerived::Constraint_t get_S(const JointDataDerived & self)
89  { return self.S_accessor(); }
90  static typename JointDataDerived::Transformation_t get_M(const JointDataDerived & self)
91  { return self.M_accessor(); }
92  static typename JointDataDerived::Motion_t get_v(const JointDataDerived & self)
93  { return self.v_accessor(); }
94  static typename JointDataDerived::Bias_t get_c(const JointDataDerived & self)
95  { return self.c_accessor(); }
96  static typename JointDataDerived::U_t get_U(const JointDataDerived & self)
97  { return self.U_accessor(); }
98  static typename JointDataDerived::D_t get_Dinv(const JointDataDerived & self)
99  { return self.Dinv_accessor(); }
100  static typename JointDataDerived::UD_t get_UDinv(const JointDataDerived & self)
101  { return self.UDinv_accessor(); }
102 
103  static void expose()
104  {}
105 
106  };
107 
108  }} // namespace pinocchio::python
109 
110 #endif // ifndef __pinocchio_python_joint_variants_hpp__
static JointDataDerived::D_t get_Dinv(const JointDataDerived &self)
static JointDataDerived::Transformation_t get_M(const JointDataDerived &self)
static JointDataDerived::Motion_t get_v(const JointDataDerived &self)
static JointDataDerived::Constraint_t get_S(const JointDataDerived &self)
static int get_idx_v(const JointModelDerived &self)
static JointDataDerived::U_t get_U(const JointDataDerived &self)
std::string shortname(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through JointShortnameVisitor to get the shortname of the derived joint model...
static JointDataDerived::UD_t get_UDinv(const JointDataDerived &self)
static int get_nq(const JointModelDerived &self)
Main pinocchio namespace.
Definition: timings.cpp:30
static JointIndex get_id(const JointModelDerived &self)
void setIndexes(JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel, JointIndex id, int q, int v)
Visit a JointModelTpl through JointSetIndexesVisitor to set the indexes of the joint in the kinematic...
static int get_idx_q(const JointModelDerived &self)
static JointDataDerived::Bias_t get_c(const JointDataDerived &self)
static int get_nv(const JointModelDerived &self)


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:03