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",
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 &,
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("removeGeometryObject",
53  bp::args("self","name"),
54  "Remove a GeometryObject. Remove also the collision pairs that contain the object.")
55  .def("getGeometryId",
57  bp::args("self","name"),
58  "Returns the index of a GeometryObject given by its name.")
59  .def("existGeometryName",
61  bp::args("self","name"),
62  "Checks if a GeometryObject given by its name exists.")
63  .def("createData",
65  bp::arg("self"),
66  "Create a GeometryData associated to the current model.")
67  .add_property("collisionPairs",
69  "Vector of collision pairs.")
70  .def("addCollisionPair",&GeometryModel::addCollisionPair,
71  bp::args("self","collision_pair"),
72  "Add a collision pair given by the index of the two collision objects.")
73  .def("addAllCollisionPairs",&GeometryModel::addAllCollisionPairs,
74  "Add all collision pairs.\n"
75  "note : collision pairs between geometries having the same parent joint are not added.")
76  .def("setCollisionPairs",
78  setCollisionPairs_overload(bp::args("self","collision_map","upper"),
79  "Set the collision pairs from a given input array.\n"
80  "Each entry of the input matrix defines the activation of a given collision pair"
81  "(map[i,j] == True means that the pair (i,j) is active)."))
82  .def("removeCollisionPair",&GeometryModel::removeCollisionPair,
83  bp::args("self","collision_pair"),
84  "Remove a collision pair.")
85  .def("removeAllCollisionPairs",&GeometryModel::removeAllCollisionPairs,
86  "Remove all collision pairs.")
87  .def("existCollisionPair",&GeometryModel::existCollisionPair,
88  bp::args("self","collision_pair"),
89  "Check if a collision pair exists.")
90  .def("findCollisionPair", &GeometryModel::findCollisionPair,
91  bp::args("self","collision_pair"),
92  "Return the index of a collision pair.")
93 
94  .def(bp::self == bp::self)
95  .def(bp::self != bp::self)
96  ;
97  }
98 
99  static GeometryData createData(const GeometryModel & geomModel)
100  {
101  return GeometryData(geomModel);
102  }
103 
104  /* --- Expose --------------------------------------------------------- */
105  static void expose()
106  {
107  bp::class_<GeometryModel>("GeometryModel",
108  "Geometry model containing the collision or visual geometries associated to a model.",
109  bp::no_init)
113  ;
114  }
115 
116  protected:
117 
118  BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setCollisionPairs_overload,GeometryModel::setCollisionPairs,1,2)
119 
120  };
121 
122  } // namespace python
123 } // namespace pinocchio
124 
125 #endif // ifndef __pinocchio_python_geometry_model_hpp__
CollisionPairVector collisionPairs
Vector of collision pairs.
bool existCollisionPair(const CollisionPair &pair) const
Check if a collision pair exists in collisionPairs. See also findCollisitionPair(const CollisionPair ...
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
void def(const char *name, Func func)
PairIndex findCollisionPair(const CollisionPair &pair) const
Return the index of a given collision pair in collisionPairs.
void removeCollisionPair(const CollisionPair &pair)
Remove if exists the CollisionPair from the vector collision_pairs.
static GeometryData createData(const GeometryModel &geomModel)
void removeGeometryObject(const std::string &name)
Remove a GeometryObject.
GeometryObjectVector geometryObjects
Vector of GeometryObjects used for collision computations.
GeomIndex getGeometryId(const std::string &name) const
Return the index of a GeometryObject given by its name.
bool existGeometryName(const std::string &name) const
Check if a GeometryObject given by its name exists.
Add the Python method copy to allow a copy of this by calling the copy constructor.
Definition: copyable.hpp:21
Index ngeoms
The number of GeometryObjects.
void addAllCollisionPairs()
Add all possible collision pairs.
void setCollisionPairs(const MatrixXb &collision_map, const bool upper=true)
Set the collision pairs from a given input array. Each entry of the input matrix defines the activati...
Main pinocchio namespace.
Definition: timings.cpp:28
void addCollisionPair(const CollisionPair &pair)
Add a collision pair into the vector of collision_pairs. The method check before if the given Collisi...
#define EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(...)
void removeAllCollisionPairs()
Remove all collision pairs from collisionPairs. Same as collisionPairs.clear().
GeomIndex addGeometryObject(const GeometryObject &object, const ModelTpl< S2, O2, _JointCollectionTpl > &model)
Add a geometry object to a GeometryModel and set its parent joint.


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:30