Robowflex
v0.1
Making MoveIt Easy
|
A class that manages both solid and mesh geometry for various parts of the motion planning system. More...
#include <geometry.h>
Classes | |
class | ShapeType |
Supported shape types. More... | |
Public Member Functions | |
Geometry (ShapeType::Type type, const Eigen::Vector3d &dimensions, const std::string &resource="", const EigenSTL::vector_Vector3d &vertices=EigenSTL::vector_Vector3d{}) | |
Constructor. Builds and loads the specified geometry. More... | |
Geometry (const shapes::Shape &shape) | |
Constructor. Builds and loads the specified geometry from a MoveIt shape. More... | |
Geometry (const shape_msgs::SolidPrimitive &msg) | |
Constructor. Builds and loads the specified geometry from a MoveIt shape message. More... | |
Geometry (const shape_msgs::Mesh &msg) | |
Constructor. Builds and loads the specified geometry from a MoveIt shape message. More... | |
Geometry (const Geometry &)=delete | |
Geometry & | operator= (const Geometry &)=delete |
bool | contains (const Eigen::Vector3d &point) const |
Checks if the geometry contains a point. More... | |
std::pair< bool, Eigen::Vector3d > | sample (const unsigned int attempts=50) const |
Tries to sample a point in the geometry. More... | |
bool | isMesh () const |
Checks if the geometry is a mesh geometry. More... | |
const shape_msgs::SolidPrimitive | getSolidMsg () const |
Gets the message form of solid primitive geometry (all but ShapeType::MESH). More... | |
const shape_msgs::Mesh | getMeshMsg () const |
Gets the message form of mesh geometry. More... | |
const shapes::ShapePtr & | getShape () const |
Gets the underlying shape. More... | |
const bodies::BodyPtr & | getBody () const |
Gets the underlying body. More... | |
ShapeType::Type | getType () const |
Gets the type of the geometry. More... | |
const std::string & | getResource () const |
Gets the mesh resource of the geometry. More... | |
const EigenSTL::vector_Vector3d & | getVertices () const |
Gets the Vertices of the primitive. More... | |
const Eigen::Vector3d & | getDimensions () const |
Gets the dimensions of the geometry. More... | |
Eigen::AlignedBox3d | getAABB (const RobotPose &pose=RobotPose::Identity()) const |
Compute the AABB (axis-aligned bounding box) of the geometry at a given pose. More... | |
Static Public Member Functions | |
static GeometryPtr | makeSphere (double radius) |
Create a sphere. More... | |
static GeometryPtr | makeBox (double x, double y, double z) |
Create a box. More... | |
static GeometryPtr | makeBox (const Eigen::Vector3d &dimensions) |
Create a box. More... | |
static GeometryPtr | makeCylinder (double radius, double length) |
Create a cylinder. More... | |
static GeometryPtr | makeCone (double radius, double length) |
Create a cone. More... | |
static GeometryPtr | makeSolidPrimitive (const shape_msgs::SolidPrimitive &msg) |
Create a solid primitive. More... | |
static GeometryPtr | makeMesh (const std::string &resource, const Eigen::Vector3d &scale={1, 1, 1}) |
Create a mesh from resource file. More... | |
static GeometryPtr | makeMesh (const EigenSTL::vector_Vector3d &vertices) |
Create a mesh from triangles represented as vertices . More... | |
Private Member Functions | |
shapes::Shape * | loadShape () const |
Loads a shape from the set type_ and dimensions_, and resource_ if a mesh. More... | |
bodies::Body * | loadBody () const |
Loads a body from the loaded shape_. More... | |
Private Attributes | |
ShapeType::Type | type_ {ShapeType::Type::BOX} |
Geometry Type. More... | |
Eigen::Vector3d | dimensions_ {Eigen::Vector3d::Ones()} |
Dimensions to scale geometry. More... | |
EigenSTL::vector_Vector3d | vertices_ {{}} |
Vertices of the primitive. More... | |
std::string | resource_ {""} |
Resource locator for MESH types. More... | |
shapes::ShapePtr | shape_ {nullptr} |
Loaded shape. More... | |
bodies::BodyPtr | body_ {nullptr} |
Body operation. More... | |
A class that manages both solid and mesh geometry for various parts of the motion planning system.
Definition at line 35 of file geometry.h.
Geometry::Geometry | ( | ShapeType::Type | type, |
const Eigen::Vector3d & | dimensions, | ||
const std::string & | resource = "" , |
||
const EigenSTL::vector_Vector3d & | vertices = EigenSTL::vector_Vector3d{} |
||
) |
Constructor. Builds and loads the specified geometry.
[in] | type | Type of the geometry to create. |
[in] | dimensions | Dimensions of the geometry to load. |
[in] | resource | If type is ShapeType::MESH, then resource or vertices must be specified |
[in] | vertices | List of vertices that form the mesh. as the mesh file to load. |
Definition at line 101 of file geometry.cpp.
Geometry::Geometry | ( | const shapes::Shape & | shape | ) |
Constructor. Builds and loads the specified geometry from a MoveIt shape.
[in] | shape | Shape to construct geometry from. |
Definition at line 112 of file geometry.cpp.
Geometry::Geometry | ( | const shape_msgs::SolidPrimitive & | msg | ) |
Constructor. Builds and loads the specified geometry from a MoveIt shape message.
[in] | msg | Shape message to construct geometry from. |
Definition at line 162 of file geometry.cpp.
Geometry::Geometry | ( | const shape_msgs::Mesh & | msg | ) |
Constructor. Builds and loads the specified geometry from a MoveIt shape message.
[in] | msg | Shape message to construct mesh geometry from. |
Definition at line 166 of file geometry.cpp.
|
delete |
bool Geometry::contains | ( | const Eigen::Vector3d & | point | ) | const |
Checks if the geometry contains a point.
[in] | point | The point to check, in the geometry's frame. |
Definition at line 235 of file geometry.cpp.
Eigen::AlignedBox3d Geometry::getAABB | ( | const RobotPose & | pose = RobotPose::Identity() | ) | const |
Compute the AABB (axis-aligned bounding box) of the geometry at a given pose.
[in] | pose | Pose to compute AABB of geometry at. |
Definition at line 304 of file geometry.cpp.
const bodies::BodyPtr & Geometry::getBody | ( | ) | const |
const Eigen::Vector3d & Geometry::getDimensions | ( | ) | const |
Gets the dimensions of the geometry.
Definition at line 299 of file geometry.cpp.
const shape_msgs::Mesh Geometry::getMeshMsg | ( | ) | const |
Gets the message form of mesh geometry.
Definition at line 265 of file geometry.cpp.
const std::string & Geometry::getResource | ( | ) | const |
Gets the mesh resource of the geometry.
Definition at line 289 of file geometry.cpp.
const shapes::ShapePtr & Geometry::getShape | ( | ) | const |
const shape_msgs::SolidPrimitive Geometry::getSolidMsg | ( | ) | const |
Gets the message form of solid primitive geometry (all but ShapeType::MESH).
Definition at line 256 of file geometry.cpp.
Geometry::ShapeType::Type Geometry::getType | ( | ) | const |
Gets the type of the geometry.
Definition at line 284 of file geometry.cpp.
const EigenSTL::vector_Vector3d & Geometry::getVertices | ( | ) | const |
Gets the Vertices of the primitive.
Definition at line 294 of file geometry.cpp.
bool Geometry::isMesh | ( | ) | const |
Checks if the geometry is a mesh geometry.
Definition at line 251 of file geometry.cpp.
|
private |
Loads a body from the loaded shape_.
Definition at line 207 of file geometry.cpp.
|
private |
Loads a shape from the set type_ and dimensions_, and resource_ if a mesh.
Definition at line 170 of file geometry.cpp.
|
static |
Create a box.
[in] | dimensions | The XYZ dimensions of the box. |
Definition at line 53 of file geometry.cpp.
|
static |
Create a box.
[in] | x | The box's x dimension. |
[in] | y | The boy's y dimension. |
[in] | z | The boz's z dimension. |
Definition at line 48 of file geometry.cpp.
|
static |
Create a cone.
[in] | radius | The radius of the base of the cone. |
[in] | length | The height of the cone. |
Definition at line 63 of file geometry.cpp.
|
static |
Create a cylinder.
[in] | radius | The radius of the cylinder. |
[in] | length | The length of the cylinder. |
Definition at line 58 of file geometry.cpp.
|
static |
Create a mesh from triangles represented as vertices .
[in] | vertices | The vertices that will create the mesh. |
Definition at line 96 of file geometry.cpp.
|
static |
Create a mesh from resource file.
[in] | resource | The resource to load for the mesh. |
[in] | scale | The scale of the mesh. |
Definition at line 91 of file geometry.cpp.
|
static |
Create a solid primitive.
[in] | msg | The solid primitive message to load. |
Definition at line 68 of file geometry.cpp.
|
static |
Create a sphere.
[in] | radius | The radius of the sphere. |
Definition at line 43 of file geometry.cpp.
std::pair< bool, Eigen::Vector3d > Geometry::sample | ( | const unsigned int | attempts = 50 | ) | const |
Tries to sample a point in the geometry.
[in] | attempts | Number of attempts to sample. |
Definition at line 240 of file geometry.cpp.
|
private |
Body operation.
Definition at line 224 of file geometry.h.
|
private |
Dimensions to scale geometry.
Definition at line 220 of file geometry.h.
|
private |
Resource locator for MESH types.
Definition at line 222 of file geometry.h.
|
private |
Loaded shape.
Definition at line 223 of file geometry.h.
|
private |
Geometry Type.
Definition at line 219 of file geometry.h.
|
private |
Vertices of the primitive.
Definition at line 221 of file geometry.h.