RobWorkProject  23.9.11-
Public Member Functions | List of all members
BtSimulator Class Reference

A physics engine that uses Bullet Physics as the underlying engine. More...

#include <BtSimulator.hpp>

Inherits PhysicsEngine.

Public Member Functions

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

Additional Inherited Members

- Public Types inherited from PhysicsEngine
typedef rw::core::Ptr< PhysicsEnginePtr
 smart pointer type of PhysicsEngine
 

Detailed Description

A physics engine that uses Bullet Physics as the underlying engine.

Constructor & Destructor Documentation

◆ BtSimulator()

Construct new simulator.

Parameters
dwc[in] the dynamic workcell.

Member Function Documentation

◆ addBody()

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

add a body to the physics engine

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

Implements PhysicsEngine.

◆ addConstraint()

void addConstraint ( rw::core::Ptr< const rwsim::dynamics::Constraint constraint)

Add a Constraint between two bodies.

Parameters
constraint[in] a pointer to the RobWork constraint.

◆ addController()

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

add a simulated controller to this simulator

Implements PhysicsEngine.

◆ addDevice()

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

add a dynamic device to the physics engine

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

Implements PhysicsEngine.

◆ addSensor()

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

add a simulated sensor to this simulator

Implements PhysicsEngine.

◆ attach()

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

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

Parameters
b1
b2

Implements PhysicsEngine.

◆ createDebugRender()

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

create a debug render for the specific implementation

Returns
NULL if no render is available else a valid render

Implements PhysicsEngine.

◆ detach()

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

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

Parameters
b1
b2

Implements PhysicsEngine.

◆ emitPropertyChanged()

void emitPropertyChanged ( )
virtual

should be called when properties have been changed and one wants the physics engine to reflect the new properties.

Implements PhysicsEngine.

◆ exitPhysics()

void exitPhysics ( )
virtual

cleans up the allocated storage fo bullet physics

Implements PhysicsEngine.

◆ getPropertyMap()

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

properties of the physics engine

Implements PhysicsEngine.

◆ getSensors()

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

get the list of simulated sensors

Returns

Implements PhysicsEngine.

◆ getTime()

double getTime ( )
virtual

gets the the current simulated time

Implements PhysicsEngine.

◆ initPhysics()

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

initialize simulator physics with state

Implements PhysicsEngine.

◆ load()

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

adds dynamic workcell

Implements PhysicsEngine.

◆ removeController()

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

removes a simulated controller from this simulator

Parameters
controller

Implements PhysicsEngine.

◆ removeSensor()

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

add a simulated sensor to this simulator

Implements PhysicsEngine.

◆ resetScene()

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

reset velocity and acceleration of all bodies to 0. And sets the position of all bodies to that described in state

Implements PhysicsEngine.

◆ setContactDetector()

bool setContactDetector ( rw::core::Ptr< rwsim::contacts::BaseContactDetector detector)
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.

Implements PhysicsEngine.

◆ setDynamicsEnabled()

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

disables the dynamics of a body.

Parameters
body
enabled

Implements PhysicsEngine.

◆ setEnabled()

void setEnabled ( rw::core::Ptr< rwsim::dynamics::Body body,
bool  enabled 
)
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]

Implements PhysicsEngine.

◆ step()

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

Performs a step and updates the state.

Implements PhysicsEngine.


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