RobWorkProject  23.9.11-
Classes | Public Types | Public Member Functions | List of all members
PhysicsEngine Class Referenceabstract

A general physics engine interface for simulating dynamics of objects and robot devices. More...

#include <PhysicsEngine.hpp>

Inherited by ODESimulator, RWSimulator, and BtSimulator.

Classes

class  Dispatcher
 Each engine implements a dispatcher that creates instances of the engine. More...
 
class  Factory
 a factory for PhysicsEngine. This factory defines an extension point for PhysicsEngines. More...
 

Public Types

typedef rw::core::Ptr< PhysicsEnginePtr
 smart pointer type of PhysicsEngine
 

Public Member Functions

virtual ~PhysicsEngine ()
 destructor
 
virtual void load (rw::core::Ptr< rwsim::dynamics::DynamicWorkCell > dwc)=0
 adds dynamic workcell
 
virtual bool setContactDetector (rw::core::Ptr< rwsim::contacts::BaseContactDetector > detector)=0
 Change the contact detector used by the engine. More...
 
virtual void step (double dt, rw::kinematics::State &state)=0
 Performs a step and updates the state.
 
virtual void resetScene (rw::kinematics::State &state)=0
 reset velocity and acceleration of all bodies to 0. And sets the position of all bodies to that described in state
 
virtual void initPhysics (rw::kinematics::State &state)=0
 initialize simulator physics with state
 
virtual void exitPhysics ()=0
 cleans up the allocated storage fo bullet physics
 
virtual double getTime ()=0
 gets the the current simulated time
 
virtual void setEnabled (rw::core::Ptr< rwsim::dynamics::Body > body, bool enabled)=0
 
virtual void setDynamicsEnabled (rw::core::Ptr< rwsim::dynamics::Body > body, bool enabled)=0
 disables the dynamics of a body. More...
 
virtual drawable::SimulatorDebugRender::Ptr createDebugRender ()=0
 create a debug render for the specific implementation More...
 
virtual rw::core::PropertyMapgetPropertyMap ()=0
 properties of the physics engine
 
virtual void emitPropertyChanged ()=0
 should be called when properties have been changed and one wants the physics engine to reflect the new properties.
 
virtual void addController (rw::core::Ptr< rwlibs::simulation::SimulatedController > controller)=0
 add a simulated controller to this simulator
 
virtual void removeController (rw::core::Ptr< rwlibs::simulation::SimulatedController > controller)=0
 removes a simulated controller from this simulator More...
 
virtual void addBody (rw::core::Ptr< rwsim::dynamics::Body > body, rw::kinematics::State &state)=0
 add a body to the physics engine More...
 
virtual void addDevice (rw::core::Ptr< rwsim::dynamics::DynamicDevice > device, rw::kinematics::State &state)=0
 add a dynamic device to the physics engine More...
 
virtual void addSensor (rwlibs::simulation::SimulatedSensor::Ptr sensor, rw::kinematics::State &state)=0
 add a simulated sensor to this simulator
 
virtual void removeSensor (rwlibs::simulation::SimulatedSensor::Ptr sensor)=0
 add a simulated sensor to this simulator
 
virtual void attach (rw::core::Ptr< rwsim::dynamics::Body > b1, rw::core::Ptr< rwsim::dynamics::Body > b2)=0
 creates a 6dof dynamic constraint between the two bodies b1 and b2 More...
 
virtual void detach (rw::core::Ptr< rwsim::dynamics::Body > b1, rw::core::Ptr< rwsim::dynamics::Body > b2)=0
 removes the 6dof constraint between bodies b1 and b2 if there is any More...
 
virtual std::vector< rwlibs::simulation::SimulatedSensor::PtrgetSensors ()=0
 get the list of simulated sensors More...
 
virtual void setSimulatorLog (rw::core::Ptr< rwsim::log::SimulatorLogScope > log)
 Store internal info during simulation. More...
 

Detailed Description

A general physics engine interface for simulating dynamics of objects and robot devices.

The general step looks like this:;

Foreach controller=_controllers controller->update(dt,state);

collision detection (contact detection) constraint solving update device/body positions (integration)

Foreach sensor=_sensors sensor->update(dt,state)

Member Function Documentation

◆ addBody()

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

add a body to the physics engine

Parameters
body[in] body to add
state[in] current state

Implemented in BtSimulator.

◆ addDevice()

virtual void addDevice ( rw::core::Ptr< rwsim::dynamics::DynamicDevice device,
rw::kinematics::State state 
)
pure virtual

add a dynamic device to the physics engine

Parameters
device[in] device to add
state[in] current state

Implemented in BtSimulator, and RWSimulator.

◆ attach()

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

creates a 6dof dynamic constraint between the two bodies b1 and b2

Parameters
b1
b2

Implemented in BtSimulator.

◆ createDebugRender()

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

create a debug render for the specific implementation

Returns
NULL if no render is available else a valid render

Implemented in ODESimulator, BtSimulator, and RWSimulator.

◆ detach()

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

removes the 6dof constraint between bodies b1 and b2 if there is any

Parameters
b1
b2

Implemented in BtSimulator.

◆ getSensors()

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

get the list of simulated sensors

Returns

Implemented in ODESimulator, BtSimulator, and RWSimulator.

◆ removeController()

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

removes a simulated controller from this simulator

Parameters
controller

Implemented in BtSimulator, and RWSimulator.

◆ setContactDetector()

virtual bool setContactDetector ( rw::core::Ptr< rwsim::contacts::BaseContactDetector detector)
pure virtual

Change the contact detector used by the engine.

Parameters
detector[in] the contact detector to use (NULL for default contact detection)
Returns
true if engine supports using a ContactDetector and the detector was set successfully.

Implemented in ODESimulator, BtSimulator, and RWSimulator.

◆ setDynamicsEnabled()

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

disables the dynamics of a body.

Parameters
body
enabled

Implemented in BtSimulator.

◆ setEnabled()

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

Enables or disables a body. A body is automatically enabled if contacts or new interactions with the Body arrise

Parameters
body[in] the body to enable/disable
enabled[in]

Implemented in BtSimulator.

◆ setSimulatorLog()

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

Store internal info during simulation.

This can be used for debugging, statistics, visualization of internal subresults, timing, benchmark and similar.

Parameters
log[in] a pointer to the log structure to store to.

Reimplemented in ODESimulator.


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