geometry-object.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017-2020 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_python_geometry_object_hpp__
6 #define __pinocchio_python_geometry_object_hpp__
7 
8 #include <boost/python.hpp>
9 #include <eigenpy/memory.hpp>
11 
12 #include "pinocchio/multibody/geometry.hpp"
13 
15 
16 namespace pinocchio
17 {
18  namespace python
19  {
20  namespace bp = boost::python;
21 
23  : public boost::python::def_visitor< GeometryObjectPythonVisitor >
24  {
25  typedef GeometryObject::CollisionGeometryPtr CollisionGeometryPtr;
26 
27  template<class PyClass>
28  void visit(PyClass& cl) const
29  {
30  cl
31  .def(bp::init<std::string,FrameIndex,JointIndex,CollisionGeometryPtr,SE3,
32  bp::optional<std::string,Eigen::Vector3d,bool,Eigen::Vector4d,std::string> >
33  (
34  bp::args("self","name","parent_frame","parent_joint","collision_geometry",
35  "placement", "mesh_path", "mesh_scale", "override_material", "mesh_color", "mesh_texture_path"),
36  "Full constructor of a GeometryObject."))
37  .def(bp::init<std::string,JointIndex,CollisionGeometryPtr,SE3,
38  bp::optional<std::string,Eigen::Vector3d,bool,Eigen::Vector4d,std::string> >
39  (
40  bp::args("self","name","parent_joint","collision_geometry",
41  "placement", "mesh_path", "mesh_scale", "override_material", "mesh_color", "mesh_texture_path"),
42  "Reduced constructor of a GeometryObject. This constructor does not require to specify the parent frame index."
43  ))
44  .def(bp::init<const GeometryObject&>
45  (
46  bp::args("self","otherGeometryObject"),
47  "Copy constructor"
48  ))
49  .def_readwrite("meshScale",&GeometryObject::meshScale,
50  "Scaling parameter of the mesh.")
51  .add_property("meshColor",
52  bp::make_getter(&GeometryObject::meshColor,
53  bp::return_value_policy<bp::return_by_value>()),
54  bp::make_setter(&GeometryObject::meshColor),
55  "Color rgba of the mesh.")
56  .def_readwrite("geometry", &GeometryObject::geometry,
57  "The FCL CollisionGeometry associated to the given GeometryObject.")
58  .def_readwrite("name", &GeometryObject::name,
59  "Name associated to the given GeometryObject.")
60  .def_readwrite("parentJoint", &GeometryObject::parentJoint,
61  "Index of the parent joint.")
62  .def_readwrite("parentFrame", &GeometryObject::parentFrame,
63  "Index of the parent frame.")
64  .def_readwrite("placement",&GeometryObject::placement,
65  "Position of geometry object in parent joint's frame.")
66  .def_readwrite("meshPath", &GeometryObject::meshPath,
67  "Path to the mesh file.")
68  .def_readwrite("overrideMaterial", &GeometryObject::overrideMaterial,
69  "Boolean that tells whether material information is stored inside the given GeometryObject.")
70  .def_readwrite("meshTexturePath", &GeometryObject::meshTexturePath,
71  "Path to the mesh texture file.")
72  .def_readwrite("disableCollision", &GeometryObject::disableCollision,
73  "If true, no collision or distance check will be done between the Geometry and any other geometry.")
74 
75  .def(bp::self == bp::self)
76  .def(bp::self != bp::self)
77 
78 #ifdef PINOCCHIO_WITH_HPP_FCL
79  .def("CreateCapsule", &GeometryObjectPythonVisitor::maker_capsule)
80  .staticmethod("CreateCapsule")
81 #endif // PINOCCHIO_WITH_HPP_FCL
82  ;
83  }
84 
85 #ifdef PINOCCHIO_WITH_HPP_FCL
86  static GeometryObject maker_capsule(const double radius, const double length)
87  {
88  return GeometryObject("",FrameIndex(0),JointIndex(0),
89  boost::shared_ptr<fcl::CollisionGeometry>(new fcl::Capsule(radius, length)),
90  SE3::Identity());
91 
92  }
93 #endif // PINOCCHIO_WITH_HPP_FCL
94 
95  static void expose()
96  {
97  bp::class_<GeometryObject>("GeometryObject",
98  "A wrapper on a collision geometry including its parent joint, parent frame, placement in parent joint's frame.\n\n",
99  bp::no_init
100  )
102  ;
103 
104  bp::enum_<GeometryType>("GeometryType")
105  .value("VISUAL",VISUAL)
106  .value("COLLISION",COLLISION)
107  .export_values()
108  ;
109  }
110 
111  };
112 
113 
114  } // namespace python
115 } // namespace pinocchio
116 
117 #endif // ifndef __pinocchio_python_geometry_object_hpp__
GeometryObject::CollisionGeometryPtr CollisionGeometryPtr
Main pinocchio namespace.
Definition: timings.cpp:30
#define EIGENPY_DEFINE_STRUCT_ALLOCATOR_SPECIALIZATION(...)
int value


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:03