RobWorkProject  24.6.21-
Public Types | Public Member Functions | List of all members
DynamicWorkCell Class Reference

the DynamicWorkcell class is a container class for dynamic information/data in a workcell, much like WorkCell is a container class for the kinematic information/data in a workcell More...

#include <DynamicWorkCell.hpp>

Public Types

enum  DWCEventType {
  GravityChangedEvent , ConstraintAddedEvent , BodyAddedEvent , DeviceAddedEvent ,
  ControllerAddedEvent , SensorAddedEvent
}
 Types of events a DynamicWorkCell can emit. More...
 
typedef std::vector< Body::PtrBodyList
 Type for the collection of bodies.
 
typedef std::vector< Constraint::PtrConstraintList
 Type for the collection of constraints.
 
typedef std::vector< DynamicDevice::PtrDeviceList
 Type for the collection of devices.
 
typedef std::vector< rwlibs::simulation::SimulatedController::PtrControllerList
 Type for the collection of simulated controllers.
 
typedef std::vector< rwlibs::simulation::SimulatedSensor::PtrSensorList
 Type for the collection of simulated sensors.
 
typedef rw::core::Ptr< DynamicWorkCellPtr
 Smart pointer type for DynamicWorkCell.
 
typedef rw::core::Ptr< const DynamicWorkCellCPtr
 Smart pointer type for const DynamicWorkCell.
 
typedef boost::function< void(DWCEventType, boost::any)> DWCChangedListener
 Type for an event listener.
 
typedef rw::core::Event< DWCChangedListener, DWCEventType, boost::any > DWCChangedEvent
 Type for the event.
 

Public Member Functions

 DynamicWorkCell (rw::models::WorkCell::Ptr workcell)
 Constructor. More...
 
 DynamicWorkCell (rw::models::WorkCell::Ptr workcell, const BodyList &allbodies, const ConstraintList &constraints, const DeviceList &devices, const ControllerList &controllers)
 Constructor. More...
 
virtual ~DynamicWorkCell ()
 destructor
 
const BodyListgetBodies () const
 gets a list of all bodies in the dynamic workcell
 
Body::Ptr findBody (const std::string &name) const
 find a specific body with name name More...
 
template<class T >
rw::core::Ptr< T > findBody (const std::string &name) const
 find a specific body with name name and type T More...
 
template<class T >
std::vector< rw::core::Ptr< T > > findBodies () const
 find all bodies with type T More...
 
void addConstraint (Constraint::Ptr constraint)
 Add a constraint to the dynamic workcell. More...
 
const ConstraintListgetConstraints () const
 gets a list of all constraints in the dynamic workcell
 
Constraint::Ptr findConstraint (const std::string &name) const
 find a specific constraint with name name More...
 
const DeviceListgetDynamicDevices () const
 gets a list of all dynamic devices in the dynamic workcell More...
 
void addDevice (DynamicDevice::Ptr device)
 add a device to the dynamic workcell More...
 
DynamicDevice::Ptr findDevice (const std::string &name) const
 find a dynamic device of name name More...
 
template<class T >
rw::core::Ptr< T > findDevice (const std::string &name) const
 find a specific device with name name and type T More...
 
const ControllerListgetControllers () const
 gets a list of all controllers in the dynamic workcell
 
const SensorListgetSensors () const
 get the list of sensors
 
void addSensor (rwlibs::simulation::SimulatedSensor::Ptr sensor)
 add a sensor to the dynamic workcell More...
 
rwlibs::simulation::SimulatedSensor::Ptr findSensor (const std::string &name) const
 find a sensor More...
 
template<class T >
rw::core::Ptr< T > findSensor (const std::string &name) const
 find a sensor of a specific type. More...
 
void addBody (Body::Ptr body)
 adds a body to the dynamic workcell. More...
 
void addController (rwlibs::simulation::SimulatedController::Ptr manipulator)
 adds a body controller to the dynamic workcell. More...
 
rwlibs::simulation::SimulatedController::Ptr findController (const std::string &name) const
 Find a simulated controller. More...
 
template<class T >
rw::core::Ptr< T > findController (const std::string &name) const
 Find a simulated controller. More...
 
ContactDataMapgetContactData ()
 gets the static contact data information
 
const ContactDataMapgetContactData () const
 Get the static contact data information. More...
 
MaterialDataMapgetMaterialData ()
 gets the material data information, like friction properties
 
const MaterialDataMapgetMaterialData () const
 Get the material data information, like friction. More...
 
Body::Ptr getBody (rw::core::Ptr< rw::kinematics::Frame > f)
 gets the body associated with frame f if any.
 
rw::models::WorkCell::Ptr getWorkcell () const
 gets the default kinematic workcell
 
rw::models::WorkCell::Ptr getWorkCell () const
 gets the default kinematic workcell
 
double getCollisionMargin ()
 the collision margin describe how close
 
void setCollisionMargin (double margin)
 Set the collision margin. More...
 
WorkCellDimension getWorldDimension ()
 Get dimensions of workspace. More...
 
bool inDevice (rw::core::Ptr< const Body > body) const
 tests if a body is part of a device More...
 
void setGravity (const rw::math::Vector3D<> &grav)
 Set the gravity in this dynamic workcell. More...
 
const rw::math::Vector3DgetGravity () const
 get the gravity in this dynamic workcell More...
 
rw::core::PropertyMapgetEngineSettings ()
 get the settings and properties for the physics engine More...
 
const rw::core::PropertyMapgetEngineSettings () const
 Get the settings and properties for the physics engine. More...
 
bool remove (Body::Ptr body)
 Remove a body from the list of bodies. More...
 
DWCChangedEventchangedEvent ()
 Returns StateChangeEvent needed for subscribing and firing the event. More...
 

Detailed Description

the DynamicWorkcell class is a container class for dynamic information/data in a workcell, much like WorkCell is a container class for the kinematic information/data in a workcell

The dynamic description includes:

Member Enumeration Documentation

◆ DWCEventType

Types of events a DynamicWorkCell can emit.

Enumerator
GravityChangedEvent 

If the gravity is changed.

ConstraintAddedEvent 

When a constraint is added.

BodyAddedEvent 

When a body is added.

DeviceAddedEvent 

When a device is added.

ControllerAddedEvent 

When a controller is added.

SensorAddedEvent 

When a sensor is added.

Constructor & Destructor Documentation

◆ DynamicWorkCell() [1/2]

Constructor.

Parameters
workcell[in] a smart pointer to the rw::models::WorkCell

◆ DynamicWorkCell() [2/2]

DynamicWorkCell ( rw::models::WorkCell::Ptr  workcell,
const BodyList allbodies,
const ConstraintList constraints,
const DeviceList devices,
const ControllerList controllers 
)

Constructor.

Parameters
workcell[in] a smart pointer to the rw::models::WorkCell
allbodies[in] a list of bodies.
constraints[in] a list of constraints.
devices[in] a list of devices.
controllers[in] a list of controllers.

Member Function Documentation

◆ addBody()

void addBody ( Body::Ptr  body)

adds a body to the dynamic workcell.

Notice that this will change the length of the default State.

◆ addConstraint()

void addConstraint ( Constraint::Ptr  constraint)

Add a constraint to the dynamic workcell.

Parameters
constraint[in] a smart pointer to the constraint to add.

◆ addController()

void addController ( rwlibs::simulation::SimulatedController::Ptr  manipulator)
inline

adds a body controller to the dynamic workcell.

Notice that this will change the length of the default State.

◆ addDevice()

void addDevice ( DynamicDevice::Ptr  device)

add a device to the dynamic workcell

Parameters
device[in] a device

◆ addSensor()

void addSensor ( rwlibs::simulation::SimulatedSensor::Ptr  sensor)

add a sensor to the dynamic workcell

Parameters
sensor[in] a simulated sensor

◆ changedEvent()

DWCChangedEvent& changedEvent ( )
inline

Returns StateChangeEvent needed for subscribing and firing the event.

Returns
Reference to the StateChangedEvent

◆ findBodies()

std::vector<rw::core::Ptr<T> > findBodies ( ) const
inline

find all bodies with type T

Returns
list of all bodies of type T

◆ findBody() [1/2]

Body::Ptr findBody ( const std::string &  name) const

find a specific body with name name

Parameters
name[in] name of body
Returns
body if found, NULL otherwise

◆ findBody() [2/2]

rw::core::Ptr<T> findBody ( const std::string &  name) const
inline

find a specific body with name name and type T

Parameters
name[in] name of body
Returns
body if found, NULL otherwise

◆ findConstraint()

Constraint::Ptr findConstraint ( const std::string &  name) const

find a specific constraint with name name

Parameters
name[in] name of constraint
Returns
constraint if found, NULL otherwise

◆ findController() [1/2]

rwlibs::simulation::SimulatedController::Ptr findController ( const std::string &  name) const

Find a simulated controller.

Parameters
name[in] name of the controller.
Returns
the simulated controller if found, NULL otherwise.

◆ findController() [2/2]

rw::core::Ptr<T> findController ( const std::string &  name) const
inline

Find a simulated controller.

Parameters
name[in] name of the controller.
Returns
the simulated controller if found, NULL otherwise.

◆ findDevice() [1/2]

DynamicDevice::Ptr findDevice ( const std::string &  name) const

find a dynamic device of name name

Parameters
name[in] name of device
Returns
a device with name name or null

◆ findDevice() [2/2]

rw::core::Ptr<T> findDevice ( const std::string &  name) const
inline

find a specific device with name name and type T

Parameters
name[in] name of body
Returns
body if found, NULL otherwise

◆ findSensor() [1/2]

rwlibs::simulation::SimulatedSensor::Ptr findSensor ( const std::string &  name) const

find a sensor

Parameters
name[in] the sensor
Returns

◆ findSensor() [2/2]

rw::core::Ptr<T> findSensor ( const std::string &  name) const
inline

find a sensor of a specific type.

Parameters
name[in] name of sensor
Returns

◆ getContactData()

const ContactDataMap& getContactData ( ) const
inline

Get the static contact data information.

Returns
a reference to a constant rwsim::dynamics::ContactDataMap.

◆ getDynamicDevices()

const DeviceList& getDynamicDevices ( ) const
inline

gets a list of all dynamic devices in the dynamic workcell

Returns
a list of dynamic devices.

◆ getEngineSettings() [1/2]

rw::core::PropertyMap& getEngineSettings ( )
inline

get the settings and properties for the physics engine

Returns
propertymap

◆ getEngineSettings() [2/2]

const rw::core::PropertyMap& getEngineSettings ( ) const
inline

Get the settings and properties for the physics engine.

Returns
a reference to a constant PropertyMap.

◆ getGravity()

const rw::math::Vector3D& getGravity ( ) const
inline

get the gravity in this dynamic workcell

Returns
gravity

◆ getMaterialData()

const MaterialDataMap& getMaterialData ( ) const
inline

Get the material data information, like friction.

Returns
a reference to a constant rwsim::dynamics::ContactDataMap.

◆ getWorldDimension()

WorkCellDimension getWorldDimension ( )
inline

Get dimensions of workspace.

Returns
the dimensions.

◆ inDevice()

bool inDevice ( rw::core::Ptr< const Body body) const

tests if a body is part of a device

Parameters
body[in] the body to test for.
Returns
true if body is part of the device.

◆ remove()

bool remove ( Body::Ptr  body)

Remove a body from the list of bodies.

Parameters
body[in] the body to be removed
Returns
True if body was removed otherwise false

◆ setCollisionMargin()

void setCollisionMargin ( double  margin)
inline

Set the collision margin.

Parameters
margin[in] the new margin.

◆ setGravity()

void setGravity ( const rw::math::Vector3D<> &  grav)
inline

Set the gravity in this dynamic workcell.

Parameters
grav[in] the direction and strength of gravity

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