Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
robotran
mbsysc
Commits
73907726
Commit
73907726
authored
Mar 11, 2021
by
François Heremans
Browse files
SDL + WEBSOCKET working together
parent
84b70efa
Changes
7
Show whitespace changes
Inline
Side-by-side
ExampleProjects/CartPendulum/userfctR/realtime/user_realtime_options.c
View file @
73907726
...
...
@@ -84,7 +84,7 @@
*/
void
user_realtime_options
(
MbsData
*
mbs_data
,
Realtime_option
*
options
)
{
options
->
project_path
=
(
char
*
)
PROJECT_SOURCE_DIR
"/../"
;
}
#endif
MBsysC/cmake_aux/flags/CMakeLists.txt
View file @
73907726
...
...
@@ -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
)
...
...
MBsysC/mbs_common/mbs_realtime/realtime/auto_plot/set_plot.c
View file @
73907726
...
...
@@ -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
;
...
...
MBsysC/mbs_common/mbs_realtime/realtime/auto_plot/set_plot.h
View file @
73907726
...
...
@@ -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
();
...
...
MBsysC/mbs_common/mbs_realtime/realtime/realtime.c
View file @
73907726
...
...
@@ -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
);
...
...
MBsysC/mbs_common/mbs_realtime/websocket/visu_websocket.cc
View file @
73907726
...
...
@@ -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
;
...
...
MBsysC/mbs_common/mbs_realtime/websocket/visu_websocket.h
View file @
73907726
...
...
@@ -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
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment