NTRT Simulator  Version: Master
 All Classes Namespaces Files Functions Variables Typedefs Friends Pages
tgSimulation Class Reference

#include <tgSimulation.h>

Public Member Functions

 tgSimulation (tgSimView &view)
 
void step (double dt) const
 
void run () const
 
void run (int steps) const
 
void addModel (tgModel *pModel)
 
void addObstacle (tgModel *pObstacle)
 
void addDataManager (tgDataManager *pDataManager)
 
void onVisit (const tgModelVisitor &r) const
 
void reset ()
 
void reset (tgGround *newGround)
 
tgWorldgetWorld () const
 

Detailed Description

Holds objects necessary for simulation, a world, a view and a list of models.

Definition at line 45 of file tgSimulation.h.

Constructor & Destructor Documentation

tgSimulation::tgSimulation ( tgSimView view)

The only constructor.

Parameters
[in,out]viewthe way the world and its models are rendered.

Definition at line 40 of file tgSimulation.cpp.

Here is the call graph for this function:

Member Function Documentation

void tgSimulation::addDataManager ( tgDataManager pDataManager)

Add a data manager to the simulation. For example, add a data logger.

Parameters
[in]pDataManagera pointer to a tgDataManager which will capture or collect data. Exception thrown if NULL.
Exceptions
std::invalid_argumentif pDataManager is NULL

Definition at line 104 of file tgSimulation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tgSimulation::addModel ( tgModel pModel)

Add a Tensegrity to the simulation.

Parameters
[in]pModela pointer to a tgModel representing a Tensegrity; an exception is thrown if it is NULL
Exceptions
std::invalid_argumentif pModel is NULL

Definition at line 65 of file tgSimulation.cpp.

Here is the call graph for this function:

void tgSimulation::addObstacle ( tgModel pObstacle)

Add an obstacle to the simulation. Obstacles are deleted upon reset.

Parameters
[in]pObstaclea pointer to a tgModel representing an obstacle; an exception is thrown if it is NULL
Exceptions
std::invalid_argumentif pModel is NULL

Definition at line 84 of file tgSimulation.cpp.

Here is the call graph for this function:

tgWorld & tgSimulation::getWorld ( ) const

Returns a reference to the world

Note
This is not inlined because it depends on the definition of tgSimView.

Definition at line 188 of file tgSimulation.cpp.

Here is the call graph for this function:

void tgSimulation::onVisit ( const tgModelVisitor r) const

Pass the tgModelVisitor to all of the models

Definition at line 121 of file tgSimulation.cpp.

Here is the caller graph for this function:

void tgSimulation::reset ( )

Calls teardown, then calls setup on the view, finally calls setup on the models Will delete and remake the dynamics world

Definition at line 136 of file tgSimulation.cpp.

Here is the call graph for this function:

void tgSimulation::reset ( tgGround newGround)

Calls teardown, then sets the ground of the world to newGround then calls setup on the view, finally calls setup on the models Will delete and remake the dynamics world, the previous ground will be deleted

Definition at line 159 of file tgSimulation.cpp.

void tgSimulation::run ( ) const

Run until stopped by user. Calls tgSimView.run()

Definition at line 267 of file tgSimulation.cpp.

Here is the call graph for this function:

void tgSimulation::run ( int  steps) const

Run for a specific number of steps. Calls tgSimView.run(int steps)

Parameters
[in]stepsthe number of steps to update the graphics
Todo:
Make steps of type size_t.

Definition at line 272 of file tgSimulation.cpp.

Here is the call graph for this function:

void tgSimulation::step ( double  dt) const

Advance the simulation.

Parameters
[in]dtthe number of seconds since the previous call; throw an exception if not positive
Exceptions
std::invalid_argumentif dt is not positive
Todo:
determine if this is necessary

Definition at line 193 of file tgSimulation.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


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