|
Robotran C Documentation
|
Go to the documentation of this file.
2 #ifndef VISU_WEBSOCKET_H
3 #define VISU_WEBSOCKET_H
7 #define START_VIEWPOINT 0
42 int *nb_q,
double **q_vec,
char **mbs_file,
char *mbsz_file,
43 int start_viewpoint,
int init_break);
int * nb_q
number of joints for each model
Definition: visu_websocket.cc:178
int nb_models
number of models to load
Definition: mbs_realtime_struct.h:24
useful functions used by the real-time modules
double real_simu_speed_factor
real speed factor
Definition: mbs_realtime_struct.h:143
JsonNode * json_mkobject(void)
Definition: json.c:531
#define MBS_INFO_FAILURE
Definition: mbs_define.h:32
#define MSG_ERR
Definition: visu_websocket.cc:45
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
VisuIn * visu_in
Definition: visu_websocket.cc:190
double tsim
The time value.
Definition: mbs_data.h:306
char ** mbs_file
mbs files to load
Definition: visu_websocket.cc:182
void update_websocket(Simu_realtime *realtime)
Definition: visu_websocket.cc:411
int start_viewpoint
initial viewpoint
Definition: visu_websocket.cc:176
int ws_socket(struct ws_server *ws_srv)
Main loop for the server.
Definition: ws.c:1940
void free_websocket(void *visu_class)
close the socket connection
Definition: visu_websocket.cc:529
void(* onmessage)(ws_cli_conn_t *client, const unsigned char *msg, uint64_t msg_size, int type)
On message event, called when a client sends a text or binary message.
Definition: ws.h:266
User curves to plot auto-update.
Definition: mbs_realtime_struct.h:58
#define MSG_PRE
Definition: visu_websocket.cc:46
bool bool_
Definition: json.h:53
char ** label_curves
tabular with the current curves labels
Definition: mbs_realtime_struct.h:63
void pause_routine(Simu_realtime *realtime)
Definition: visu_websocket.cc:380
static AutoPlot * auto_plot
Definition: set_plot.c:5
int mbs_splitext(const char *path, char **prefix, char **extension)
Split the path into a pair (root, ext).
Definition: mbs_path.c:460
void process_msg(Simu_realtime *realtime)
static double t_last_plot
update the realtime plot data
Definition: visu_websocket.cc:468
int init_websocket(Realtime_visu *visu, MbsData *mbs_data, int nb_models, int *nb_q, double **q_vec, char **mbs_file, char *mbsz_file, int start_viewpoint, int init_break)
Initialize the communication with the webserver.
Definition: visu_websocket.cc:192
static ws_cli_conn_t * client
Definition: visu_websocket.cc:49
double ** q_vec
initial joint positions
Definition: visu_websocket.cc:180
input of the 3D window
Definition: visu_websocket.cc:172
void onopen(ws_cli_conn_t *c)
This function is called whenever a new connection is opened.
Definition: visu_websocket.cc:61
double t_last_update
main update loop for the visualization
Definition: visu_websocket.cc:409
int nb
current number of curves to plot
Definition: mbs_realtime_struct.h:60
int thread_loop
Whether if the ws_socket() should create a new thread and be non-blocking (1) or not (0).
Definition: ws.h:287
Real-time constraints header for external modules.
JsonNode * json_mkarray(void)
Definition: json.c:526
JsonNode * json_mkstring(const char *s)
Definition: json.c:514
void update_realtime_constraints_break(Simu_realtime *realtime, int delta_break_u_sec)
update the real-time constraints after a break
Definition: realtime.c:793
#define KEYS_LEN
Definition: visu_websocket.h:5
void update_plot(Simu_realtime *realtime, double tsim)
Definition: visu_websocket.cc:470
void update_websocket(Simu_realtime *realtime)
Definition: visu_websocket.cc:411
AutoPlot * auto_plot
automatic user plot update structure
Definition: mbs_realtime_struct.h:78
Realtime_extern * ext
external variables
Definition: mbs_realtime_struct.h:177
char * mbsz_path
Definition: visu_websocket.cc:184
double * y_curves
tabular with the current values of the plots to curve
Definition: mbs_realtime_struct.h:65
void joints_update(Simu_realtime *realtime, int nb_models, int *nb_q, double **q_vec)
update the joint values for visualization
Definition: visu_websocket.cc:349
uint16_t port
Listening port.
Definition: ws.h:282
functions used to get the time expressed in us (micro seconds)
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:285
static bool is_updated
Definition: visu_websocket.cc:51
#define PORT
Definition: visu_websocket.h:6
int * nb_q
number of joints in the .mbs used for visualization (for each model)
Definition: mbs_realtime_struct.h:36
long project_data_size
Definition: visu_websocket.cc:55
void joints_update(Simu_realtime *realtime, int nb_models, int *nb_q, double **q_vec)
update the joint values for visualization
Definition: visu_websocket.cc:349
char * json_encode(const JsonNode *node)
Definition: json.c:379
static bool is_connected
Definition: visu_websocket.cc:50
void(* onclose)(ws_cli_conn_t *client)
On close event, called when a client disconnects.
Definition: ws.h:261
bool pause_sim
Definition: visu_websocket.cc:53
struct ws_events evs
Server events.
Definition: ws.h:295
JsonNode * json_find_member(JsonNode *object, const char *name)
Definition: json.c:465
void onmessage(ws_cli_conn_t *client, const unsigned char *msg, uint64_t size, int type)
Message events goes here.
Definition: visu_websocket.cc:91
Definition: mbs_data.h:247
Real-time constraints main header.
int init_websocket(Realtime_visu *visu, MbsData *mbs_data, int nb_models, int *nb_q, double **q_vec, char **mbs_file, char *mbsz_path, int start_viewpoint, int init_break)
Initialize the communication with the webserver.
Definition: visu_websocket.cc:192
real-time structure
Definition: mbs_realtime_struct.h:133
Visualization variables and stuctures.
Definition: mbs_realtime_struct.h:22
wsServer constants and functions.
MbsData * mbs_data
Robotran main structure.
Definition: mbs_realtime_struct.h:80
static char * project_data
Definition: visu_websocket.cc:54
uint32_t timeout_ms
Ping timeout in milliseconds.
Definition: ws.h:291
void json_append_member(JsonNode *object, const char *key, JsonNode *value)
Definition: json.c:584
double ** cur_q
current joints positions vector (for each model)
Definition: mbs_realtime_struct.h:47
void(* onopen)(ws_cli_conn_t *client)
On open event, called when a new client connects.
Definition: ws.h:257
int speed_last_t_usec
last real time [us], to compute the simulation speed
Definition: mbs_realtime_struct.h:160
static Simu_realtime * rt
Definition: visu_websocket.cc:52
void free_websocket(void *visu_class)
close the socket connection
Definition: visu_websocket.cc:529
int simu_speed_flag
used to compute the simulation factor
Definition: mbs_realtime_struct.h:139
Realtime_visu * visu
pointer to the "visu" structure
Definition: visu_websocket.cc:186
#define MBS_INFO_SUCCESS
Definition: mbs_define.h:30
static uint8_t key_states[KEYS_LEN]
Definition: visu_websocket.cc:48
#define FRAMERATE
Definition: visu_websocket.h:8
void json_append_element(JsonNode *array, JsonNode *element)
Definition: json.c:568
int ws_sendframe_bin(ws_cli_conn_t *cli, const char *msg, uint64_t size)
Sends a WebSocket binary frame.
Definition: ws.c:842
int ws_sendframe_txt(ws_cli_conn_t *cli, const char *msg)
Sends a WebSocket text frame.
Definition: ws.c:815
void onclose(ws_cli_conn_t *client)
This function is called whenever a connection is closed.
Definition: visu_websocket.cc:77
#define MBS_INFO_WARNING
Definition: mbs_define.h:31
double number_
Definition: json.h:59
char * ws_getaddress(ws_cli_conn_t *client)
Gets the IP address relative to a client connection opened by the server.
Definition: ws.c:475
server Web Socket server parameters
Definition: ws.h:273
int nb_models
number of models
Definition: visu_websocket.cc:174
const char * host
Required hostname that the wsServer will bind to.
Definition: ws.h:278
int mbs_stricmp(const char *__s1, const char *__s2)
Compare two char with _stricmp (convert strings to lower case, ignoring case sensitive).
Definition: useful_functions.c:584
JsonNode * json_mknumber(double n)
Definition: json.c:519
Realtime_visu * visu
Java structure.
Definition: mbs_realtime_struct.h:76
JsonNode * json_decode(const char *json)
Definition: json.c:361
void update_plot(Simu_realtime *realtime, double tsim)
Definition: visu_websocket.cc:470