- Main Page
- Modules
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# Simulator Class Reference

`#include <Simulator.h>`

List of all members.

## Public Types
| VP_STATIC
| VP_CAR_FOLLOW
enum | ViewpointType { VP_STATIC, VP_CAR_FOLLOW }
## Public Member Functions
virtual | ~Simulator ()
void | init (const std::string simfile, const std::string carsfile, const std::string worldfile, bool visualize=true)
void | run ()
void | start ()
void | loop (int pause)
void | command (int cmd)
void | nearCallback (void *data, dGeomID o1, dGeomID o2)
void | addSimulationObject (SimulationObject *object)
void | removeSimulationObject (SimulationObject *object)
void | scheduleForAddition (SimulationObject *o)
void | scheduleForRemoval (SimulationObject *o)
void | addSector (Sector *sector)
void | addViewPoint (float *xyz, float *hpr)
std::string | getInfo ()
void | printHelp ()
## Static Public Member Functions
static Simulator * | getInstance ()
## Private Member Functions
| Simulator ()
| Simulator (const Simulator &)
Simulator & | operator= (const Simulator &)
void | addScheduledObjects ()
void | removeScheduledObjects ()
void | loopHeadLess ()
void | cycleViewpointObject (bool forward=true)
void | cycleStaticViewPoints (bool forward=true)
## Private Attributes
SOContainer | _sobjects
AOContainer | _aobjects
VOContainer | _vobjects
SectorMap | _sectors
SOVector | _scheduledForAddition
SOVector | _scheduledForRemoval
dWorldID | _world
dSpaceID | _space
dGeomID | _plane
dJointGroupID | _contactgroup
dsFunctions | _fn
dReal | _gravity
dReal | _ERP
dReal | _CFM
double | _simstep
int | _numOfCars
ViewpointType | _viewpointType
int | _lastCarViewpoint
int | _lastStaticViewpoint
ViewPointVector | _viewpoints
bool | _visualize
## Static Private Attributes
static Simulator * | _instance = NULL
## Friends
class | ConfigurationParser
class | Sector

## Member Enumeration Documentation

enum Simulator::ViewpointType

Types of viewpoint VP_STATIC - camera is static, user-manipulated VP_CAR_FOLLOW - camera follows user-chosen car

Enumerator:

  VP_STATIC |
  VP_CAR_FOLLOW |

## Constructor & Destructor Documentation

Simulator::~Simulator | ( |  | ) | `[virtual]`

Simulator::Simulator | ( |  | ) | `[private]`

Simulator::Simulator | ( | const Simulator & |  | ) | `[private]`

## Member Function Documentation

void Simulator::addScheduledObjects | ( |  | ) | `[private]`

Adds all objects scheduled for registration to simulation in one batch

void Simulator::addSector | ( | Sector * | sector | ) |

Registers new sector to the simulation

void Simulator::addSimulationObject | ( | SimulationObject * | object | ) |

Registers new simulation object to the simulation

Parameters:

  | object | the new object

void Simulator::addViewPoint | ( | float * | xyz,
|  | float * | hpr |
| ) |  |  |

Registers new viewpoint to the simulation

void Simulator::command | ( | int | cmd | ) |

Callback function for handling user commands (keystrokes coming from the main window)

void Simulator::cycleStaticViewPoints | ( | bool | forward = `true` | ) | `[private]`

Sets the viewpoint to static position

void Simulator::cycleViewpointObject | ( | bool | forward = `true` | ) | `[private]`

Cycles the viewpoint between simulation objects

string Simulator::getInfo | ( |  | ) |

Prints info about current state of cars

Simulator * Simulator::getInstance | ( |  | ) | `[static]`

Singleton function returning the instance

void Simulator::init | ( | const std::string | simfile,
|  | const std::string | carsfile,
|  | const std::string | worldfile,
|  | bool | visualize = `true` |
| ) |  |  |

Initializes the simulator to start state (parses conf files, creates cars, simulation object, etc.)

void Simulator::loop | ( | int | pause | ) |

Callback function which performs one step of the simulation

void Simulator::loopHeadLess | ( |  | ) | `[private]`

Loops the simulation in headless mode (no visualization)

void Simulator::nearCallback | ( | void * | data,
|  | dGeomID | o1,
|  | dGeomID | o2 |
| ) |  |  |

Callback function for managing collisions

Simulator& Simulator::operator= | ( | const Simulator & |  | ) | `[private]`

void Simulator::printHelp | ( |  | ) |

Prints help instructions

void Simulator::removeScheduledObjects | ( |  | ) | `[private]`

Removes all objects scheduled for removal from simulation in one batch

void Simulator::removeSimulationObject | ( | SimulationObject * | object | ) |

Deregisters new simulation object from the simulation

Parameters:

  | object | the object to remove

void Simulator::run | ( |  | ) |

Runs the simulation

void Simulator::scheduleForAddition | ( | SimulationObject * | o | ) |

Allows objects in simulation to create other and register them to the simulation (see CarSource)

void Simulator::scheduleForRemoval | ( | SimulationObject * | o | ) |

Allows objects in simulation to register other for removal from simulation (see CarSink)

void Simulator::start | ( |  | ) |

Callback function for starting the simulation (used by drawstuff)

## Friends And Related Function Documentation

friend class ConfigurationParser`[friend]`

friend class Sector`[friend]`

## Member Data Documentation

AOContainer Simulator::_aobjects`[private]`

Auxiliary container for all animated objects

dReal Simulator::_CFM`[private]`

World's setting for the CFM (Constraint Mixing Force) ODE parameter

dJointGroupID Simulator::_contactgroup`[private]`

ODE group for collision contacts

dReal Simulator::_ERP`[private]`

World's setting for the ERP ODE parameter

dsFunctions Simulator::_fn`[private]`

Drawstuff functions structure

dReal Simulator::_gravity`[private]`

World's gravity

Simulator * Simulator::_instance = NULL`[static, private]`

The only instance of Simulator

int Simulator::_lastCarViewpoint`[private]`

Object to follow with viewpoint if VP_CAR_FOLLOW

int Simulator::_lastStaticViewpoint`[private]`

Viewpoint to use if VP_STATIC

int Simulator::_numOfCars`[private]`

number of cars in simulation

dGeomID Simulator::_plane`[private]`

ODE main plane (terrain)

SOVector Simulator::_scheduledForAddition`[private]`

Vector of simulation objects scheduled for addition to simulation

SOVector Simulator::_scheduledForRemoval`[private]`

Vector of simulation objects scheduled for removal from simulation

SectorMap Simulator::_sectors`[private]`

Container for SectorVector

double Simulator::_simstep`[private]`

length of simulation step in ms

SOContainer Simulator::_sobjects`[private]`

Main container for SimulationObjects

dSpaceID Simulator::_space`[private]`

ODE collision space

ViewPointVector Simulator::_viewpoints`[private]`

Container for static viewpoints as defined in world file

ViewpointType Simulator::_viewpointType`[private]`

Type of viewpoint currently used

bool Simulator::_visualize`[private]`

Flag for visualization

VOContainer Simulator::_vobjects`[private]`

Auxiliary container for all visualized objects

dWorldID Simulator::_world`[private]`

ODE world reference

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

- src/Simulator.h
- src/Simulator.cpp