RobWorkProject
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
RWPEIsland Class Reference

The RWPEIsland engine. More...

#include <RWPEIsland.hpp>

Inherits PhysicsEngine.

Public Types

typedef rw::common::Ptr< RWPEIslandPtr
 Smart pointer type of RWPEIsland.
 
- Public Types inherited from PhysicsEngine
typedef rw::common::Ptr< PhysicsEnginePtr
 smart pointer type of PhysicsEngine
 

Public Member Functions

 RWPEIsland ()
 Create a new empty RWPEIsland.
 
 RWPEIsland (rw::common::Ptr< rwsim::contacts::ContactDetector > detector)
 Create a new empty RWPEIsland. More...
 
 RWPEIsland (rw::common::Ptr< rwsim::dynamics::DynamicWorkCell > dwc, rw::common::Ptr< rwsim::contacts::ContactDetector > detector=NULL)
 Create a new RWPEIsland physics engine based on a complete dynamic workcell. More...
 
 ~RWPEIsland ()
 Destructor.
 
const rw::math::Vector3DgetGravity () const
 Get the currently used gravity in world frame. More...
 
void setGravity (const rw::math::Vector3D<> &gravity)
 Set the gravity. More...
 
void step (double dt, rw::common::Ptr< rw::common::ThreadTask > task)
 Step the simulator by adding work to ThreadTask. More...
 
RWPEIslandState getRWPEState () const
 Get a copy of the internal state of the engine. More...
 
rw::kinematics::State getState () const
 Get the current internal state of the simulator. More...
 
void resetScene (const RWPEIslandState &state)
 Reset the internal engine state. More...
 
virtual void load (rw::common::Ptr< rwsim::dynamics::DynamicWorkCell > dwc)
 
bool setContactDetector (rw::common::Ptr< rwsim::contacts::ContactDetector > detector)
 
void step (double dt)
 
void step (double dt, rw::kinematics::State &state)
 
void resetScene (rw::kinematics::State &state)
 
void initPhysics (rw::kinematics::State &state)
 
void exitPhysics ()
 
double getTime ()
 
void setEnabled (rw::common::Ptr< rwsim::dynamics::Body > body, bool enabled)
 
void setDynamicsEnabled (rw::common::Ptr< rwsim::dynamics::Body > body, bool enabled)
 
rwsim::drawable::SimulatorDebugRender::Ptr createDebugRender ()
 
rw::common::PropertyMapgetPropertyMap ()
 
const rw::common::PropertyMapgetPropertyMap () const
 
const rw::common::PropertyMapgetPropertyMapDefault () const
 Get a map with the default properties. More...
 
void emitPropertyChanged ()
 
void addController (rw::common::Ptr< rwlibs::simulation::SimulatedController > controller)
 
void removeController (rw::common::Ptr< rwlibs::simulation::SimulatedController > controller)
 
void addBody (rw::common::Ptr< rwsim::dynamics::Body > body, rw::kinematics::State &state)
 
void addDevice (rw::common::Ptr< rwsim::dynamics::DynamicDevice > dev, rw::kinematics::State &state)
 
void addSensor (rwlibs::simulation::SimulatedSensor::Ptr sensor, rw::kinematics::State &state)
 
void removeSensor (rwlibs::simulation::SimulatedSensor::Ptr sensor)
 
void attach (rw::common::Ptr< rwsim::dynamics::Body > b1, rw::common::Ptr< rwsim::dynamics::Body > b2)
 
void detach (rw::common::Ptr< rwsim::dynamics::Body > b1, rw::common::Ptr< rwsim::dynamics::Body > b2)
 
std::vector< rwlibs::simulation::SimulatedSensor::PtrgetSensors ()
 
void setSimulatorLog (rw::common::Ptr< rwsim::log::SimulatorLogScope > log)
 
- Public Member Functions inherited from PhysicsEngine
virtual ~PhysicsEngine ()
 destructor
 

Static Public Member Functions

static rw::common::PropertyMap getDefaultPropertyMap ()
 Get a new PropertyMap with default properties. More...
 

Detailed Description

The RWPEIsland engine.

A RWPEIsland is a basic engine that will solve for all bodies, constraints and contacts in one large equation system. If the system can be decomposed into smaller independent RWPEIslands, it is the responsibility of the user to do this.

Under normal circumstances this engine should not be used by the user directly, as it will be too computationally expensive to solve dynamics for large dynamic workcells as one unit. Instead the RWPEWorld engine should be used, which will decompose and manage independent RWPEIslands dynamically to achieve best possible performance. It will also manage time synchronization between islands.

Consider using the RWPEIsland directly in rare circumstances if the dynamic system is extremely simple, and the overhead in managing independent islands would be too big.

Please note that the simulator uses many thresholds, tolerances and other properties. These are documented in the documentation for the getDefaultPropertyMap function.

Constructor & Destructor Documentation

◆ RWPEIsland() [1/2]

Create a new empty RWPEIsland.

Parameters
detector[in] the contact detector to use.

◆ RWPEIsland() [2/2]

Create a new RWPEIsland physics engine based on a complete dynamic workcell.

Parameters
dwc[in] the dynamic workcell to create island from.
detector[in] (optional) the contact detector to use. If none given a default detector is created.

Member Function Documentation

◆ addBody()

void addBody ( rw::common::Ptr< rwsim::dynamics::Body body,
rw::kinematics::State state 
)
virtual

Implements PhysicsEngine.

◆ addController()

void addController ( rw::common::Ptr< rwlibs::simulation::SimulatedController controller)
virtual

Implements PhysicsEngine.

◆ addDevice()

void addDevice ( rw::common::Ptr< rwsim::dynamics::DynamicDevice dev,
rw::kinematics::State state 
)
virtual

Implements PhysicsEngine.

◆ addSensor()

void addSensor ( rwlibs::simulation::SimulatedSensor::Ptr  sensor,
rw::kinematics::State state 
)
virtual

Implements PhysicsEngine.

◆ attach()

void attach ( rw::common::Ptr< rwsim::dynamics::Body b1,
rw::common::Ptr< rwsim::dynamics::Body b2 
)
virtual

Implements PhysicsEngine.

◆ createDebugRender()

rwsim::drawable::SimulatorDebugRender::Ptr createDebugRender ( )
virtual

Implements PhysicsEngine.

◆ detach()

void detach ( rw::common::Ptr< rwsim::dynamics::Body b1,
rw::common::Ptr< rwsim::dynamics::Body b2 
)
virtual

Implements PhysicsEngine.

◆ emitPropertyChanged()

void emitPropertyChanged ( )
virtual

Implements PhysicsEngine.

◆ exitPhysics()

void exitPhysics ( )
virtual

Implements PhysicsEngine.

◆ getDefaultPropertyMap()

static rw::common::PropertyMap getDefaultPropertyMap ( )
static

Get a new PropertyMap with default properties.

This function will return the properties that are used if they have not been specified by the user. These options are loaded from the dynamic workcell. Please see the Dynamic WorkCell XML File Format page for more information on this.

Below you find a list of properties used by this engine by default. Please be aware that some properties are used to specify alternative implementations of certain subcomponents of the simulator. These alternative implementations might use different properties, which will be documented in the relevant classes. The map returned by this function will include the default properties for the default choice of subcomponents. These will not be documented in the list below, but instead references are provided to more information on the specific properties for these components.

Property Name Type Default value Description
RWPECollisionSolver string Hybrid Specifies the RWPECollisionSolver used (default is RWPECollisionSolverHybrid).
- - - See RWPECollisionSolverHybrid::addDefaultProperties for further information on the properties used by collision solvers.
RWPEContactResolver string Full Specifies the RWPEContactResolver used (default is RWPEContactResolverFull).
- - - See RWPEContactResolver::addDefaultProperties for further information on the properties used by contact resolvers.
RWPEConstraintSolver string Iterative Specifies the RWPEConstraintSolver used (default is RWPEConstraintSolverIterative).
- - - See RWPEConstraintSolver::addDefaultProperties for further information on the properties used by solvers.
RWPERollbackMethod string Ridder Specifies the RWPERollbackMethod used (default is RWPERollbackMethodRidder).
RWPECorrection int 1 Enable or disable correction (default is enabled=1).
- - - See RWPEConstraintCorrection::addDefaultProperties for further information on the properties used by correction method.
RWPERollback int 1 Enable or disable rollback (default is enabled=1).
RWPERollbackThreshold float $10^{-5}$ Precision of rollback.
RWPERollbackIterations int 10 Stop with exception if rollback requires more than this number of iterations.
RWPEWorkspace float 10 The coordinates of all bodies must lie within this workspace, or simulation fails (meters).
RWPEConstraintMaxForce float $10^{6}$ Stop with exception if theshold exceeds this value (Newtons).

◆ getGravity()

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

Get the currently used gravity in world frame.

Returns
the gravity.

◆ getPropertyMap() [1/2]

rw::common::PropertyMap& getPropertyMap ( )
virtual

Implements PhysicsEngine.

◆ getPropertyMap() [2/2]

const rw::common::PropertyMap& getPropertyMap ( ) const

◆ getPropertyMapDefault()

const rw::common::PropertyMap& getPropertyMapDefault ( ) const

Get a map with the default properties.

Returns
default PropertyMap.

◆ getRWPEState()

RWPEIslandState getRWPEState ( ) const

Get a copy of the internal state of the engine.

Returns
a copy of the state.

◆ getSensors()

std::vector<rwlibs::simulation::SimulatedSensor::Ptr> getSensors ( )
virtual

Implements PhysicsEngine.

◆ getState()

rw::kinematics::State getState ( ) const

Get the current internal state of the simulator.

Returns
a copy of the internal state.

◆ getTime()

double getTime ( )
virtual

Implements PhysicsEngine.

◆ initPhysics()

void initPhysics ( rw::kinematics::State state)
virtual

Implements PhysicsEngine.

◆ load()

virtual void load ( rw::common::Ptr< rwsim::dynamics::DynamicWorkCell dwc)
virtual

Implements PhysicsEngine.

◆ removeController()

void removeController ( rw::common::Ptr< rwlibs::simulation::SimulatedController controller)
virtual

Implements PhysicsEngine.

◆ removeSensor()

void removeSensor ( rwlibs::simulation::SimulatedSensor::Ptr  sensor)
virtual

Implements PhysicsEngine.

◆ resetScene() [1/2]

void resetScene ( const RWPEIslandState state)

Reset the internal engine state.

Parameters
state[in] the state to reset to.

◆ resetScene() [2/2]

void resetScene ( rw::kinematics::State state)
virtual

Implements PhysicsEngine.

◆ setContactDetector()

bool setContactDetector ( rw::common::Ptr< rwsim::contacts::ContactDetector detector)
virtual

Implements PhysicsEngine.

◆ setDynamicsEnabled()

void setDynamicsEnabled ( rw::common::Ptr< rwsim::dynamics::Body body,
bool  enabled 
)
virtual

Implements PhysicsEngine.

◆ setEnabled()

void setEnabled ( rw::common::Ptr< rwsim::dynamics::Body body,
bool  enabled 
)
virtual

Implements PhysicsEngine.

◆ setGravity()

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

Set the gravity.

Parameters
gravity[in] the gravity given in world frame.

◆ setSimulatorLog()

void setSimulatorLog ( rw::common::Ptr< rwsim::log::SimulatorLogScope log)
virtual

Reimplemented from PhysicsEngine.

◆ step() [1/3]

void step ( double  dt,
rw::common::Ptr< rw::common::ThreadTask task 
)

Step the simulator by adding work to ThreadTask.

The work is added as a single subtask to the given ThreadTask.

Note
This functions returns immediately and the state should not be accessed before work added to ThreadTask has finished.
Parameters
dt[in] the timestep.
task[in] the task to add work to.

◆ step() [2/3]

void step ( double  dt)

◆ step() [3/3]

void step ( double  dt,
rw::kinematics::State state 
)
virtual

Implements PhysicsEngine.


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