Project configuration

Once the CMake flag FLAG_REAL_TIME is set to ON, you can activate the real-time features by specifying it as an option in workR/main.c. To this end, add the following line after mbs_dirdyn creation (this creation is done by the mbs_new_dirdyn function):

mbs_dirdyn->options->realtime = 1;

To activate/deactivate the SDL features (plot…) and the 3D visualization, open the file userfctR/realtime/user_realtime_options.c and configure these two lines:

options->flag_plot = 1; //Or 0 to deactivate (default is 1)
options->flag_visu = 1; //Or 0 to deactivate (default is 1)

REMARK:

mbs_dirdyn->options->realtime might seem to be redundant with FLAG_REAL_TIME, options->flag_plot with FLAG_PLOT and options->flag_visu with FLAG_VISU.

The reason is the following. The CMake flags are used to compile code requiring extra libraries. Setting them to OFF, users without real-time libraries installed can still run Robotran projects.

On computers where these extra libraries are installed, we advise you to always set them to ON. Then, if you want to activate/deactivate some real-time features, you just need to play with the project file configuration options. Consequently, you do not have to reconfigure, and so to recompile the whole project.

The userfctR/realtime folder contains the following files:

  • user_realtime_options.c : configuration of the real-time options

  • user_realtime_events.c : configuration of the keyboard and joystick input devices

  • user_realtime_plot.c : plot in real-time of any signal related to the simulation

  • user_realtime_visu.c : modification of the default 3D visualization (for advanced users only)

In each of these four files, a manual is written to explain how to use them and it details all variables.

In particular, the features of user_realtime_plot.c can be used in any other file using the following lines:

#include "user_realtime.h"

set_plot(value, "label");

REMARK:

In windows, you may comment #define OPEN_GL_PROCESS_WIN in open_gl_c_int. if you want too see in the command window the printed message from the OpenGL process.
It may be useful while debugging your code !