hpp::model::Body Class Reference

Geometry associated to a Joint. More...

#include <hpp/model/body.hh>

Public Member Functions

JointPtr_t joint () const
 Get joint holding the body. More...
 
void joint (JointPtr_t joint)
 Set joint holding the body. More...
 
Construction and copy and destruction

Constructor

 Body ()
 
 Body (const Body &body)
 Copy constructor. More...
 
BodyPtr_t clone (const JointPtr_t &joint) const
 Clone body and attach to given joint. More...
 
virtual ~Body ()
 
Name
void name (const std::string &name)
 Set name. More...
 
std::string name () const
 Get name. More...
 
Inner objects
virtual void addInnerObject (const CollisionObjectPtr_t &object, bool collision, bool distance)
 Add an object to the body. More...
 
virtual void removeInnerObject (const CollisionObjectPtr_t &object, bool collision, bool distance)
 Remove an object to the body. More...
 
const ObjectVector_tinnerObjects (Request_t type) const
 Access to inner objects. More...
 
value_type radius () const
 Get radius. More...
 
Outer objects
virtual void addOuterObject (const CollisionObjectPtr_t &object, bool collision, bool distance)
 Add an object as obstacle for this body. More...
 
virtual void removeOuterObject (const CollisionObjectPtr_t &object, bool collision, bool distance)
 Remove an obstacle to the body. More...
 
const ObjectVector_touterObjects (Request_t type) const
 Access to outer objects. More...
 
Collision and distance computation
bool collisionTest () const
 Test for collision. More...
 
void computeDistances (DistanceResults_t &results, DistanceResults_t::size_type &offset)
 Compute distances between pairs of objects stored in bodies. More...
 
Inertial information

Get position of center of mass in joint local reference frame.

const fcl::Vec3flocalCenterOfMass () const
 
void localCenterOfMass (const fcl::Vec3f &localCenterOfMass)
 Set postion of center of mass in joint reference frame. More...
 
const matrix3_tinertiaMatrix () const
 Get Intertia matrix expressed in joint local reference frame. More...
 
void inertiaMatrix (const matrix3_t &inertiaMatrix)
 Set inertia matrix. More...
 
value_type mass () const
 Get mass. More...
 
void mass (value_type mass)
 Set mass. More...
 

Detailed Description

Geometry associated to a Joint.

A body is a geometry container attached to a joint. The body contains objects (CollisionObject) that move with the joint and called inner objects.

Collision and distance computation is performed against other objects that can be obstacles or objects attached to other joints. These object are called outer objects for the body.

Constructor & Destructor Documentation

◆ Body() [1/2]

hpp::model::Body::Body ( )

◆ Body() [2/2]

hpp::model::Body::Body ( const Body body)

Copy constructor.

◆ ~Body()

virtual hpp::model::Body::~Body ( )
inlinevirtual

Member Function Documentation

◆ addInnerObject()

virtual void hpp::model::Body::addInnerObject ( const CollisionObjectPtr_t object,
bool  collision,
bool  distance 
)
virtual

Add an object to the body.

Parameters
objectobject to add. Position of object is expressed in world frame.
collisionwhether this object should be considered for collision
distancewhether this object should be considered for distance computation
Note
If object is already in body, do nothing.

◆ addOuterObject()

virtual void hpp::model::Body::addOuterObject ( const CollisionObjectPtr_t object,
bool  collision,
bool  distance 
)
virtual

Add an object as obstacle for this body.

Parameters
objectobject to add. Position of object is expressed in world frame.
collisionwhether this object should be considered for collision
distancewhether this object should be considered for distance computation
Note
If object is already in body, do nothing.
Warning
Added objects by this method will be unknown from the Device and will not be reset by it

◆ clone()

BodyPtr_t hpp::model::Body::clone ( const JointPtr_t joint) const

Clone body and attach to given joint.

inner and outer object lists are filled with copies of the objects contained in the lists of this. (See CollisionObject::clone).

◆ collisionTest()

bool hpp::model::Body::collisionTest ( ) const

Test for collision.

Returns
true if collision, false if no collision

◆ computeDistances()

void hpp::model::Body::computeDistances ( DistanceResults_t results,
DistanceResults_t::size_type &  offset 
)

Compute distances between pairs of objects stored in bodies.

◆ inertiaMatrix() [1/2]

const matrix3_t& hpp::model::Body::inertiaMatrix ( ) const
inline

Get Intertia matrix expressed in joint local reference frame.

◆ inertiaMatrix() [2/2]

void hpp::model::Body::inertiaMatrix ( const matrix3_t inertiaMatrix)
inline

Set inertia matrix.

◆ innerObjects()

const ObjectVector_t& hpp::model::Body::innerObjects ( Request_t  type) const

Access to inner objects.

Parameters
typeCollision or distance

◆ joint() [1/2]

JointPtr_t hpp::model::Body::joint ( ) const
inline

Get joint holding the body.

◆ joint() [2/2]

void hpp::model::Body::joint ( JointPtr_t  joint)
inline

Set joint holding the body.

References distance(), and joint().

Referenced by joint().

◆ localCenterOfMass() [1/2]

const fcl::Vec3f& hpp::model::Body::localCenterOfMass ( ) const
inline

◆ localCenterOfMass() [2/2]

void hpp::model::Body::localCenterOfMass ( const fcl::Vec3f localCenterOfMass)
inline

Set postion of center of mass in joint reference frame.

◆ mass() [1/2]

value_type hpp::model::Body::mass ( ) const
inline

Get mass.

◆ mass() [2/2]

void hpp::model::Body::mass ( value_type  mass)
inline

Set mass.

◆ name() [1/2]

void hpp::model::Body::name ( const std::string &  name)
inline

Set name.

References name().

Referenced by name().

◆ name() [2/2]

std::string hpp::model::Body::name ( ) const
inline

Get name.

◆ outerObjects()

const ObjectVector_t& hpp::model::Body::outerObjects ( Request_t  type) const

Access to outer objects.

Parameters
typeCollision or distance

◆ radius()

value_type hpp::model::Body::radius ( ) const
inline

Get radius.

Radius is defined as an upper-bound to the distance of all points of the body to the origin of the joint that holds the body.

◆ removeInnerObject()

virtual void hpp::model::Body::removeInnerObject ( const CollisionObjectPtr_t object,
bool  collision,
bool  distance 
)
virtual

Remove an object to the body.

Parameters
objectobject to remove
collisionwhether this object should be removed from list of collision objects
distancewhether this object should be removed from list of distance computation objects
Note
If object is not in body, do nothing

◆ removeOuterObject()

virtual void hpp::model::Body::removeOuterObject ( const CollisionObjectPtr_t object,
bool  collision,
bool  distance 
)
virtual

Remove an obstacle to the body.

Parameters
objectobject to remove
collisionwhether this object should be removed from list of collision objects
distancewhether this object should be removed from list of distance computation objects
Note
If object is not in body, do nothing