24 #ifndef __SIMULATION_H
25 #define __SIMULATION_H
30 #include <osgViewer/Viewer>
31 #include <osgViewer/ViewerEventHandlers>
32 #include <osgGA/KeySwitchMatrixManipulator>
37 #define PI M_PI // (3.14159265358979323846)
72 bool run(
int argc,
char** argv);
102 int key,
bool down) {
return false; };
129 virtual void addPaletteFile(
const std::string& filename,
bool verbose =
false);
133 virtual void addColorAliasFile(
const std::string& filename,
bool verbose =
false);
143 virtual bool handle(
const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter&);
144 virtual void getUsage (osg::ApplicationUsage & au)
const;
145 virtual void accept(osgGA::GUIEventHandlerVisitor& v);
146 virtual bool init(
int argc,
char** argv);
177 static void nearCallback(
void *data, dGeomID o1, dGeomID o2);
193 void insertCmdLineOption(
int& argc,
char**& argv);
206 static void control_c(
int i);
207 static void cmd_handler_exit();
208 static void cmd_handler_init();
209 static void cmd_begin_input();
210 static void cmd_end_input();
213 static void main_usage(
const char* progname);
215 bool storeOdeRobotsCFG();
290 bool commandline_param_dummy;
Configurable::configurableList ConfigList
Definition: globaldata.h:47
bool parambool
Definition: configurable.h:93
virtual void doOnCallBack(BackCaller *src, BackCaller::CallbackableType type=BackCaller::DEFAULT_CALLBACKABLE_TYPE) override
This method is invoked when a callback is done from the class where this class is for callback regist...
Definition: simulation.cpp:1050
parambool useOsgThread
Definition: simulation.h:260
Interface class for a class which wants to be callback on a certain action.
Definition: callbackable.h:39
osg::ref_ptr< VideoStream > videostream
Definition: simulation.h:220
virtual bool command(const OdeHandle &, const OsgHandle &, GlobalData &globalData, int key, bool down)
is called if a key was pressed.
Definition: simulation.h:101
Data structure for accessing the ODE.
Definition: odehandle.h:44
virtual void accept(osgGA::GUIEventHandlerVisitor &v)
Definition: simulation.cpp:989
virtual bool collCallback(const OdeHandle &, void *data, dGeomID o1, dGeomID o2)
collCallback() can be used to overload the standart collision handling.
Definition: simulation.h:116
paramint windowHeight
Definition: simulation.h:229
static void nearCallback(void *data, dGeomID o1, dGeomID o2)
Definition: simulation.cpp:1352
static int ctrl_C
Definition: simulation.h:272
virtual bool init(int argc, char **argv)
Definition: simulation.cpp:209
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)
Definition: simulation.cpp:789
CameraMode
Definition: simulation.h:63
Definition: simulation.h:63
virtual bool processCmdLine(int argc, char **argv)
returns false if the program is to exit
Definition: simulation.cpp:1156
int guiloggerinterval
Definition: simulation.h:242
Definition: simulation.h:63
SimulationState
Definition: simulation.h:62
char odeRobotsCfg[256]
Definition: simulation.h:249
std::list< std::string > paletteFiles
Definition: simulation.h:275
char ** orig_argv
Definition: simulation.h:273
void setCameraMode(CameraMode mode)
Sets the mode of the camera, the numbers are the same like the keys.
Definition: simulation.cpp:1548
bool osgThreadCreated
Definition: simulation.h:287
bool drawContacts
Definition: simulation.h:226
virtual void osgStep()
Definition: simulation.cpp:1612
Viewer holds a single view on to a single scene that supports the rendering of offscreen RRT (render ...
Definition: lpzviewer.h:37
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
SimulationState state
Definition: simulation.h:267
std::string windowName
Definition: simulation.h:264
OdeAgent * getWatchedAgent() const
returns the watched agent (or 0)
Definition: simulation.cpp:1567
virtual void usage() const
this can be used to print additional usage information (cmd-line options)
Definition: simulation.h:110
static void nearCallback_TopLevel(void *data, dGeomID o1, dGeomID o2)
Definition: simulation.cpp:1333
bool run(int argc, char **argv)
starts the Simulation.
Definition: simulation.cpp:419
paramint defaultFPS
Definition: simulation.h:231
std::list< std::string > colorAliasFiles
Definition: simulation.h:276
Class which holds all data used by CameraManipulators.
Definition: camerahandle.h:54
parambool useQMPThreads
Definition: simulation.h:261
static const CallbackableType DEFAULT_CALLBACKABLE_TYPE
This is the default Callbackable type.
Definition: backcaller.h:51
unsigned long CallbackableType
Definition: backcaller.h:45
Definition: simulation.h:62
virtual void end(GlobalData &globalData)
end() is called at the end and should tidy up
Definition: simulation.cpp:534
void showParams(const ConfigList &configs, FILE *f, const char *lineprefix)
Shows the values of all parameters of the given configurable objects.
Definition: cmdline.cpp:9
Vec3f Vec3
Definition: osgforwarddecl.h:42
bool control_c_pressed()
Definition: simulation.cpp:1439
void createNewDir(const char *base, char *newdir)
creates a new directory with the stem base, which is not yet there (using subsequent numbers) and ret...
Definition: simulation.cpp:1578
LPZViewer * viewer
Definition: simulation.h:269
This class contains options for the use of an external plot utility like guilogger or neuronviz or ju...
Definition: plotoption.h:66
paramint windowWidth
Definition: simulation.h:228
double truerealtimefactor
Definition: simulation.h:224
std::list< PlotOption > & plotoptions
Definition: simulation.h:183
CameraHandle cameraHandle
Definition: simulation.h:257
bool startVideoRecording(const char *name)
start video recording (write frames to name(XXX) folder)
Definition: simulation.cpp:993
Data structure holding all essential global information.
Definition: globaldata.h:57
Specialised agent for ode robots.
Definition: odeagent.h:62
bool useKeyHandler
Definition: simulation.h:237
std::string initConfParams
parameters for configurables set on commandline
Definition: simulation.h:247
parambool useOdeThread
Definition: simulation.h:259
bool verboseColorLoading
Definition: simulation.h:277
void resetSyncTimer()
Definition: simulation.cpp:1457
long realtimeoffset
Definition: simulation.h:222
Simulation()
Definition: simulation.cpp:105
osgGA::KeySwitchMatrixManipulator * keyswitchManipulator
Definition: simulation.h:270
void setCameraHomePos(const osg::Vec3 &eye, const osg::Vec3 &view)
define the home position and view orientation of the camera.
Definition: simulation.cpp:1537
void setWatchedAgent(OdeAgent *agent)
Sets the agent to be watched with the camera.
Definition: simulation.cpp:1556
Definition: simulation.h:62
bool simulation_time_reached
Definition: simulation.h:234
bool odeThreadCreated
Definition: simulation.h:286
long simtimeoffset
Definition: simulation.h:223
bool stopVideoRecording()
stop video recording
Definition: simulation.cpp:1029
int paramint
Definition: configurable.h:98
Definition: simulation.h:58
virtual void odeStep()
Definition: simulation.cpp:1593
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...
Definition: simulation.h:62
int currentCycle
< filename of config file
Definition: simulation.h:255
virtual bool config(GlobalData &globalData)
config() is called when the user presses Ctrl-C
Definition: simulation.cpp:530
Definition: simulation.h:63
std::list< std::pair< std::string, double > > parseKeyValuePairs(std::string kv)
Definition: simulation.cpp:1134
Definition: simulation.h:63
virtual void updateGraphics()
update the graphics objects
Definition: simulation.cpp:776
virtual ~Simulation()
Definition: simulation.cpp:166
virtual void addCallback(GlobalData &globalData, bool draw, bool pause, bool control)
optional additional callback function which is called every simulation step.
Definition: simulation.h:124
osg::ArgumentParser * arguments
Definition: simulation.h:268
GlobalData globalData
Definition: simulation.h:219
parambool inTaskedMode
Definition: simulation.h:262
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 determi...
Definition: simulation.cpp:1643
bool startConfigurator
Definition: simulation.h:281
bool pause
Definition: simulation.h:233
virtual void bindingDescription(osg::ApplicationUsage &au) const
this can be used to describe the key bindings used by command()
Definition: simulation.h:106
Class prototype which provides functions to handle callbackable classes.
Definition: backcaller.h:42
pthread_t odeThread
Definition: simulation.h:284
Definition: simulation.h:62
int filelogginginterval
Definition: simulation.h:243
int matrixvizinterval
Definition: simulation.h:244
pthread_t osgThread
Definition: simulation.h:285
virtual void getUsage(osg::ApplicationUsage &au) const
Definition: simulation.cpp:971
long int simulation_time
Definition: simulation.h:235
bool noGraphics
Definition: simulation.h:236
bool justresettimes
Definition: simulation.h:225
virtual void addPaletteFile(const std::string &filename, bool verbose=false)
adds a palette file to be loaded at initialization time Call this before run()!
Definition: simulation.cpp:199
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()! ...
Definition: simulation.cpp:203
long timeOfDayinMS()
Definition: simulation.cpp:1451
__attribute__((deprecated)) void showParams(const ConfigList &configs)
shows all parameters of all given configurable objects
Definition: simulation.h:190