Commit fbaf47fd authored by Nicolas Docquier's avatar Nicolas Docquier
Browse files

Add a reset function to the realtime module and call it from mbs_dirdyn to...

Add a reset function to the realtime module and call it from mbs_dirdyn to enable several simulations in a row
parent b48628f5
......@@ -429,6 +429,9 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
}
else{
reset_flag_output();
#ifdef REAL_TIME
mbs_realtime_reset();
#endif
}
}
......
......@@ -13,6 +13,7 @@
#ifdef SDL
#include "plot_sdl.h"
#include "set_plot.h"
#endif
#ifdef VISU_3D
......@@ -35,6 +36,18 @@
#define REAL_TIME_SPEED_PERIOD_USEC 25e4 ///< real time speed factor computation time [s]
#define DEFAULT_MAX_MODELS 20 ///< default maximal numbers of models to load
/*! \brief reset the realtime structures and flag. Useful in case we
* want to run several simulations in a row in the same process.
*/
void mbs_realtime_reset()
{
#ifdef SDL
reset_flag_plot();
#endif
}
/*! \brief initialize the real-time structures
*
* \param[in,out] mbs_data Robotran main structure
......
......@@ -151,6 +151,7 @@ struct Simu_realtime
#ifdef __cplusplus
extern "C" {
#endif
void mbs_realtime_reset();
void mbs_realtime_init(MbsData* mbs_data, double t0, double tf, double dt0);
void mbs_realtime_loop(Simu_realtime *realtime, double tsim);
void mbs_realtime_update(Simu_realtime *realtime, double tsim);
......
......@@ -8,6 +8,15 @@
static AutoPlot *auto_plot; // static AutoPlot structure with all the current user plots information
int flag_plot = 0; ///< 1 if init_set_plot was called, 0 otherwise
/*! \brief reset the flag_plot to 0. Useful when running
* several simulation in a row with different save2file
* settings.
*/
void reset_flag_plot()
{
flag_plot = 0;
}
/*! \brief initialize the static auto_plot structure
*
* \param[in,out] screen_sdl SDL gestion main structure
......
......@@ -11,6 +11,7 @@
#include "plot_sdl.h"
#ifdef SDL
void reset_flag_plot();
void init_set_plot(Screen_sdl *screen_sdl);
void free_set_plot();
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment