5 #ifndef __pinocchio_python_geometry_object_hpp__
6 #define __pinocchio_python_geometry_object_hpp__
21 #if EIGENPY_VERSION_AT_MOST(2, 8, 1)
35 struct GeometryMaterialValueToObject : boost::static_visitor<PyObject *>
39 return apply_visitor(GeometryMaterialValueToObject(), gm);
43 result_type operator()(
T &
t)
const
45 return bp::incref(bp::object(
t).ptr());
53 struct GeometryMaterialRefToObject : boost::static_visitor<PyObject *>
57 return apply_visitor(GeometryMaterialRefToObject(), gm);
61 result_type operator()(
T &
t)
const
63 return bp::detail::make_reference_holder::execute(&
t);
70 struct GeometryMaterialConverter
79 return GeometryMaterialRefToObject::convert(gm);
82 #ifndef BOOST_PYTHON_NO_PY_SIGNATURES
83 inline PyTypeObject
const * get_pytype()
const
85 return bp::converter::registered_pytype<GeometryMaterial>::get_pytype();
94 struct GeometryMaterialReturnInternalVariant : bp::return_internal_reference<>
97 typedef GeometryMaterialConverter result_converter;
102 :
public boost::python::def_visitor<GeometryObjectPythonVisitor>
107 template<
class PyClass>
113 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
116 "self",
"name",
"parent_joint",
"parent_frame",
"placement",
117 "collision_geometry",
"mesh_path",
"mesh_scale",
"override_material",
118 "mesh_color",
"mesh_texture_path",
"mesh_material"),
119 "Full constructor of a GeometryObject."))
123 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
126 "self",
"name",
"parent_joint",
"placement",
"collision_geometry",
"mesh_path",
127 "mesh_scale",
"override_material",
"mesh_color",
"mesh_texture_path",
129 "Reduced constructor of a GeometryObject. This constructor does not require to specify "
130 "the parent frame index."))
134 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
137 "self",
"name",
"parent_frame",
"parent_joint",
"collision_geometry",
"placement",
138 "mesh_path",
"mesh_scale",
"override_material",
"mesh_color",
145 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
148 "self",
"name",
"parent_joint",
"collision_geometry",
"placement",
"mesh_path",
149 "mesh_scale",
"override_material",
"mesh_color",
"mesh_texture_path",
151 "Deprecated. Reduced constructor of a GeometryObject. This constructor does not "
153 .def(bp::init<const GeometryObject &>(
154 bp::args(
"self",
"otherGeometryObject"),
"Copy constructor"))
165 "The FCL CollisionGeometry associated to the given GeometryObject.")
172 "Position of geometry object in parent joint's frame.")
176 "Boolean that tells whether material information is stored inside the "
177 "given GeometryObject.")
182 "If true, no collision or distance check will be done between the "
183 "Geometry and any other geometry.")
186 "Perform a deep copy of this. It will create a copy of the underlying FCL geometry.")
191 "Material associated to the mesh (applied only if overrideMaterial is True)")
193 .def(bp::self == bp::self)
194 .def(bp::self != bp::self)
196 #ifdef PINOCCHIO_WITH_HPP_FCL
197 .def(
"CreateCapsule", &GeometryObjectPythonVisitor::maker_capsule)
198 .staticmethod(
"CreateCapsule")
199 #endif // PINOCCHIO_WITH_HPP_FCL
204 const bp::type_info
info = bp::type_id<CollisionGeometryPtr>();
205 const bp::converter::registration * reg = bp::converter::registry::query(
info);
208 bp::register_ptr_to_python<CollisionGeometryPtr>();
212 #ifdef PINOCCHIO_WITH_HPP_FCL
219 #endif // PINOCCHIO_WITH_HPP_FCL
223 if (!register_symbolic_link_to_registered_type<GeometryObject>())
225 bp::class_<GeometryObject>(
227 "A wrapper on a collision geometry including its parent "
228 "joint, parent frame, placement in parent joint's frame.\n\n",
234 #ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION
240 #ifdef PINOCCHIO_WITH_HPP_FCL
241 if (!register_symbolic_link_to_registered_type<CollisionObject>())
243 bp::class_<CollisionObject, bp::bases<::hpp::fcl::CollisionObject>>(
244 "CollisionObject",
"A Pinocchio collision object derived from FCL CollisionObject.",
247 const std::shared_ptr<::hpp::fcl::CollisionGeometry> &,
248 bp::optional<const size_t, bool>>(
249 (bp::arg(
"self"), bp::arg(
"collision_geometry"),
251 bp::arg(
"compute_local_aabb") =
true),
254 const std::shared_ptr<::hpp::fcl::CollisionGeometry> &,
SE3,
255 bp::optional<const size_t, bool>>(
256 (bp::arg(
"self"), bp::arg(
"collision_geometry"), bp::arg(
"placement"),
258 bp::arg(
"compute_local_aabb") =
true),
263 if (!register_symbolic_link_to_registered_type<GeometryNoMaterial>())
266 bp::class_<GeometryNoMaterial>(
"GeometryNoMaterial", bp::init<>())
267 .def(bp::init<GeometryNoMaterial>());
270 if (!register_symbolic_link_to_registered_type<GeometryPhongMaterial>())
272 bp::class_<GeometryPhongMaterial>(
"GeometryPhongMaterial", bp::init<>())
273 .def(bp::init<GeometryPhongMaterial>())
274 .def(bp::init<Eigen::Vector4d, Eigen::Vector4d, double>())
280 "RGBA emission (ambient) color value of the mesh")
286 "RGBA specular value of the mesh")
289 "Shininess associated to the specular lighting model (between 0 and 1)");
293 bp::to_python_converter<GeometryMaterial, GeometryMaterialValueToObject>();
296 bp::implicitly_convertible<GeometryNoMaterial, GeometryMaterial>();
297 bp::implicitly_convertible<GeometryPhongMaterial, GeometryMaterial>();
299 if (!register_symbolic_link_to_registered_type<GeometryType>())
301 bp::enum_<GeometryType>(
"GeometryType")
312 #endif // ifndef __pinocchio_python_geometry_object_hpp__