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

SDL + WEBSOCKET working together

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