RobWorkProject
Classes | Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
DeformableObject Class Reference

The deformable object is an object that contain a deformable mesh. Deformations are part of the state object and they are modeled/controlled through control nodes. each control node correspond to a vertice in the mesh. All vertices are described relative to the base frame of the object. More...

#include <DeformableObject.hpp>

Inherits Object.

Classes

class  DeformableObjectCache
 

Public Types

typedef rw::common::Ptr< DeformableObjectPtr
 smart pointer type
 
- Public Types inherited from Object
typedef rw::common::Ptr< ObjectPtr
 smart pointer
 
typedef rw::common::Ptr< const ObjectCPtr
 const smart pointer
 
- Public Types inherited from Stateless
typedef rw::common::Ptr< StatelessPtr
 Smart pointer type for Stateless.
 

Public Member Functions

 DeformableObject (rw::kinematics::Frame *baseframe, int nr_of_nodes)
 constructor - constructs a deformable mesh with a specific number of control nodes and without any faces. Both geometry and model are created based on nodes. More...
 
 DeformableObject (rw::kinematics::Frame *baseframe, rw::common::Ptr< rw::graphics::Model3D > model)
 constructor - control nodes are taken as vertices in the Model3D. Vertices that are equal are merged into the same control node. All faces of the model are used to define faces of the deformable object. More...
 
 DeformableObject (rw::kinematics::Frame *baseframe, rw::common::Ptr< rw::geometry::Geometry > geom)
 constructor - control nodes are taken from a triangle mesh generated from triangulating the geometry. Vertices that are equal are merged into the same control node. All faces of the geometry are used to define faces of the deformable object. More...
 
virtual ~DeformableObject ()
 destructor
 
rw::math::Vector3D< float > & getNode (int id, rw::kinematics::State &state) const
 get a specific node from the state More...
 
const rw::math::Vector3D< float > & getNode (int id, const rw::kinematics::State &state) const
 get a specific node from the state More...
 
void setNode (int id, const rw::math::Vector3D< float > &v, rw::kinematics::State &state)
 set the value of a specific node in the state. More...
 
size_t getNrNodes (const rw::kinematics::State &state) const
 
size_t getNrNodes () const
 
const std::vector< rw::geometry::IndexedTriangle<> > & getFaces () const
 get all faces of this soft body More...
 
void addFace (unsigned int node1, unsigned int node2, unsigned int node3)
 add a face to three existing nodes More...
 
rw::geometry::IndexedTriMesh< float >::Ptr getMesh (rw::kinematics::State &cstate)
 return a triangle mesh representing the softbody in the current state cstate More...
 
double getMass (rw::kinematics::State &state) const
 get mass in Kg of this object More...
 
rw::math::Vector3D getCOM (rw::kinematics::State &state) const
 get center of mass of this object More...
 
rw::math::InertiaMatrix getInertia (rw::kinematics::State &state) const
 returns the inertia matrix of this body calculated around COM with the orientation of the base frame.
 
void update (rw::common::Ptr< rw::graphics::Model3D > model, const rw::kinematics::State &state)
 updates the model with the current state of the deformable model More...
 
- Public Member Functions inherited from Object
virtual ~Object ()
 destructor
 
const std::string & getName ()
 get name of this object. Name is always the same as the name of the base frame. More...
 
rw::kinematics::FramegetBase ()
 get base frame of this object More...
 
const rw::kinematics::FramegetBase () const
 
const std::vector< rw::kinematics::Frame * > & getFrames ()
 get all associated frames of this object More...
 
void addFrame (rw::kinematics::Frame *frame)
 associate a frame to this Object. More...
 
const std::vector< rw::geometry::Geometry::Ptr > & getGeometry () const
 get default geometries More...
 
const std::vector< rw::graphics::Model3D::Ptr > & getModels () const
 get the default models More...
 
const std::vector< rw::geometry::Geometry::Ptr > & getGeometry (const rw::kinematics::State &state) const
 get geometry of this object More...
 
const std::vector< rw::graphics::Model3D::Ptr > & getModels (const rw::kinematics::State &state) const
 get visualization models of this object More...
 
- Public Member Functions inherited from Stateless
virtual ~Stateless ()
 destructor
 
virtual void registerIn (State &state)
 initialize this stateless data to a specific state More...
 
virtual void registerIn (StateStructure::Ptr state)
 register this stateless object in a statestructure.
 
virtual void unregister ()
 unregisters all state data of this stateless object
 
StateStructure::Ptr getStateStructure ()
 Get the state structure. More...
 
const StateStructure::Ptr getStateStructure () const
 Get the state structure. More...
 
bool isRegistered ()
 Check if object has registered its state. More...
 

Protected Member Functions

const std::vector< rw::common::Ptr< rw::geometry::Geometry > > & doGetGeometry (const rw::kinematics::State &state) const
 get geometry of this object More...
 
const std::vector< rw::common::Ptr< rw::graphics::Model3D > > & doGetModels (const rw::kinematics::State &state) const
 get visualization models of this object More...
 
- Protected Member Functions inherited from Object
 Object (rw::kinematics::Frame *baseframe)
 constructor
 
 Object (std::vector< rw::kinematics::Frame *> frames)
 constructor - first frame is base
 
- Protected Member Functions inherited from Stateless
 Stateless ()
 constructor
 
template<class T >
void add (StatelessData< T > &data)
 implementations of sensor should add all their stateless data on initialization
 
void add (StateData *data)
 Add data. More...
 
void add (boost::shared_ptr< StateData > data)
 implementations of sensor should add all their state data on initialization
 

Friends

class WorkCell
 WorkCell keeps track of devices, obstacles and objects in the scene. More...
 

Additional Inherited Members

- Protected Attributes inherited from Stateless
bool _registered
 True if object has registered its state.
 
std::vector< boost::shared_ptr< StateData > > _datas
 Data.
 
StateStructure::Ptr _stateStruct
 The state structure.
 

Detailed Description

The deformable object is an object that contain a deformable mesh. Deformations are part of the state object and they are modeled/controlled through control nodes. each control node correspond to a vertice in the mesh. All vertices are described relative to the base frame of the object.

Constructor & Destructor Documentation

◆ DeformableObject() [1/3]

DeformableObject ( rw::kinematics::Frame baseframe,
int  nr_of_nodes 
)

constructor - constructs a deformable mesh with a specific number of control nodes and without any faces. Both geometry and model are created based on nodes.

Parameters
baseframe[in] base frame of object
nr_of_nodes[in] the number of controlling nodes in the deformable object

◆ DeformableObject() [2/3]

constructor - control nodes are taken as vertices in the Model3D. Vertices that are equal are merged into the same control node. All faces of the model are used to define faces of the deformable object.

geometry will be created based on model information

Note
only triangle faces are currently supported.
Parameters
baseframe[in] base frame of object
model[in]

◆ DeformableObject() [3/3]

constructor - control nodes are taken from a triangle mesh generated from triangulating the geometry. Vertices that are equal are merged into the same control node. All faces of the geometry are used to define faces of the deformable object.

model will be created based on geometry information

Parameters
baseframe[in] base frame of object
geom[in] geometry to define the faces and nodes

Member Function Documentation

◆ addFace()

void addFace ( unsigned int  node1,
unsigned int  node2,
unsigned int  node3 
)

add a face to three existing nodes

Parameters
node1[in] idx of node 1
node2[in] idx of node 2
node3[in] idx of node 3

◆ doGetGeometry()

const std::vector<rw::common::Ptr<rw::geometry::Geometry> >& doGetGeometry ( const rw::kinematics::State state) const
protectedvirtual

get geometry of this object

Returns
geometry for collision detection.

Implements Object.

◆ doGetModels()

const std::vector<rw::common::Ptr<rw::graphics::Model3D> >& doGetModels ( const rw::kinematics::State state) const
protectedvirtual

get visualization models of this object

Returns
models for visualization

Implements Object.

◆ getCOM()

rw::math::Vector3D getCOM ( rw::kinematics::State state) const
virtual

get center of mass of this object

Parameters
state[in] the state in which to get center of mass
Returns

Implements Object.

◆ getFaces()

const std::vector<rw::geometry::IndexedTriangle<> >& getFaces ( ) const

get all faces of this soft body

Returns
list of indexed triangles - indeces point to vertices/nodes

◆ getMass()

double getMass ( rw::kinematics::State state) const
virtual

get mass in Kg of this object

Returns
mass in kilo grams

Implements Object.

◆ getMesh()

return a triangle mesh representing the softbody in the current state cstate

Parameters
cstate

◆ getNode() [1/2]

rw::math::Vector3D<float>& getNode ( int  id,
rw::kinematics::State state 
) const

get a specific node from the state

Parameters
id[in] id of the node to fetch
state[in] current state
Returns
handle to manipulate a node in the given state.

◆ getNode() [2/2]

const rw::math::Vector3D<float>& getNode ( int  id,
const rw::kinematics::State state 
) const

get a specific node from the state

Parameters
id[in] id of the node to fetch
state[in] current state
Returns
handle to manipulate a node in the given state.

◆ getNrNodes()

size_t getNrNodes ( const rw::kinematics::State state) const

get the number of controlling nodes of this deformable object.

Parameters
state[in]
Returns

◆ setNode()

void setNode ( int  id,
const rw::math::Vector3D< float > &  v,
rw::kinematics::State state 
)

set the value of a specific node in the state.

Parameters
id[in] id of the node
v[in] value to set.
state[in] state in which to set the value.

◆ update()

void update ( rw::common::Ptr< rw::graphics::Model3D model,
const rw::kinematics::State state 
)

updates the model with the current state of the deformable model

Parameters
model[in/out] model to be updated
state

Friends And Related Function Documentation

◆ WorkCell

friend class WorkCell
friend

WorkCell keeps track of devices, obstacles and objects in the scene.

WorkCell is a pretty dumb container to which you can add your devices and the frames you your GUI to show as objects or camera views.

WorkCell is responsible for keeping track of everything including all devices, object and obstacles in the environment. WorkCell contains the World Frame, which represents the root and the only frame without a parent.


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