5#ifndef __pinocchio_multibody_geometry_object_hpp__ 6#define __pinocchio_multibody_geometry_object_hpp__ 8#include "pinocchio/utils/shared-ptr.hpp" 9#include "pinocchio/spatial/se3.hpp" 10#include "pinocchio/multibody/fwd.hpp" 11#include "pinocchio/multibody/model-item.hpp" 12#include "pinocchio/multibody/fcl.hpp" 13#include "pinocchio/serialization/serializable.hpp" 19#include <boost/variant.hpp> 41 struct GeometryPhongMaterial
43 GeometryPhongMaterial() =
default;
44 GeometryPhongMaterial(
54 bool operator==(
const GeometryPhongMaterial & other)
const 73 typedef boost::variant<GeometryNoMaterial, GeometryPhongMaterial> GeometryMaterial;
75 struct GeometryObject;
80 typedef double Scalar;
91 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
102 typedef std::shared_ptr<fcl::CollisionGeometry> CollisionGeometryPtr;
152 const std::string &
name,
153 const JointIndex parent_joint,
154 const FrameIndex parent_frame,
156 const CollisionGeometryPtr & collision_geometry,
158 const Eigen::Vector3d &
meshScale = Eigen::Vector3d::Ones(),
160 const Eigen::Vector4d &
meshColor = Eigen::Vector4d(0, 0, 0, 1),
192 const std::string &
name,
193 const JointIndex parent_joint,
195 const CollisionGeometryPtr & collision_geometry,
197 const Eigen::Vector3d &
meshScale = Eigen::Vector3d::Ones(),
199 const Eigen::Vector4d &
meshColor = Eigen::Vector4d(0, 0, 0, 1),
202 : Base(
name, parent_joint, std::numeric_limits<FrameIndex>::max(),
placement)
232 const std::string &
name,
233 const FrameIndex parent_frame,
234 const JointIndex parent_joint,
235 const CollisionGeometryPtr & collision_geometry,
238 const Eigen::Vector3d &
meshScale = Eigen::Vector3d::Ones(),
240 const Eigen::Vector4d &
meshColor = Eigen::Vector4d(0, 0, 0, 1),
274 const std::string &
name,
275 const JointIndex parent_joint,
276 const CollisionGeometryPtr & collision_geometry,
279 const Eigen::Vector3d &
meshScale = Eigen::Vector3d::Ones(),
281 const Eigen::Vector4d &
meshColor = Eigen::Vector4d(0, 0, 0, 1),
284 : Base(
name, parent_joint, std::numeric_limits<FrameIndex>::max(),
placement)
306#ifdef PINOCCHIO_WITH_HPP_FCL 329 return !(*
this == other);
332 friend std::ostream & operator<<(std::ostream & os,
const GeometryObject & geomObject);
335#ifdef PINOCCHIO_WITH_HPP_FCL 337 struct CollisionObject : ::hpp::fcl::CollisionObject
339 typedef ::hpp::fcl::CollisionObject Base;
343 : Base(
nullptr,
false)
348 explicit CollisionObject(
349 const std::shared_ptr<::hpp::fcl::CollisionGeometry> & collision_geometry,
351 bool compute_local_aabb =
true)
352 : Base(collision_geometry, compute_local_aabb)
358 const std::shared_ptr<::hpp::fcl::CollisionGeometry> & collision_geometry,
359 const SE3 & transform,
361 bool compute_local_aabb =
true)
362 : Base(collision_geometry, toFclTransform3f(transform), compute_local_aabb)
367 bool operator==(
const CollisionObject & other)
const 372 bool operator!=(
const CollisionObject & other)
const 374 return !(*
this == other);
381 struct ComputeCollision : ::hpp::fcl::ComputeCollision
383 typedef ::hpp::fcl::ComputeCollision Base;
392 virtual ~ComputeCollision() {};
394 virtual std::size_t run(
395 const fcl::Transform3f & tf1,
396 const fcl::Transform3f & tf2,
397 const fcl::CollisionRequest & request,
398 fcl::CollisionResult & result)
const 400 typedef ::hpp::fcl::CollisionGeometry
const * Pointer;
401 const_cast<Pointer &
>(Base::o1) = go1_ptr->geometry.get();
402 const_cast<Pointer &
>(Base::o2) = go2_ptr->geometry.get();
403 return Base::run(tf1, tf2, request, result);
406 bool operator==(
const ComputeCollision & other)
const 408 return Base::operator==(other) && go1_ptr == other.go1_ptr
409 && go2_ptr == other.go2_ptr;
413 bool operator!=(
const ComputeCollision & other)
const 415 return !(*
this == other);
432 struct ComputeDistance : ::hpp::fcl::ComputeDistance
434 typedef ::hpp::fcl::ComputeDistance Base;
443 virtual ~ComputeDistance() {};
445 virtual hpp::fcl::FCL_REAL run(
446 const fcl::Transform3f & tf1,
447 const fcl::Transform3f & tf2,
448 const fcl::DistanceRequest & request,
449 fcl::DistanceResult & result)
const 451 typedef ::hpp::fcl::CollisionGeometry
const * Pointer;
452 const_cast<Pointer &
>(Base::o1) = go1_ptr->geometry.get();
453 const_cast<Pointer &
>(Base::o2) = go2_ptr->geometry.get();
454 return Base::run(tf1, tf2, request, result);
457 bool operator==(
const ComputeDistance & other)
const 459 return Base::operator==(other) && go1_ptr == other.go1_ptr && go2_ptr == other.go2_ptr;
462 bool operator!=(
const ComputeDistance & other)
const 464 return !(*
this == other);
488#include "pinocchio/multibody/geometry-object.hxx" Main pinocchio namespace.
bool compare_shared_ptr(const std::shared_ptr< T > &ptr1, const std::shared_ptr< T > &ptr2)
Compares two std::shared_ptr.
std::string name(const LieGroupGenericTpl< LieGroupCollection > &lg)
Visit a LieGroupVariant to get the name of it.
size_t geometryObjectIndex
Geometry object index related to the current collision object.
No material associated to a geometry.
Eigen::Vector4d meshColor
RGBA color value of the GeometryObject::geometry object.
GeometryMaterial meshMaterial
Material associated to the mesh. This material should be used only if overrideMaterial is set to true...
GeometryObject(const std::string &name, const JointIndex parent_joint, const SE3 &placement, const CollisionGeometryPtr &collision_geometry, const std::string &meshPath="", const Eigen::Vector3d &meshScale=Eigen::Vector3d::Ones(), const bool overrideMaterial=false, const Eigen::Vector4d &meshColor=Eigen::Vector4d(0, 0, 0, 1), const std::string &meshTexturePath="", const GeometryMaterial &meshMaterial=GeometryNoMaterial())
Reduced constructor.
std::string meshPath
Absolute path to the mesh file (if the geometry pointee is also a Mesh)
FrameIndex parentFrame
Index of the parent frame.
bool overrideMaterial
Decide whether to override the Material.
bool disableCollision
If true, no collision or distance check will be done between the Geometry and any other geometry.
Eigen::Vector3d meshScale
Scaling vector applied to the GeometryObject::geometry object.
JointIndex parentJoint
Index of the parent joint.
GeometryObject clone() const
Perform a deep copy of this. It will create a copy of the underlying FCL geometry.
PINOCCHIO_DEPRECATED GeometryObject(const std::string &name, const JointIndex parent_joint, const CollisionGeometryPtr &collision_geometry, const SE3 &placement, const std::string &meshPath="", const Eigen::Vector3d &meshScale=Eigen::Vector3d::Ones(), const bool overrideMaterial=false, const Eigen::Vector4d &meshColor=Eigen::Vector4d(0, 0, 0, 1), const std::string &meshTexturePath="", const GeometryMaterial &meshMaterial=GeometryNoMaterial())
Reduced constructor.
std::string name
Name of the kinematic element.
PINOCCHIO_DEPRECATED GeometryObject(const std::string &name, const FrameIndex parent_frame, const JointIndex parent_joint, const CollisionGeometryPtr &collision_geometry, const SE3 &placement, const std::string &meshPath="", const Eigen::Vector3d &meshScale=Eigen::Vector3d::Ones(), const bool overrideMaterial=false, const Eigen::Vector4d &meshColor=Eigen::Vector4d(0, 0, 0, 1), const std::string &meshTexturePath="", const GeometryMaterial &meshMaterial=GeometryNoMaterial())
Full constructor.
SE3 placement
Position of kinematic element in parent joint frame.
std::string meshTexturePath
Absolute path to the mesh texture file.
GeometryObject(const std::string &name, const JointIndex parent_joint, const FrameIndex parent_frame, const SE3 &placement, const CollisionGeometryPtr &collision_geometry, const std::string &meshPath="", const Eigen::Vector3d &meshScale=Eigen::Vector3d::Ones(), const bool overrideMaterial=false, const Eigen::Vector4d &meshColor=Eigen::Vector4d(0, 0, 0, 1), const std::string &meshTexturePath="", const GeometryMaterial &meshMaterial=GeometryNoMaterial())
Full constructor.
CollisionGeometryPtr geometry
The FCL CollisionGeometry (might be a Mesh, a Geometry Primitive, etc.)
Eigen::Vector4d meshSpecularColor
RGBA specular color value of the GeometryObject::geometry object.
double meshShininess
Shininess associated to the specular lighting model.
Eigen::Vector4d meshEmissionColor
RGBA emission (ambient) color value of the GeometryObject::geometry object.
Common traits structure to fully define base classes for CRTP.