Parasol Planning Library (PPL)
Public Member Functions
Body Class Reference

#include <Body.h>

Collaboration diagram for Body:
Collaboration graph
[legend]

Public Types

Local Types
enum class  Type { Planar , Volumetric , Fixed , Joint }
 The type of part this body represents within its owning multi body. More...
 
enum class  MovementType { Fixed , Joint , Rotational , Translational }
 The type of movement this body can perform. More...
 

Public Member Functions

const std::string & Label () const noexcept
 
bool IsBase () const noexcept
 Is this body a base? More...
 
void SetBodyType (const Body::Type _type) noexcept
 Set the type of this body. More...
 
Body::Type GetBodyType () const noexcept
 Get the type of this body. More...
 
void SetMovementType (const MovementType _type) noexcept
 Set the movement type for this body. More...
 
MovementType GetMovementType () const noexcept
 Get the movement type for this body. More...
 
Construction
 Body (MultiBody *const _owner, const size_t _index=0)
 
 Body (MultiBody *const _owner, XMLNode &_node)
 
 Body (const Body &_other)
 Copy. More...
 
 Body (Body &&_other)
 Move. More...
 
 ~Body ()
 
Assignment
Bodyoperator= (const Body &_other)
 Copy. More...
 
Bodyoperator= (Body &&_other)
 Move. More...
 
Validation
void Validate () const
 
MultiBody Accessors
MultiBodyGetMultiBody () const noexcept
 Get the owning MultiBody. More...
 
void SetMultiBody (MultiBody *const _owner) noexcept
 Set the owning MultiBody. More...
 
size_t GetIndex () const noexcept
 Get the index of this body within the owning MultiBody. More...
 
double GetWeight () const
 Get the weight of this body. More...
 
Physical Properties
double GetMass () const
 Get the mass. More...
 
const Matrix3x3 & GetMoment () const
 Get the moment of inertia matrix in the model frame. More...
 
Geometric Properties
void SetPolyhedron (GMSPolyhedron &&_poly)
 Set the polyhedron model for this body. More...
 
const GMSPolyhedronGetPolyhedron () const
 Get the polyhedron in model coordinates. More...
 
const GMSPolyhedronGetWorldPolyhedron () const
 Get the polyhedron in world coordinates. More...
 
const GMSPolyhedronGetBoundingBox () const
 Get the bounding box in model coordinates. More...
 
GMSPolyhedron GetWorldBoundingBox () const
 Compute the bounding box in world coordinates. More...
 
Transform Functions
void MarkDirty ()
 Mark all cached objects as requiring an update. More...
 
void Configure (const Transformation &_transformation)
 
const Transformation & GetWorldTransformation () const
 
Connection Information
size_t ForwardConnectionCount () const noexcept
 
size_t BackwardConnectionCount () const noexcept
 
size_t AdjacencyConnectionCount () const noexcept
 
ConnectionGetForwardConnection (const size_t _index) const noexcept
 
ConnectionGetBackwardConnection (const size_t _index) const noexcept
 
ConnectionGetAdjacencyConnection (const size_t _index) const noexcept
 
ConnectionGetConnectionTo (const Body *const _other) const noexcept
 
bool IsAdjacent (const Body *const _otherBody) const
 
bool SameParent (const Body *const _otherBody) const
 
void LinkForward (Connection *const _c)
 
void LinkBackward (Connection *const _c)
 
void LinkAdjacency (Connection *const _c)
 
void Unlink (Connection *const _c)
 
Visualization
const glutils::color & GetColor () const
 Get the color for the body. More...
 
void SetColor (const glutils::color &_c)
 Set the color for the body. More...
 
bool IsTextureLoaded () const
 Check if a texture was loaded. More...
 
const std::string & GetTexture () const
 Get the loaded texture file name. More...
 

I/O

@TODO Remove all COM adjust stuff.

static std::string m_modelDataDir
 Directory of geometry files. More...
 
const std::string & GetFileName () const
 Get the file name from which this body was constructed. More...
 
std::string GetFilePath () const
 Get the full path of the file from which this body was constructed. More...
 
void ReadGeometryFile (const std::string &_filename)
 
void ReadGeometryFile (GMSPolyhedron::COMAdjust _comAdjust=GMSPolyhedron::COMAdjust::None)
 
void Read (std::istream &_is, CountingStreamBuffer &_cbs)
 

Detailed Description

A single polyhedral body in workspace. One or more of these are composed to form a MultiBody, which is PMPL's working representation of multi-part object geometries.

Each Body has two representations: one for the 'model frame' and one for the 'world frame'. The model frame is the coordinate frame in which the Body was originally described - this is usually centered on the Body's center of mass. The world frame is the coordinate frame in our current environment - this represents the Body after it has been translated/oriented into its place in the planning scene.

@TODO Remove COM adjust everywhere. This has become more problematic than helpful. We will always do BBX centering from the fix onward.

Member Enumeration Documentation

◆ MovementType

enum Body::MovementType
strong

The type of movement this body can perform.

Enumerator
Fixed 

No movement.

Joint 

Defined by joint connection.

Rotational 

Rotation + translation.

Translational 

Just translation.

◆ Type

enum Body::Type
strong

The type of part this body represents within its owning multi body.

Enumerator
Planar 

2D base

Volumetric 

3D base

Fixed 

Fixed base.

Joint 

Link.

Constructor & Destructor Documentation

◆ Body() [1/4]

Body::Body ( MultiBody *const  _owner,
const size_t  _index = 0 
)

Construct an empty body.

Parameters
_ownerThe owning multibody.
_indexThe body index in the multibody (0 for base).

◆ Body() [2/4]

Body::Body ( MultiBody *const  _owner,
XMLNode _node 
)

Construct a body from an XML node.

Parameters
_ownerThe owning multibody.
_nodeThe XML node to parse.

◆ Body() [3/4]

Body::Body ( const Body _other)

Copy.

Copying a body does not copy the owning multibody pointer or the connections as this would not constitute a meaningful object. Moving a body carries the external pointers as expected.

◆ Body() [4/4]

Body::Body ( Body &&  _other)
default

Move.

◆ ~Body()

Body::~Body ( )
default

Member Function Documentation

◆ AdjacencyConnectionCount()

size_t Body::AdjacencyConnectionCount ( ) const
noexcept
Returns
Number of additional adjacent Connections

◆ BackwardConnectionCount()

size_t Body::BackwardConnectionCount ( ) const
noexcept
Returns
Number of backward Connection

◆ Configure()

void Body::Configure ( const Transformation &  _transformation)

Set the transformation from model to world coordinates.

Parameters
_transformationThe new transformation for this body.

◆ ForwardConnectionCount()

size_t Body::ForwardConnectionCount ( ) const
noexcept
Returns
Number of forward Connection

◆ GetAdjacencyConnection()

Connection & Body::GetAdjacencyConnection ( const size_t  _index) const
noexcept
Parameters
_indexIndex of desired adjacency Connection
Returns
Requested adjacency Connection

◆ GetBackwardConnection()

Connection & Body::GetBackwardConnection ( const size_t  _index) const
noexcept
Parameters
_indexIndex of desired backward Connection
Returns
Requested backward Connection

◆ GetBodyType()

Body::Type Body::GetBodyType ( ) const
noexcept

Get the type of this body.

◆ GetBoundingBox()

const GMSPolyhedron & Body::GetBoundingBox ( ) const

Get the bounding box in model coordinates.

◆ GetColor()

const glutils::color & Body::GetColor ( ) const

Get the color for the body.

◆ GetConnectionTo()

Connection * Body::GetConnectionTo ( const Body *const  _other) const
noexcept

Get the connection joining this to another body.

Parameters
_otherThe other body.
Returns
The connection joining this and _other, or nullptr if the bodies are not connected.

◆ GetFileName()

const std::string & Body::GetFileName ( ) const

Get the file name from which this body was constructed.

◆ GetFilePath()

std::string Body::GetFilePath ( ) const

Get the full path of the file from which this body was constructed.

◆ GetForwardConnection()

Connection & Body::GetForwardConnection ( const size_t  _index) const
noexcept
Parameters
_indexIndex of desired forward Connection
Returns
Requested forward Connection

◆ GetIndex()

size_t Body::GetIndex ( ) const
noexcept

Get the index of this body within the owning MultiBody.

◆ GetMass()

double Body::GetMass ( ) const

Get the mass.

◆ GetMoment()

const Matrix3x3 & Body::GetMoment ( ) const

Get the moment of inertia matrix in the model frame.

◆ GetMovementType()

Body::MovementType Body::GetMovementType ( ) const
noexcept

Get the movement type for this body.

◆ GetMultiBody()

MultiBody * Body::GetMultiBody ( ) const
noexcept

Get the owning MultiBody.

◆ GetPolyhedron()

const GMSPolyhedron & Body::GetPolyhedron ( ) const

Get the polyhedron in model coordinates.

◆ GetTexture()

const string & Body::GetTexture ( ) const

Get the loaded texture file name.

◆ GetWeight()

double Body::GetWeight ( ) const

Get the weight of this body.

◆ GetWorldBoundingBox()

GMSPolyhedron Body::GetWorldBoundingBox ( ) const

Compute the bounding box in world coordinates.

◆ GetWorldPolyhedron()

const GMSPolyhedron & Body::GetWorldPolyhedron ( ) const

Get the polyhedron in world coordinates.

◆ GetWorldTransformation()

const Transformation & Body::GetWorldTransformation ( ) const

Get the transformation from model to world coordinates.

Returns
The current transformation.

◆ IsAdjacent()

bool Body::IsAdjacent ( const Body *const  _otherBody) const

Determines if two bodies share the same joint

Parameters
_otherBodySecond body
Returns
True if adjacent

◆ IsBase()

bool Body::IsBase ( ) const
noexcept

Is this body a base?

◆ IsTextureLoaded()

bool Body::IsTextureLoaded ( ) const

Check if a texture was loaded.

◆ Label()

const std::string & Body::Label ( ) const
noexcept

Get the unique string label for this body. If none is provided, the multibody index will be used.

◆ LinkAdjacency()

void Body::LinkAdjacency ( Connection *const  _c)

Attach an Adjacency connection to this body.

Parameters
_cThe Connection to attach.

◆ LinkBackward()

void Body::LinkBackward ( Connection *const  _c)

Attach a backward connection to this body.

Parameters
_cThe Connection to attach.

◆ LinkForward()

void Body::LinkForward ( Connection *const  _c)

Attach a forward connection to this body.

Parameters
_cThe Connection to attach.

◆ MarkDirty()

void Body::MarkDirty ( )

Mark all cached objects as requiring an update.

◆ operator=() [1/2]

Body & Body::operator= ( Body &&  _other)
default

Move.

◆ operator=() [2/2]

Body & Body::operator= ( const Body _other)

Copy.

◆ Read()

void Body::Read ( std::istream &  _is,
CountingStreamBuffer _cbs 
)

Parse a body from an old .env or .robot file.

Parameters
_isAn open input stream for the geometry file.
_cbsA counting stream buffer for error reporting.
Note
This function is provided for backwards compatibility with old environments. If it does not work with your example, you should update the old files to the new XML format. Do not waste time working on this function.

◆ ReadGeometryFile() [1/2]

void Body::ReadGeometryFile ( const std::string &  _filename)

Read geometry information from file.

Parameters
_filenameThe file to read from.

◆ ReadGeometryFile() [2/2]

void Body::ReadGeometryFile ( GMSPolyhedron::COMAdjust  _comAdjust = GMSPolyhedron::COMAdjust::None)

Read geometry information from file.

Parameters
_comAdjustCenter of mass adjustment method

◆ SameParent()

bool Body::SameParent ( const Body *const  _otherBody) const

Determines if two bodies share a parent

Parameters
_otherBodySecond body
Returns
True if sharing a parent

◆ SetBodyType()

void Body::SetBodyType ( const Body::Type  _type)
noexcept

Set the type of this body.

◆ SetColor()

void Body::SetColor ( const glutils::color &  _c)

Set the color for the body.

◆ SetMovementType()

void Body::SetMovementType ( const MovementType  _type)
noexcept

Set the movement type for this body.

◆ SetMultiBody()

void Body::SetMultiBody ( MultiBody *const  _owner)
noexcept

Set the owning MultiBody.

◆ SetPolyhedron()

void Body::SetPolyhedron ( GMSPolyhedron &&  _poly)

Set the polyhedron model for this body.

◆ Unlink()

void Body::Unlink ( Connection *const  _c)

Remove a connection to this body. Does not affect the other body or the connection object.

◆ Validate()

void Body::Validate ( ) const

@TODO Move to GMSPolyhedron. Determine if the polyhedron is valid, triangulated, closed, and having all normals facing a consistent 'outward' direction. Throws an exception if the model is invalid (because invalid models do not behave properly with collision checks).

Note
Uses a combination of the regular and CGAL points as we use CGAL for some of these checks.

Field Documentation

◆ m_modelDataDir

std::string Body::m_modelDataDir
static

Directory of geometry files.


The documentation for this class was generated from the following files: