RobWorkProject  23.9.11-
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::core::Ptr< DeformableObjectPtr
 smart pointer type
 
- Public Types inherited from Object
typedef rw::core::Ptr< ObjectPtr
 smart pointer
 
typedef rw::core::Ptr< const ObjectCPtr
 const smart pointer
 
- Public Types inherited from Stateless
typedef rw::core::Ptr< StatelessPtr
 Smart pointer type for Stateless.
 

Public Member Functions

 DeformableObject (rw::core::Ptr< 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::core::Ptr< rw::kinematics::Frame > baseframe, rw::core::Ptr< rw::geometry::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::core::Ptr< rw::kinematics::Frame > baseframe, rw::core::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
 get the number of controlling nodes of this deformable object. More...
 
size_t getNrNodes () const
 get the number of controlling nodes of this deformable object. More...
 
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 (const rw::kinematics::State &state) const
 get mass in Kg of this object More...
 
rw::math::Vector3D< double > getCOM (const rw::kinematics::State &state) const
 get center of mass of this object More...
 
rw::math::InertiaMatrix getInertia (const rw::kinematics::State &state) const
 returns the inertia matrix of this body calculated around COM with the orientation of the base frame. More...
 
void update (rw::core::Ptr< rw::geometry::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
 get base frame of this object More...
 
const std::vector< rw::kinematics::Frame * > & getFrames ()
 get all associated frames of this object More...
 
void addFrame (rw::core::Ptr< 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::geometry::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::geometry::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::core::Ptr< rw::geometry::Geometry > > & doGetGeometry (const rw::kinematics::State &state) const
 get geometry of this object More...
 
const std::vector< rw::core::Ptr< rw::geometry::Model3D > > & doGetModels (const rw::kinematics::State &state) const
 get visualization models of this object More...
 
- Protected Member Functions inherited from Object
 Object (rw::core::Ptr< 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 (rw::core::Ptr< StateData > data)
 implementations of sensor should add all their state data on initialization
 

Friends

class WorkCell
 

Additional Inherited Members

- Protected Attributes inherited from Stateless
bool _registered
 True if object has registered its state.
 
std::vector< rw::core::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::core::Ptr< 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::core::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::core::Ptr<rw::geometry::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<double> getCOM ( const 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
Position of COM

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

◆ getInertia()

rw::math::InertiaMatrix getInertia ( const rw::kinematics::State state) const
virtual

returns the inertia matrix of this body calculated around COM with the orientation of the base frame.

Parameters
state[in] the state to get the inertia in
Returns
matrix with inertia

Implements Object.

◆ getMass()

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

get mass in Kg of this object

Parameters
state[in] the state
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]

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.

◆ getNode() [2/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.

◆ getNrNodes() [1/2]

size_t getNrNodes ( ) const

get the number of controlling nodes of this deformable object.

Returns
Number of Nodes

◆ getNrNodes() [2/2]

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

get the number of controlling nodes of this deformable object.

Parameters
state[in]
Returns
Number of Nodes

◆ 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::core::Ptr< rw::geometry::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

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