![]() |
Parasol Planning Library (PPL)
|
#include <Body.h>
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 | |
Body & | operator= (const Body &_other) |
Copy. More... | |
Body & | operator= (Body &&_other) |
Move. More... | |
Validation | |
void | Validate () const |
MultiBody Accessors | |
MultiBody * | GetMultiBody () 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 GMSPolyhedron & | GetPolyhedron () const |
Get the polyhedron in model coordinates. More... | |
const GMSPolyhedron & | GetWorldPolyhedron () const |
Get the polyhedron in world coordinates. More... | |
const GMSPolyhedron & | GetBoundingBox () 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 |
Connection & | GetForwardConnection (const size_t _index) const noexcept |
Connection & | GetBackwardConnection (const size_t _index) const noexcept |
Connection & | GetAdjacencyConnection (const size_t _index) const noexcept |
Connection * | GetConnectionTo (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 | |
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) |
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.
|
strong |
|
strong |
Body::Body | ( | MultiBody *const | _owner, |
const size_t | _index = 0 |
||
) |
Construct an empty body.
_owner | The owning multibody. |
_index | The body index in the multibody (0 for base). |
Construct a body from an XML node.
_owner | The owning multibody. |
_node | The XML node to parse. |
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.
|
default |
Move.
|
default |
|
noexcept |
|
noexcept |
void Body::Configure | ( | const Transformation & | _transformation | ) |
Set the transformation from model to world coordinates.
_transformation | The new transformation for this body. |
|
noexcept |
|
noexcept |
_index | Index of desired adjacency Connection |
|
noexcept |
_index | Index of desired backward Connection |
|
noexcept |
Get the type of this body.
const GMSPolyhedron & Body::GetBoundingBox | ( | ) | const |
Get the bounding box in model coordinates.
const glutils::color & Body::GetColor | ( | ) | const |
Get the color for the body.
|
noexcept |
Get the connection joining this to another body.
_other | The other body. |
const std::string & Body::GetFileName | ( | ) | const |
Get the file name from which this body was constructed.
std::string Body::GetFilePath | ( | ) | const |
Get the full path of the file from which this body was constructed.
|
noexcept |
_index | Index of desired forward Connection |
|
noexcept |
Get the index of this body within the owning MultiBody.
double Body::GetMass | ( | ) | const |
Get the mass.
const Matrix3x3 & Body::GetMoment | ( | ) | const |
Get the moment of inertia matrix in the model frame.
|
noexcept |
Get the movement type for this body.
const GMSPolyhedron & Body::GetPolyhedron | ( | ) | const |
Get the polyhedron in model coordinates.
const string & Body::GetTexture | ( | ) | const |
Get the loaded texture file name.
double Body::GetWeight | ( | ) | const |
Get the weight of this body.
GMSPolyhedron Body::GetWorldBoundingBox | ( | ) | const |
Compute the bounding box in world coordinates.
const GMSPolyhedron & Body::GetWorldPolyhedron | ( | ) | const |
Get the polyhedron in world coordinates.
const Transformation & Body::GetWorldTransformation | ( | ) | const |
Get the transformation from model to world coordinates.
bool Body::IsAdjacent | ( | const Body *const | _otherBody | ) | const |
Determines if two bodies share the same joint
_otherBody | Second body |
|
noexcept |
Is this body a base?
bool Body::IsTextureLoaded | ( | ) | const |
Check if a texture was loaded.
|
noexcept |
Get the unique string label for this body. If none is provided, the multibody index will be used.
void Body::LinkAdjacency | ( | Connection *const | _c | ) |
Attach an Adjacency connection to this body.
_c | The Connection to attach. |
void Body::LinkBackward | ( | Connection *const | _c | ) |
Attach a backward connection to this body.
_c | The Connection to attach. |
void Body::LinkForward | ( | Connection *const | _c | ) |
Attach a forward connection to this body.
_c | The Connection to attach. |
void Body::MarkDirty | ( | ) |
Mark all cached objects as requiring an update.
void Body::Read | ( | std::istream & | _is, |
CountingStreamBuffer & | _cbs | ||
) |
Parse a body from an old .env or .robot file.
_is | An open input stream for the geometry file. |
_cbs | A counting stream buffer for error reporting. |
void Body::ReadGeometryFile | ( | const std::string & | _filename | ) |
Read geometry information from file.
_filename | The file to read from. |
void Body::ReadGeometryFile | ( | GMSPolyhedron::COMAdjust | _comAdjust = GMSPolyhedron::COMAdjust::None | ) |
Read geometry information from file.
_comAdjust | Center of mass adjustment method |
bool Body::SameParent | ( | const Body *const | _otherBody | ) | const |
Determines if two bodies share a parent
_otherBody | Second body |
|
noexcept |
Set the type of this body.
void Body::SetColor | ( | const glutils::color & | _c | ) |
Set the color for the body.
|
noexcept |
Set the movement type for this body.
void Body::SetPolyhedron | ( | GMSPolyhedron && | _poly | ) |
Set the polyhedron model for this body.
void Body::Unlink | ( | Connection *const | _c | ) |
Remove a connection to this body. Does not affect the other body or the connection object.
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).
|
static |
Directory of geometry files.