bindings/python/collision/broadphase-manager.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_python_collision_broadphase_manager_hpp__
6 #define __pinocchio_python_collision_broadphase_manager_hpp__
7 
10 
12 #include <boost/algorithm/string/replace.hpp>
13 
14 namespace pinocchio
15 {
16  namespace python
17  {
18  namespace bp = boost::python;
19 
20  template<typename Derived>
22  : public bp::def_visitor<BroadPhaseManagerPythonVisitor<Derived>>
23  {
24  public:
27 
28  /* --- Exposing C++ API to python through the handler ----------------- */
29  template<class PyClass>
30  void visit(PyClass & cl) const
31  {
32  cl
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>()])
39 
40  .def(
41  "getCollisionObjectInflation", &Self::getCollisionObjectInflation, bp::arg("self"),
42  "Returns the inflation value related to each collision object.",
43  bp::return_internal_reference<>())
44  .def(
45  "getCollisionObjects",
46  (CollisionObjectVector & (Self::*)()) & Self::getCollisionObjects, bp::arg("self"),
47  bp::return_internal_reference<>())
48 
49  .def(
50  "getManager", (Derived & (Self::*)()) & Self::getManager, bp::arg("self"),
51  "Returns the internal FCL manager", bp::return_internal_reference<>())
52 
53  .def(
54  "getCollisionObjectStatus", &Self::getCollisionObjectStatus, bp::arg("self"),
55  "Returns the status of the collision object.",
56  bp::return_value_policy<bp::copy_const_reference>())
57 
59  }
60 
61  /* --- Expose --------------------------------------------------------- */
62  static void expose()
63  {
64  std::string derived_name = boost::typeindex::type_id<Derived>().pretty_name();
65  boost::algorithm::replace_all(derived_name, "hpp::fcl::", "");
66  const std::string class_name = "BroadPhaseManager_" + derived_name;
67 
68  const std::string class_doc = "Broad phase manager associated to hpp::fcl::" + derived_name;
69  bp::class_<Self> registered_class(class_name.c_str(), class_doc.c_str(), bp::no_init);
70  registered_class.def(BroadPhaseManagerPythonVisitor());
71 
73  bp::objects::register_dynamic_id<Base>();
74  bp::objects::register_conversion<Self, Base>(false);
75  }
76  };
77 
78  } // namespace python
79 } // namespace pinocchio
80 
81 #endif // ifndef __pinocchio_python_collision_broadphase_manager_hpp__
boost::python
pinocchio::python::BroadPhaseManagerBasePythonVisitor
Definition: bindings/python/collision/broadphase-manager-base.hpp:19
pinocchio::BroadPhaseManagerBase
Definition: collision/broadphase-manager-base.hpp:15
Base
BVNodeBase Base
eigen-to-python.hpp
pinocchio::python::BroadPhaseManagerPythonVisitor::CollisionObjectVector
Self::CollisionObjectVector CollisionObjectVector
Definition: bindings/python/collision/broadphase-manager.hpp:26
pinocchio::BroadPhaseManagerTpl::getCollisionObjectStatus
const std::vector< bool > & getCollisionObjectStatus() const
Returns the status of the collision object.
Definition: collision/broadphase-manager.hpp:176
pinocchio::python::BroadPhaseManagerPythonVisitor::visit
void visit(PyClass &cl) const
Definition: bindings/python/collision/broadphase-manager.hpp:30
python
pinocchio::BroadPhaseManagerTpl::getManager
Manager & getManager()
Returns internal manager.
Definition: collision/broadphase-manager.hpp:164
broadphase-manager-base.hpp
class_doc
const char * class_doc()
pinocchio::python::BroadPhaseManagerPythonVisitor::Self
BroadPhaseManagerTpl< Derived > Self
Definition: bindings/python/collision/broadphase-manager.hpp:25
pinocchio::BroadPhaseManagerTpl::getCollisionObjectInflation
const VectorXs & getCollisionObjectInflation()
Returns the inflation value related to each collision object.
Definition: collision/broadphase-manager.hpp:138
pinocchio::BroadPhaseManagerTpl::getCollisionObjects
const CollisionObjectVector & getCollisionObjects() const
Returns the vector of collision objects associated to the manager.
Definition: collision/broadphase-manager.hpp:127
cl
cl
pinocchio::python::BroadPhaseManagerPythonVisitor::expose
static void expose()
Definition: bindings/python/collision/broadphase-manager.hpp:62
pinocchio::BroadPhaseManagerTpl::CollisionObjectVector
std::vector< CollisionObject > CollisionObjectVector
Definition: collision/broadphase-manager.hpp:22
broadphase-manager.hpp
pinocchio::BroadPhaseManagerTpl
Definition: collision/broadphase-manager.hpp:17
pinocchio::python::BroadPhaseManagerPythonVisitor
Definition: bindings/python/collision/broadphase-manager.hpp:21
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:06