geometry-model.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_geometry_model_hpp__
6 #define __pinocchio_python_geometry_model_hpp__
7 
8 #include <eigenpy/memory.hpp>
9 
12 #include "pinocchio/multibody/geometry.hpp"
13 
15 
16 namespace pinocchio
17 {
18  namespace python
19  {
20  namespace bp = boost::python;
21 
23  : public boost::python::def_visitor< GeometryModelPythonVisitor >
24  {
25  public:
26 
27  /* --- Exposing C++ API to python through the handler ----------------- */
28  template<class PyClass>
29  void visit(PyClass& cl) const
30  {
31  cl
32  .def(bp::init<>(bp::arg("self"),"Default constructor"))
33  .add_property("ngeoms", &GeometryModel::ngeoms, "Number of geometries contained in the Geometry Model.")
34  .add_property("geometryObjects",
35  &GeometryModel::geometryObjects,"Vector of geometries objects.")
36 
37  .def("addGeometryObject",
38  static_cast <GeometryModel::GeomIndex (GeometryModel::*)(const GeometryObject &)>(&GeometryModel::addGeometryObject),
39  bp::args("self","geometry_object"),
40  "Add a GeometryObject to a GeometryModel.\n"
41  "Parameters\n"
42  "\tgeometry_object : a GeometryObject\n")
43  .def("addGeometryObject",
44  static_cast <GeometryModel::GeomIndex (GeometryModel::*)(const GeometryObject &,
45  const Model &)>(&GeometryModel::addGeometryObject),
46  bp::args("self","geometry_object","model"),
47  "Add a GeometryObject to a GeometryModel and set its parent joint by reading its value in the model.\n"
48  "Parameters\n"
49  "\tgeometry_object : a GeometryObject\n"
50  "\tmodel : a Model of the system\n")
51  .def("getGeometryId",
52  &GeometryModel::getGeometryId,
53  bp::args("self","name"),
54  "Returns the index of a GeometryObject given by its name.")
55  .def("existGeometryName",
56  &GeometryModel::existGeometryName,
57  bp::args("self","name"),
58  "Checks if a GeometryObject given by its name exists.")
59  .def("createData",
61  bp::arg("self"),
62  "Create a GeometryData associated to the current model.")
63  .add_property("collisionPairs",
64  &GeometryModel::collisionPairs,
65  "Vector of collision pairs.")
66  .def("addCollisionPair",&GeometryModel::addCollisionPair,
67  bp::args("self","collision_pair"),
68  "Add a collision pair given by the index of the two collision objects.")
69  .def("addAllCollisionPairs",&GeometryModel::addAllCollisionPairs,
70  "Add all collision pairs.\n"
71  "note : collision pairs between geometries having the same parent joint are not added.")
72  .def("setCollisionPairs",
73  &GeometryModel::setCollisionPairs,
74  setCollisionPairs_overload(bp::args("self","collision_map","upper"),
75  "Set the collision pairs from a given input array.\n"
76  "Each entry of the input matrix defines the activation of a given collision pair"
77  "(map[i,j] == True means that the pair (i,j) is active)."))
78  .def("removeCollisionPair",&GeometryModel::removeCollisionPair,
79  bp::args("self","collision_pair"),
80  "Remove a collision pair.")
81  .def("removeAllCollisionPairs",&GeometryModel::removeAllCollisionPairs,
82  "Remove all collision pairs.")
83  .def("existCollisionPair",&GeometryModel::existCollisionPair,
84  bp::args("self","collision_pair"),
85  "Check if a collision pair exists.")
86  .def("findCollisionPair", &GeometryModel::findCollisionPair,
87  bp::args("self","collision_pair"),
88  "Return the index of a collision pair.")
89 
90  .def(bp::self == bp::self)
91  .def(bp::self != bp::self)
92  ;
93  }
94 
95  static GeometryData createData(const GeometryModel & geomModel)
96  {
97  return GeometryData(geomModel);
98  }
99 
100  /* --- Expose --------------------------------------------------------- */
101  static void expose()
102  {
103  bp::class_<GeometryModel>("GeometryModel",
104  "Geometry model containing the collision or visual geometries associated to a model.",
105  bp::no_init)
109  ;
110  }
111 
112  protected:
113 
114  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setCollisionPairs_overload,GeometryModel::setCollisionPairs,1,2)
115 
116  };
117 
118  } // namespace python
119 } // namespace pinocchio
120 
121 #endif // ifndef __pinocchio_python_geometry_model_hpp__
JointDataTpl< Scalar, Options, JointCollectionTpl > createData(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through CreateData visitor to create a JointDataTpl.
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
static GeometryData createData(const GeometryModel &geomModel)
Add the Python method copy to allow a copy of this by calling the copy constructor.
Definition: copyable.hpp:21
Main pinocchio namespace.
Definition: timings.cpp:30
#define EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(...)


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