#include <simulation.h>
Inherits lpzrobots::Base.
Inherited by TaskedSimulation, and ThisSim.
Public Types | |
enum | SimulationState { none, initialised, running, closed } |
enum | CameraMode { Static = 0, Follow, TV, Race } |
Public Member Functions | |
Simulation () | |
virtual | ~Simulation () |
bool | run (int argc, char **argv) |
starts the Simulation. | |
virtual void | start (const OdeHandle &, const OsgHandle &, GlobalData &globalData)=0 |
start() is called at the first start of the cycles and should create all the object (obstacles, agents...). | |
virtual bool | restart (const OdeHandle &, const OsgHandle &, GlobalData &globalData) |
restart() is called at the second and all following starts of the cylce The end of a cycle is determined by (simulation_time_reached==true) | |
virtual void | end (GlobalData &globalData) |
end() is called at the end and should tidy up | |
virtual bool | config (GlobalData &globalData) |
config() is called when the user presses Ctrl-C | |
virtual bool | command (const OdeHandle &, const OsgHandle &, GlobalData &globalData, int key, bool down) |
is called if a key was pressed. | |
virtual void | bindingDescription (osg::ApplicationUsage &au) const |
this can be used to describe the key bindings used by command() | |
virtual void | usage () const |
this can be used to print additional usage information (cmd-line options) | |
virtual bool | collCallback (const OdeHandle &, void *data, dGeomID o1, dGeomID o2) |
collCallback() can be used to overload the standart collision handling. | |
virtual void | addCallback (GlobalData &globalData, bool draw, bool pause, bool control) |
optional additional callback function which is called every simulation step. | |
virtual void | addPaletteFile (const std::string &filename, bool verbose=false) |
adds a palette file to be loaded at initialization time Call this before run()! | |
virtual void | addColorAliasFile (const std::string &filename, bool verbose=false) |
adds a color alias file to be loaded at initialization time Call this before run()! | |
virtual void | odeStep () |
virtual void | osgStep () |
Protected Member Functions | |
virtual bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &) |
virtual void | getUsage (osg::ApplicationUsage &au) const |
virtual void | accept (osgGA::GUIEventHandlerVisitor &v) |
virtual bool | init (int argc, char **argv) |
virtual void | updateGraphics () |
update the graphics objects | |
void | setCameraHomePos (const osg::Vec3 &eye, const osg::Vec3 &view) |
define the home position and view orientation of the camera. | |
void | setCameraMode (CameraMode mode) |
Sets the mode of the camera, the numbers are the same like the keys. | |
void | setWatchedAgent (OdeAgent *agent) |
Sets the agent to be watched with the camera. | |
bool | control_c_pressed () |
__attribute__ ((deprecated)) void showParams(const ConfigList &configs) | |
shows all parameters of all given configurable objects | |
virtual bool | processCmdLine (int argc, char **argv) |
returns false if the program is to exit | |
void | resetSyncTimer () |
long | timeOfDayinMS () |
Static Protected Member Functions | |
static void | nearCallback_TopLevel (void *data, dGeomID o1, dGeomID o2) |
static void | nearCallback (void *data, dGeomID o1, dGeomID o2) |
Protected Attributes | |
std::list< PlotOption > & | plotoptions |
GlobalData | globalData |
osg::ref_ptr< VideoStream > | videostream |
int | nextLeakAnnounce |
int | leakAnnCounter |
long | realtimeoffset |
long | simtimeoffset |
double | truerealtimefactor |
bool | justresettimes |
paramint | windowWidth |
paramint | windowHeight |
paramint | defaultFPS |
bool | pause |
bool | simulation_time_reached |
long int | simulation_time |
bool | noGraphics |
bool | useKeyHandler |
int | guiloggerinterval |
int | filelogginginterval |
int | matrixvizinterval |
char | odeRobotsCfg [256] |
int | currentCycle |
< filename of config file | |
CameraHandle | cameraHandle |
parambool | useOdeThread |
parambool | useOsgThread |
parambool | useQMPThreads |
parambool | inTaskedMode |
std::string | windowName |
SimulationState | state |
osg::ArgumentParser * | arguments |
LPZViewer * | viewer |
osgGA::KeySwitchMatrixManipulator * | keyswitchManipulator |
char ** | orig_argv |
std::list< std::string > | paletteFiles |
std::list< std::string > | colorAliasFiles |
bool | verboseColorLoading |
bool | startConfigurator |
pthread_t | odeThread |
pthread_t | osgThread |
bool | odeThreadCreated |
bool | osgThreadCreated |
Static Protected Attributes | |
static int | ctrl_C = 0 |
enum CameraMode |
enum SimulationState |
Simulation | ( | ) |
~Simulation | ( | ) | [virtual] |
__attribute__ | ( | (deprecated) | ) | const [inline, protected] |
shows all parameters of all given configurable objects
void accept | ( | osgGA::GUIEventHandlerVisitor & | v | ) | [protected, virtual] |
virtual void addCallback | ( | GlobalData & | globalData, | |
bool | draw, | |||
bool | pause, | |||
bool | control | |||
) | [inline, virtual] |
optional additional callback function which is called every simulation step.
Called between physical simulation step and drawing.
draw | indicates that objects are drawn in this timestep | |
pause | always false (only called of simulation is running) | |
control | indicates that robots have been controlled this timestep |
Reimplemented in ThisSim.
void addColorAliasFile | ( | const std::string & | filename, | |
bool | verbose = false | |||
) | [virtual] |
adds a color alias file to be loaded at initialization time Call this before run()!
void addPaletteFile | ( | const std::string & | filename, | |
bool | verbose = false | |||
) | [virtual] |
adds a palette file to be loaded at initialization time Call this before run()!
virtual void bindingDescription | ( | osg::ApplicationUsage & | au | ) | const [inline, virtual] |
virtual bool collCallback | ( | const OdeHandle & | , | |
void * | data, | |||
dGeomID | o1, | |||
dGeomID | o2 | |||
) | [inline, virtual] |
collCallback() can be used to overload the standart collision handling.
However it is called after the robots collision handling.
virtual bool command | ( | const OdeHandle & | , | |
const OsgHandle & | , | |||
GlobalData & | globalData, | |||
int | key, | |||
bool | down | |||
) | [inline, virtual] |
is called if a key was pressed.
For keycodes see: osgGA::GUIEventAdapter
Reimplemented in ThisSim.
bool config | ( | GlobalData & | globalData | ) | [virtual] |
config() is called when the user presses Ctrl-C
bool control_c_pressed | ( | ) | [protected] |
void end | ( | GlobalData & | globalData | ) | [virtual] |
end() is called at the end and should tidy up
void getUsage | ( | osg::ApplicationUsage & | au | ) | const [protected, virtual] |
bool handle | ( | const osgGA::GUIEventAdapter & | ea, | |
osgGA::GUIActionAdapter & | ||||
) | [protected, virtual] |
bool init | ( | int | argc, | |
char ** | argv | |||
) | [protected, virtual] |
void nearCallback | ( | void * | data, | |
dGeomID | o1, | |||
dGeomID | o2 | |||
) | [static, protected] |
use the new method with substances
void nearCallback_TopLevel | ( | void * | data, | |
dGeomID | o1, | |||
dGeomID | o2 | |||
) | [static, protected] |
void odeStep | ( | ) | [virtual] |
void osgStep | ( | ) | [virtual] |
bool processCmdLine | ( | int | argc, | |
char ** | argv | |||
) | [protected, virtual] |
returns false if the program is to exit
void resetSyncTimer | ( | ) | [protected] |
bool restart | ( | const OdeHandle & | , | |
const OsgHandle & | , | |||
GlobalData & | globalData | |||
) | [virtual] |
restart() is called at the second and all following starts of the cylce The end of a cycle is determined by (simulation_time_reached==true)
restart() is called at the second and all following starts of the cylces
the | odeHandle | |
the | osgHandle | |
globalData |
bool run | ( | int | argc, | |
char ** | argv | |||
) |
starts the Simulation.
Do not overload it. This function returns of the simulation is terminated.
define the home position and view orientation of the camera.
view.x is the heading angle in degree. view.y is the tilt angle in degree (nick), view.z is ignored
void setCameraMode | ( | CameraMode | mode | ) | [protected] |
Sets the mode of the camera, the numbers are the same like the keys.
mode | see CameraMode |
void setWatchedAgent | ( | OdeAgent * | agent | ) | [protected] |
Sets the agent to be watched with the camera.
agent | to set |
virtual void start | ( | const OdeHandle & | , | |
const OsgHandle & | , | |||
GlobalData & | globalData | |||
) | [pure virtual] |
long timeOfDayinMS | ( | ) | [protected] |
void updateGraphics | ( | ) | [protected, virtual] |
update the graphics objects
virtual void usage | ( | ) | const [inline, virtual] |
this can be used to print additional usage information (cmd-line options)
osg::ArgumentParser* arguments [protected] |
CameraHandle cameraHandle [protected] |
std::list<std::string> colorAliasFiles [protected] |
int ctrl_C = 0 [static, protected] |
int currentCycle [protected] |
< filename of config file
the current cycle; the simulation restarts if restart() returns true
paramint defaultFPS [protected] |
int filelogginginterval [protected] |
GlobalData globalData [protected] |
int guiloggerinterval [protected] |
parambool inTaskedMode [protected] |
bool justresettimes [protected] |
osgGA::KeySwitchMatrixManipulator* keyswitchManipulator [protected] |
int leakAnnCounter [protected] |
int matrixvizinterval [protected] |
int nextLeakAnnounce [protected] |
bool noGraphics [protected] |
char odeRobotsCfg[256] [protected] |
pthread_t odeThread [protected] |
bool odeThreadCreated [protected] |
char** orig_argv [protected] |
pthread_t osgThread [protected] |
bool osgThreadCreated [protected] |
std::list<std::string> paletteFiles [protected] |
bool pause [protected] |
std::list<PlotOption>& plotoptions [protected] |
long realtimeoffset [protected] |
long simtimeoffset [protected] |
long int simulation_time [protected] |
bool simulation_time_reached [protected] |
bool startConfigurator [protected] |
SimulationState state [protected] |
double truerealtimefactor [protected] |
bool useKeyHandler [protected] |
parambool useOdeThread [protected] |
parambool useOsgThread [protected] |
parambool useQMPThreads [protected] |
bool verboseColorLoading [protected] |
osg::ref_ptr<VideoStream> videostream [protected] |
paramint windowHeight [protected] |
std::string windowName [protected] |
paramint windowWidth [protected] |