Commit 73907726 authored by François Heremans's avatar François Heremans
Browse files

SDL + WEBSOCKET working together

parent 84b70efa
......@@ -84,7 +84,7 @@
*/
void user_realtime_options(MbsData* mbs_data, Realtime_option *options)
{
options->project_path = (char*) PROJECT_SOURCE_DIR"/../";
}
#endif
......@@ -124,10 +124,6 @@ function(flags_check)
set( FLAG_OPEN_GL OFF )
endif( )
# SDL only if no websocket
if (FLAG_WEBSOCKET)
set( FLAG_PLOT OFF )
endif( )
# separate build
if (NOT FLAG_SEPARATE_BUILD)
......
......@@ -34,8 +34,9 @@ void init_set_plot(Screen_sdl *screen_sdl)
screen_sdl->auto_plot = auto_plot;
}
#else
void init_set_plot(Realtime_extern *realtime_ext, int max_nb_curves)
#endif
#ifdef WEBSOCKET
void init_set_plot_web(Realtime_extern *realtime_ext, int max_nb_curves)
{
flag_plot = 1;
......
......@@ -14,8 +14,10 @@
#ifdef SDL
void init_set_plot(Screen_sdl *screen_sdl);
#else
void init_set_plot(Realtime_extern *realtime_ext, int max_nb_curves);
#endif
#ifdef WEBSOCKET
void init_set_plot_web(Realtime_extern *realtime_ext, int max_nb_curves);
#endif
void reset_flag_plot();
......
......@@ -136,7 +136,7 @@ void mbs_realtime_update(Simu_realtime *realtime, double tsim)
#ifdef WEBSOCKET
if (realtime->flag_plot)
{
update_plot_vectors(realtime, tsim);
update_plot(realtime, tsim);
}
#endif
}
......@@ -671,11 +671,6 @@ Simu_realtime* init_simu_realtime(MbsData* mbs_data, Realtime_option *options, i
return NULL;
}
}
#elif WEBSOCKET
{
init_set_plot(realtime->ext, 10);
// printf("\n Plot activated to websocket !\n");
}
#else
if (options->flag_plot)
{
......@@ -686,6 +681,11 @@ Simu_realtime* init_simu_realtime(MbsData* mbs_data, Realtime_option *options, i
}
#endif
#ifdef WEBSOCKET
init_set_plot_web(realtime->ext, 10);
// printf("\n Plot activated to websocket !\n");
#endif
// absolute time before starting loop
time_get(&init_t_sec, &init_t_usec);
......
......@@ -315,7 +315,7 @@ void update_websocket(Simu_realtime *realtime){
double t_last_plot = 0;
void update_plot_vectors(Simu_realtime *realtime, double tsim){
void update_plot(Simu_realtime *realtime, double tsim){
JsonNode *node, *parent, *q_array, *l_array, *dnode;
char *msg;
......
......@@ -21,7 +21,7 @@ void joints_update(Simu_realtime *realtime, int nb_models, int *nb_q, double **q
void process_msg(Simu_realtime *realtime);
void update_websocket(Simu_realtime *realtime);
void free_websocket(void *visu_class);
void update_plot_vectors(Simu_realtime *realtime, double tsim);
void update_plot(Simu_realtime *realtime, double tsim);
#ifdef __cplusplus
}
......
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