geometry-data.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2015-2022 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_geometry_data_hpp__
6 #define __pinocchio_python_geometry_data_hpp__
7 
8 #include <eigenpy/memory.hpp>
9 
11 
18 
19 #if EIGENPY_VERSION_AT_MOST(2, 8, 1)
21 #endif
22 
23 namespace pinocchio
24 {
25  namespace python
26  {
27  namespace bp = boost::python;
28 
29  /* --- COLLISION PAIR --------------------------------------------------- */
30  /* --- COLLISION PAIR --------------------------------------------------- */
31  /* --- COLLISION PAIR --------------------------------------------------- */
33  : public boost::python::def_visitor<CollisionPairPythonVisitor>
34  {
35  static void expose()
36  {
37  if (!register_symbolic_link_to_registered_type<CollisionPair>())
38  {
39  bp::class_<CollisionPair>(
40  "CollisionPair", "Pair of ordered index defining a pair of collisions", bp::no_init)
41  .def(bp::init<>(bp::args("self"), "Empty constructor."))
42  .def(bp::init<const GeomIndex &, const GeomIndex &>(
43  bp::args("self", "index1", "index2"), "Initializer of collision pair."))
46  .def(bp::self == bp::self)
47  .def(bp::self != bp::self)
48  .def_readwrite("first", &CollisionPair::first)
49  .def_readwrite("second", &CollisionPair::second);
50 
52  serialize<std::vector<CollisionPair>>();
53  }
54  }
55  }; // struct CollisionPairPythonVisitor
56 
57  struct GeometryDataPythonVisitor : public boost::python::def_visitor<GeometryDataPythonVisitor>
58  {
59 
60  /* --- Exposing C++ API to python through the handler ----------------- */
61  template<class PyClass>
62  void visit(PyClass & cl) const
63  {
64  cl
65  .def(bp::init<const GeometryModel &>(
66  bp::args("self", "geometry_model"), "Default constructor from a given GeometryModel."))
67 
68  .def_readwrite(
69  "oMg", &GeometryData::oMg,
70  "Vector of collision objects placement relative to the world frame.\n"
71  "note: These quantities have to be updated by calling updateGeometryPlacements.")
72  .def_readwrite(
73  "activeCollisionPairs", &GeometryData::activeCollisionPairs,
74  "Vector of active CollisionPairs")
75 
76 #ifdef PINOCCHIO_WITH_HPP_FCL
77  .def_readwrite(
78  "distanceRequests", &GeometryData::distanceRequests,
79  "Defines which information should be computed by FCL for distance computations")
80  .def_readwrite(
81  "distanceResults", &GeometryData::distanceResults, "Vector of distance results.")
82  .def_readwrite(
83  "collisionRequests", &GeometryData::collisionRequests,
84  "Defines which information should be computed by FCL for collision computations.\n\n"
85  "Note: it is possible to define a security_margin and a break_distance for a collision "
86  "request.\n"
87  "Most likely, for robotics application, these thresholds will be different for each "
88  "collision pairs\n"
89  "(e.g. the two hands can have a large security margin while the two hips cannot.)")
90  .def_readwrite(
91  "collisionResults", &GeometryData::collisionResults, "Vector of collision results.")
92  .def_readwrite(
93  "collision_functors", &GeometryData::collision_functors,
94  "Vector of collision functors.")
95  .def_readwrite(
96  "distance_functors", &GeometryData::distance_functors, "Vector of distance functors.")
97  .def_readwrite(
98  "radius", &GeometryData::radius,
99  "Vector of radius of bodies, i.e. the distance between the further point of the "
100  "geometry object from the joint center.\n"
101  "note: This radius information might be usuful in continuous collision checking")
102 #endif // PINOCCHIO_WITH_HPP_FCL
103 
104  .def(
105  "fillInnerOuterObjectMaps", &GeometryData::fillInnerOuterObjectMaps,
106  bp::args("self", "geometry_model"), "Fill inner and outer objects maps")
107  .def(
108  "activateCollisionPair",
109  static_cast<void (GeometryData::*)(const PairIndex)>(
111  bp::args("self", "pair_id"),
112  "Activate the collsion pair pair_id in geomModel.collisionPairs if it exists.\n"
113  "note: Only active pairs are check for collision and distance computations.")
114  .def(
115  "setGeometryCollisionStatus", &GeometryData::setGeometryCollisionStatus,
116  bp::args("self", "geom_model", "geom_id", "enable_collision"),
117  "Enable or disable collision for the given geometry given by its geometry id with "
118  "all the other geometries registered in the list of collision pairs.")
119  .def(
120  "setActiveCollisionPairs", &GeometryData::setActiveCollisionPairs,
121  (bp::arg("self"), bp::arg("geometry_model"), bp::arg("collision_map"),
122  bp::arg("upper") = true),
123  "Set the collision pair association from a given input array.\n"
124  "Each entry of the input matrix defines the activation of a given collision pair.")
125  .def(
126  "deactivateCollisionPair", &GeometryData::deactivateCollisionPair,
127  bp::args("self", "pair_id"),
128  "Deactivate the collsion pair pair_id in geomModel.collisionPairs if it exists.")
129  .def(
130  "deactivateAllCollisionPairs", &GeometryData::deactivateAllCollisionPairs,
131  bp::args("self"), "Deactivate all collision pairs.")
132 #ifdef PINOCCHIO_WITH_HPP_FCL
133  .def(
134  "setSecurityMargins", &GeometryData::setSecurityMargins,
135  (bp::arg("self"), bp::arg("geometry_model"), bp::arg("security_margin_map"),
136  bp::arg("upper") = true, bp::arg("sync_distance_upper_bound") = true),
137  "Set the security margin of all the collision request in a row, according to the "
138  "values stored in the associative map.")
139 #endif // PINOCCHIO_WITH_HPP_FCL
140 
141  .def(bp::self == bp::self)
142  .def(bp::self != bp::self)
143 
144  ;
145  }
146 
147  /* --- Expose --------------------------------------------------------- */
148  static void expose()
149  {
150  if (!register_symbolic_link_to_registered_type<GeometryData>())
151  {
152  bp::class_<GeometryData>(
153  "GeometryData", "Geometry data linked to a Geometry Model and a Data struct.",
154  bp::no_init)
160  }
161  }
162  };
163 
164  } // namespace python
165 } // namespace pinocchio
166 
167 #endif // ifndef __pinocchio_python_geometry_data_hpp__
boost::python
pinocchio::GeometryData::setActiveCollisionPairs
void setActiveCollisionPairs(const GeometryModel &geom_model, const MatrixXb &collision_map, const bool upper=true)
Set the collision pair association from a given input array. Each entry of the input matrix defines t...
registration.hpp
pinocchio::GeometryData::fillInnerOuterObjectMaps
void fillInnerOuterObjectMaps(const GeometryModel &geomModel)
eigenpy::StdVectorPythonVisitor
pinocchio::GeometryData::activateCollisionPair
void activateCollisionPair(const PairIndex pair_id)
pinocchio::GeometryData
Definition: multibody/geometry.hpp:233
EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION
#define EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(...)
pinocchio::python::PrintableVisitor
Set the Python method str and repr to use the overloading operator<<.
Definition: printable.hpp:21
pinocchio::python::GeometryDataPythonVisitor::visit
void visit(PyClass &cl) const
Definition: geometry-data.hpp:62
serializable.hpp
pinocchio::GeometryData::activeCollisionPairs
std::vector< bool > activeCollisionPairs
Vector of collision pairs.
Definition: multibody/geometry.hpp:267
python
geometry.hpp
pinocchio::PairIndex
Index PairIndex
Definition: multibody/fwd.hpp:29
pinocchio::python::CopyableVisitor
Add the Python method copy to allow a copy of this by calling the copy constructor.
Definition: copyable.hpp:21
address.hpp
pinocchio::GeometryData::deactivateAllCollisionPairs
void deactivateAllCollisionPairs()
Deactivate all collision pairs.
pinocchio::GeometryData::setGeometryCollisionStatus
void setGeometryCollisionStatus(const GeometryModel &geom_model, const GeomIndex geom_id, bool enable_collision)
Enable or disable collision for the given geometry given by its geometry id with all the other geomet...
copyable.hpp
pinocchio::python::SerializableVisitor
Definition: bindings/python/serialization/serializable.hpp:19
pinocchio::python::GeometryDataPythonVisitor::expose
static void expose()
Definition: geometry-data.hpp:148
pinocchio::python::AddressVisitor
Add the Python method to extract the address of the underlying C++ object.
Definition: address.hpp:21
pinocchio::GeometryData::deactivateCollisionPair
void deactivateCollisionPair(const PairIndex pair_id)
pinocchio::python::CollisionPairPythonVisitor
Definition: geometry-data.hpp:32
cl
cl
pinocchio::python::GeometryDataPythonVisitor
Definition: geometry-data.hpp:57
memory.hpp
printable.hpp
std-vector.hpp
pinocchio::python::CollisionPairPythonVisitor::expose
static void expose()
Definition: geometry-data.hpp:35
radius
FCL_REAL radius
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Tue Jun 25 2024 02:42:37