Grip-Reloaded
Grip version visualizaiton interface for DART (DynamicAnimationandRoboticsToolkits)
Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes
GripSimulation Class Reference

Class that handles the simulation loop, simulation timeline, timing and communicates with the main GUI thread via slots and signals. This class subclass QObject and is used by creating an instance of the class and then moving it to a thread with the "moveToThread(QThread*)" function. More...

#include <GripSimulation.h>

List of all members.

Public Slots

virtual void startSimulation ()
 Slot that checks if there's a world object. If so, initialize time variables and start the simulation loop. Otherwise exit.
virtual void stopSimulation ()
 Slot that sets the simulating flag to false to stop the simulation loop.
virtual void simulateTimeStep ()
 Slot that simulates a single time step. This function calls itself, unless the flag "simulateOneFrame" is set to true.
virtual void simulateSingleTimeStep ()
 Slot that sets the "simulateOneFrame" to true and simulate a time step.

Signals

void simulationStoppedSignal ()
 Signal to tell parent widget that the simulation loop is done. This is used to make sure the simulation loop is done using the world object before the parent deletes it.
void signalRelTimeChanged (double simTimeRelToRealTimeInstantaneous)
 Signal to pass the time value of the simulation real time.
void signalSendMessage (QString msg)
 Signal to pass message to status bar in main window.

Public Member Functions

 GripSimulation (dart::simulation::World *world, std::vector< GripTimeslice > *timeline, QList< GripTab * > *pluginLinst, MainWindow *parent=0, bool debug=false)
 Macro to create meta-object code for the signals and slots.
 ~GripSimulation ()
 Destroys the GripSimulation object.
void setWorld (dart::simulation::World *world)
 Set the world object for the simulation.
void reset ()
 Reset the GripSimulation object.

Protected Member Functions

void addWorldToTimeline (const dart::simulation::World &worldToAdd)
 Adds a GripTimeslice to the timeline vector in order to store the world time and state in the timeline for playback or movie saving at a later time.

Protected Attributes

dart::simulation::World * _world
 World object received from creator that we need to simulate.
std::vector< GripTimeslice > * _timeline
 Array of GripTimeSlice objects for simulation/kinematic playback.
QList< GripTab * > * _plugins
 List of plugin pointers in order call their functions every timestep of simulation.
QThread * _thread
 Local thread to move object into.
double _simulationDuration
 Simulation time in realtime.
double _simulationStartTime
 Initial system clock time when simulation started.
double _simTimeRelToRealTimeInstantaneous
 Simulation time relative to realtime (ie. 1.0 is realtime. 0.5 is half the speed of realtime)
double _prevTime
 Real time on the last time step.
bool _simulating
 Bool for whether or not we are simulating.
bool _simulateOneFrame
 Bool for whether or not to simulate only one frame.
bool _debug
 Bool for whether or not to print debug output to standard error.

Detailed Description

Class that handles the simulation loop, simulation timeline, timing and communicates with the main GUI thread via slots and signals. This class subclass QObject and is used by creating an instance of the class and then moving it to a thread with the "moveToThread(QThread*)" function.


Constructor & Destructor Documentation

GripSimulation::GripSimulation ( dart::simulation::World *  world,
std::vector< GripTimeslice > *  timeline,
QList< GripTab * > *  pluginLinst,
MainWindow parent = 0,
bool  debug = false 
)

Macro to create meta-object code for the signals and slots.

Constructs a GripSimulation object

Parameters:
parentPointer to the parent widget. Default is 0
debugFlag for whether or not to output debug statements

Member Function Documentation

void GripSimulation::addWorldToTimeline ( const dart::simulation::World &  worldToAdd) [protected]

Adds a GripTimeslice to the timeline vector in order to store the world time and state in the timeline for playback or movie saving at a later time.

Parameters:
worldToAdddart::simulation::World object of which to save the time and state.
Returns:
void

Reset the GripSimulation object.

Returns:
void
void GripSimulation::setWorld ( dart::simulation::World *  world)

Set the world object for the simulation.

Parameters:
worldA pointer to the dart::simulation::World to be simulated
Returns:
void
void GripSimulation::signalRelTimeChanged ( double  simTimeRelToRealTimeInstantaneous) [signal]

Signal to pass the time value of the simulation real time.

Parameters:
simTimeRelToRealTimeInstantaneousThe simluation time relative to real time
Returns:
void
void GripSimulation::signalSendMessage ( QString  msg) [signal]

Signal to pass message to status bar in main window.

Parameters:
msgQString message to display in status bar
Returns:
void
void GripSimulation::simulateSingleTimeStep ( ) [virtual, slot]

Slot that sets the "simulateOneFrame" to true and simulate a time step.

Returns:
void
void GripSimulation::simulateTimeStep ( ) [virtual, slot]

Slot that simulates a single time step. This function calls itself, unless the flag "simulateOneFrame" is set to true.

Returns:
void

Signal to tell parent widget that the simulation loop is done. This is used to make sure the simulation loop is done using the world object before the parent deletes it.

Returns:
void
void GripSimulation::startSimulation ( ) [virtual, slot]

Slot that checks if there's a world object. If so, initialize time variables and start the simulation loop. Otherwise exit.

Returns:
void
void GripSimulation::stopSimulation ( ) [virtual, slot]

Slot that sets the simulating flag to false to stop the simulation loop.

Returns:
void

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator