5#ifndef __pinocchio_python_geometry_data_hpp__
6#define __pinocchio_python_geometry_data_hpp__
8#include <eigenpy/memory.hpp>
10#include "pinocchio/serialization/geometry.hpp"
12#include "pinocchio/bindings/python/utils/address.hpp"
13#include "pinocchio/bindings/python/utils/printable.hpp"
14#include "pinocchio/bindings/python/utils/copyable.hpp"
15#include "pinocchio/bindings/python/utils/std-vector.hpp"
16#include "pinocchio/bindings/python/utils/registration.hpp"
17#include "pinocchio/bindings/python/serialization/serializable.hpp"
19#if EIGENPY_VERSION_AT_MOST(2, 8, 1)
27 namespace bp = boost::python;
32 struct CollisionPairPythonVisitor
33 :
public boost::python::def_visitor<CollisionPairPythonVisitor>
37 if (!register_symbolic_link_to_registered_type<CollisionPair>())
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."))
44 .def(PrintableVisitor<CollisionPair>())
45 .def(CopyableVisitor<CollisionPair>())
46 .def(bp::self == bp::self)
47 .def(bp::self != bp::self)
48 .def_readwrite(
"first", &CollisionPair::first)
49 .def_readwrite(
"second", &CollisionPair::second);
51 StdVectorPythonVisitor<std::vector<CollisionPair>>::expose(
"StdVec_CollisionPair");
52 serialize<std::vector<CollisionPair>>();
57 struct GeometryDataPythonVisitor :
public boost::python::def_visitor<GeometryDataPythonVisitor>
61 template<
class PyClass>
62 void visit(PyClass & cl)
const
65 .def(bp::init<const GeometryModel &>(
66 bp::args(
"self",
"geometry_model"),
"Default constructor from a given GeometryModel."))
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.")
74 "Vector of active CollisionPairs")
76#ifdef PINOCCHIO_WITH_HPP_FCL
79 "Defines which information should be computed by FCL for distance computations")
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 "
87 "Most likely, for robotics application, these thresholds will be different for each "
89 "(e.g. the two hands can have a large security margin while the two hips cannot.)")
93 "collision_functors", &GeometryData::collision_functors,
94 "Vector of collision functors.")
96 "distance_functors", &GeometryData::distance_functors,
"Vector of distance functors.")
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")
106 bp::args(
"self",
"geometry_model"),
"Fill inner and outer objects maps")
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.")
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.")
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.")
127 bp::args(
"self",
"pair_id"),
128 "Deactivate the collsion pair pair_id in geomModel.collisionPairs if it exists.")
131 bp::args(
"self"),
"Deactivate all collision pairs.")
132#ifdef PINOCCHIO_WITH_HPP_FCL
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.")
141 .def(bp::self == bp::self)
142 .def(bp::self != bp::self)
146 bp::register_ptr_to_python<std::shared_ptr<GeometryData>>();
152 if (!register_symbolic_link_to_registered_type<GeometryData>())
154 bp::class_<GeometryData>(
155 "GeometryData",
"Geometry data linked to a Geometry Model and a Data struct.",
157 .def(GeometryDataPythonVisitor())
158 .def(PrintableVisitor<GeometryData>())
159 .def(CopyableVisitor<GeometryData>())
160 .def(SerializableVisitor<GeometryData>())
161 .def(AddressVisitor<GeometryModel>());
Main pinocchio namespace.
void deactivateCollisionPair(const PairIndex pair_id)
std::vector< fcl::CollisionRequest > collisionRequests
Defines what information should be computed by collision test. There is one request per pair of geome...
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...
std::vector< Scalar > radius
Radius of the bodies, i.e. distance of the further point of the geometry model attached to the body f...
void activateCollisionPair(const PairIndex pair_id)
void deactivateAllCollisionPairs()
Deactivate all collision pairs.
void setSecurityMargins(const GeometryModel &geom_model, const MatrixXs &security_margin_map, const bool upper=true, const bool sync_distance_upper_bound=false)
Set the security margin of all the collision request in a row, according to the values stored in the ...
std::vector< fcl::DistanceResult > distanceResults
Vector gathering the result of the distance computation for all the collision pairs.
std::vector< bool > activeCollisionPairs
Vector of collision pairs.
std::vector< fcl::CollisionResult > collisionResults
Vector gathering the result of the collision computation for all the collision pairs.
std::vector< fcl::DistanceRequest > distanceRequests
Defines what information should be computed by distance computation. There is one request per pair of...
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...
void fillInnerOuterObjectMaps(const GeometryModel &geomModel)