5#ifndef __pinocchio_python_collision_broadphase_manager_hpp__
6#define __pinocchio_python_collision_broadphase_manager_hpp__
8#include "pinocchio/collision/broadphase-manager.hpp"
9#include "pinocchio/bindings/python/collision/broadphase-manager-base.hpp"
11#include <eigenpy/eigen-to-python.hpp>
12#include <boost/algorithm/string/replace.hpp>
18 namespace bp = boost::python;
20 template<
typename Derived>
21 struct BroadPhaseManagerPythonVisitor
22 :
public bp::def_visitor<BroadPhaseManagerPythonVisitor<Derived>>
25 typedef BroadPhaseManagerTpl<Derived> Self;
26 typedef typename Self::CollisionObjectVector CollisionObjectVector;
29 template<
class PyClass>
30 void visit(PyClass & cl)
const
33 .def(bp::init<const Model *, const GeometryModel *, GeometryData *>(
34 bp::args(
"self",
"model",
"geometry_model",
"geometry_data"),
"Default constructor")
35 [bp::with_custodian_and_ward<1, 2>(), bp::with_custodian_and_ward<1, 3>(),
36 bp::with_custodian_and_ward<1, 4>()])
37 .def(bp::init<const Self &>(
38 bp::args(
"self",
"other"),
"Copy constructor")[bp::with_custodian_and_ward<1, 2>()])
41 "getCollisionObjectInflation", &Self::getCollisionObjectInflation, bp::arg(
"self"),
42 "Returns the inflation value related to each collision object.",
43 bp::return_internal_reference<>())
45 "getCollisionObjects",
46 (CollisionObjectVector & (Self::*)()) & Self::getCollisionObjects, bp::arg(
"self"),
47 bp::return_internal_reference<>())
50 "getManager", (Derived & (Self::*)()) & Self::getManager, bp::arg(
"self"),
51 "Returns the internal FCL manager", bp::return_internal_reference<>())
54 "getCollisionObjectStatus", &Self::getCollisionObjectStatus, bp::arg(
"self"),
55 "Returns the status of the collision object.",
56 bp::return_value_policy<bp::copy_const_reference>())
58 .def(BroadPhaseManagerBasePythonVisitor<Self>());
64 std::string derived_name = boost::typeindex::type_id<Derived>().pretty_name();
65 boost::algorithm::replace_all(derived_name,
"coal::",
"");
66 const std::string class_name =
"BroadPhaseManager_" + derived_name;
68 const std::string class_doc =
"Broad phase manager associated to coal::" + derived_name;
69 bp::class_<Self> registered_class(class_name.c_str(), class_doc.c_str(), bp::no_init);
70 registered_class.def(BroadPhaseManagerPythonVisitor());
72 typedef BroadPhaseManagerBase<Self> Base;
73 bp::objects::register_dynamic_id<Base>();
74 bp::objects::register_conversion<Self, Base>(
false);
Main pinocchio namespace.