28 :
public boost::python::def_visitor<GeometryObjectPythonVisitor>
31 typedef GeometryObject::CollisionGeometryPtr CollisionGeometryPtr;
33 template<
class PyClass>
34 void visit(PyClass & cl)
const 36 typedef eigenpy::VariantConverter<GeometryMaterial> Converter;
37 Converter::registration();
41 std::string, JointIndex, FrameIndex,
const SE3 &, CollisionGeometryPtr,
43 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
46 "self",
"name",
"parent_joint",
"parent_frame",
"placement",
"collision_geometry",
47 "mesh_path",
"mesh_scale",
"override_material",
"mesh_color",
"mesh_texture_path",
49 "Full constructor of a GeometryObject."))
52 std::string, JointIndex,
const SE3 &, CollisionGeometryPtr,
54 std::string,
const Eigen::Vector3d &,
bool,
const Eigen::Vector4d &, std::string,
57 "self",
"name",
"parent_joint",
"placement",
"collision_geometry",
"mesh_path",
58 "mesh_scale",
"override_material",
"mesh_color",
"mesh_texture_path",
60 "Reduced constructor of a GeometryObject. This constructor does not require to " 62 "the parent frame index."))
64 bp::init<const GeometryObject &>(
65 bp::args(
"self",
"otherGeometryObject"),
"Copy constructor"))
68 bp::make_getter(&GeometryObject::meshScale, bp::return_internal_reference<>()),
69 bp::make_setter(&GeometryObject::meshScale),
"Scaling parameter of the mesh.")
72 bp::make_getter(&GeometryObject::meshColor, bp::return_internal_reference<>()),
73 bp::make_setter(&GeometryObject::meshColor),
"Color rgba of the mesh.")
75 "geometry", &GeometryObject::geometry,
76 "The coal CollisionGeometry associated to the given GeometryObject.")
78 "name", &GeometryObject::name,
"Name associated to the given GeometryObject.")
79 .def_readwrite(
"parentJoint", &GeometryObject::parentJoint,
"Index of the parent joint.")
80 .def_readwrite(
"parentFrame", &GeometryObject::parentFrame,
"Index of the parent frame.")
82 "placement", &GeometryObject::placement,
83 "Position of geometry object in parent joint's frame.")
84 .def_readwrite(
"meshPath", &GeometryObject::meshPath,
"Path to the mesh file.")
86 "overrideMaterial", &GeometryObject::overrideMaterial,
87 "Boolean that tells whether material information is stored inside the given " 90 "meshTexturePath", &GeometryObject::meshTexturePath,
"Path to the mesh texture file.")
92 "disableCollision", &GeometryObject::disableCollision,
93 "If true, no collision or distance check will be done between the Geometry and any " 96 "clone", &GeometryObject::clone, bp::arg(
"self"),
97 "Perform a deep copy of this. It will create a copy of the underlying coal geometry.")
100 bp::make_getter(&GeometryObject::meshMaterial, Converter::return_internal_reference()),
101 bp::make_setter(&GeometryObject::meshMaterial),
102 "Material associated to the mesh (applied only if overrideMaterial is True)")
104 "physicsMaterial", &GeometryObject::physicsMaterial,
105 "Physics material of the GeometryObject.")
107 .def(bp::self == bp::self)
108 .def(bp::self != bp::self)
110#ifdef PINOCCHIO_WITH_COLLISION 111 .def(
"CreateCapsule", &GeometryObjectPythonVisitor::maker_capsule)
112 .staticmethod(
"CreateCapsule")
118 const bp::type_info info = bp::type_id<CollisionGeometryPtr>();
119 const bp::converter::registration * reg = bp::converter::registry::query(info);
122 bp::register_ptr_to_python<CollisionGeometryPtr>();
126#ifdef PINOCCHIO_WITH_COLLISION 127 static GeometryObject maker_capsule(
const double radius,
const double length)
129 return GeometryObject(
130 "", JointIndex(0), FrameIndex(0), SE3::Identity(),
131 std::shared_ptr<coal::CollisionGeometry>(
new coal::Capsule(radius, length)));
137 if (!register_symbolic_link_to_registered_type<GeometryObject>())
139 bp::class_<GeometryObject>(
141 "A wrapper on a collision geometry including its parent joint, parent frame, placement " 142 "in parent joint's frame.\n\n",
145 .def(::eigenpy::CopyableVisitor<GeometryObject>())
148#ifndef PINOCCHIO_PYTHON_NO_SERIALIZATION 154#ifdef PINOCCHIO_WITH_COLLISION 155 if (!register_symbolic_link_to_registered_type<CollisionObject>())
157 bp::class_<CollisionObject, bp::bases<::coal::CollisionObject>>(
158 "CollisionObject",
"A Pinocchio collision object derived from coal CollisionObject.",
162 const std::shared_ptr<::coal::CollisionGeometry> &,
163 bp::optional<const size_t, bool>>(
164 (bp::arg(
"self"), bp::arg(
"collision_geometry"),
165 bp::arg(
"geometryObjectIndex") = (std::numeric_limits<size_t>::max)(),
166 bp::arg(
"compute_local_aabb") =
true),
170 const std::shared_ptr<::coal::CollisionGeometry> &, SE3,
171 bp::optional<const size_t, bool>>(
172 (bp::arg(
"self"), bp::arg(
"collision_geometry"), bp::arg(
"placement"),
173 bp::arg(
"geometryObjectIndex") = (std::numeric_limits<size_t>::max)(),
174 bp::arg(
"compute_local_aabb") =
true),
179 if (!register_symbolic_link_to_registered_type<GeometryNoMaterial>())
182 bp::class_<GeometryNoMaterial>(
"GeometryNoMaterial", bp::init<>())
183 .def(bp::init<GeometryNoMaterial>());
186 if (!register_symbolic_link_to_registered_type<GeometryPhongMaterial>())
188 bp::class_<GeometryPhongMaterial>(
"GeometryPhongMaterial", bp::init<>())
189 .def(bp::init<GeometryPhongMaterial>())
190 .def(bp::init<Eigen::Vector4d, Eigen::Vector4d, double>())
194 &GeometryPhongMaterial::meshEmissionColor, bp::return_internal_reference<>()),
195 bp::make_setter(&GeometryPhongMaterial::meshEmissionColor),
196 "RGBA emission (ambient) color value of the mesh")
200 &GeometryPhongMaterial::meshSpecularColor, bp::return_internal_reference<>()),
201 bp::make_setter(&GeometryPhongMaterial::meshSpecularColor),
202 "RGBA specular value of the mesh")
204 "meshShininess", &GeometryPhongMaterial::meshShininess,
205 "Shininess associated to the specular lighting model (between 0 and 1)");
207 if (!register_symbolic_link_to_registered_type<GeometryType>())
209 bp::enum_<GeometryType>(
"GeometryType")
210 .value(
"VISUAL", VISUAL)
211 .value(
"COLLISION", COLLISION)
215 if (!register_symbolic_link_to_registered_type<PhysicsMaterialType>())
217 bp::enum_<PhysicsMaterialType>(
"PhysicsMaterialType")
219 .value(
"METAL", METAL)
220 .value(
"PLASTIC", PLASTIC)
222 .value(
"CONCRETE", CONCRETE)
226 if (!register_symbolic_link_to_registered_type<PhysicsMaterial>())
228 bp::class_<PhysicsMaterial>(
"PhysicsMaterial", bp::init<>())
229 .def(bp::init<PhysicsMaterial>())
230 .def(bp::init<PhysicsMaterialType, double, double>())
231 .def_readwrite(
"materialType", &PhysicsMaterial::materialType,
"Type of the material")
232 .def_readwrite(
"compliance", &PhysicsMaterial::compliance,
"Compliance of the material")
234 "elasticity", &PhysicsMaterial::elasticity,
"Elasticity of the material");
237 if (!register_symbolic_link_to_registered_type<FrictionCoefficientMatrix>())
239 bp::class_<FrictionCoefficientMatrix>(
"FrictionCoefficientMatrix", bp::no_init)
241 "getFrictionFromMaterialPair",
242 &FrictionCoefficientMatrix::getFrictionFromMaterialPair,
243 bp::args(
"self",
"type1",
"type2"));
246 "getFrictionCoefficientMatrix", getFrictionCoefficientMatrix,
247 bp::return_value_policy<bp::reference_existing_object>());