Commit 780d2b91 authored by Sébastien Timmermans's avatar Sébastien Timmermans
Browse files

[Update] replace print by mbs_msg and mbs_error in dirdyn

parent 0cdcb78c
......@@ -224,8 +224,8 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
#else
if (dd->options->realtime)
{
mbs_msg("\nTo use the real-time features (mbs_dirdyn->options->realtime activated), set the CMake flag 'FLAG_REAL_TIME' to ON !\n");
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> To use the real-time features (mbs_dirdyn->options->realtime activated), set the CMake flag 'FLAG_REAL_TIME' to ON !\n");
mbs_error_msg("[%d] in mbs_dirdyn_init !! \n", -466);
}
#endif
......@@ -402,15 +402,16 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
#ifdef VISU_3D
if (!dd->options->realtime)
{
mbs_msg("Error: real-time features must be activated to set 'save_visu' to 1 ! \n");
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> Error: real-time features must be activated to set 'save_visu' to 1 ! \n");
mbs_error_msg("[%d] in mbs_dirdyn_init !! \n", -466);
}
realtime = (Simu_realtime*) mbs_data->realtime;
if (!realtime->options->flag_visu)
{
mbs_msg("Error: flag_visu must be set to 1 to set 'save_value' to 1 ! \n");
mbs_msg("\t >Real-time> Error: flag_visu must be set to 1 to set 'save_value' to 1 ! \n");
mbs_error_msg("[%d] in mbs_dirdyn_init !! \n", -466);
}
visu = realtime->ext->visu;
......@@ -425,8 +426,8 @@ void mbs_dirdyn_init(MbsDirdyn* dd, MbsData* mbs_data)
}
#else
mbs_msg("Error: Java libraries must be activated to set 'save_visu' to 1 ! \n");
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> Error: Java libraries must be activated to set 'save_visu' to 1 ! \n");
mbs_error_msg("[%d] in mbs_dirdyn_init !! \n", -466);
#endif
}
......
......@@ -17,7 +17,7 @@ OpenCvFrameCapture::OpenCvFrameCapture(MbsViewPointRenderer* vp_renderer, std::s
if ( !image.data )
{
printf("OpenCv Image not properly created \n");
mbs_msg("OpenCv Image not properly created \n");
return;
}
......
......@@ -6,6 +6,7 @@
//#include "cmake_config.h"
#include "useful_functions.h"
#include "user_realtime.h"
#include "mbs_message.h"
#include <stdlib.h>
#include <stdio.h>
......@@ -393,83 +394,83 @@ void check_user_realtime_options(Realtime_option *options)
// errors generated
if (options->t0 >= options->tf)
{
printf("\nReal-time options error: t0 (%f) >= tf (%f).\n", options->t0, options->tf);
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> options error: t0 (%f) >= tf (%f).\n", options->t0, options->tf);
mbs_error_msg("[%d] in check_user_realtime_options !! \n", -466);
}
if (options->dt0 <= 0.0)
{
printf("\nReal-time options error: dt0 (%f) is not strictly positive.\n", options->dt0);
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> options error: dt0 (%f) is not strictly positive.\n", options->dt0);
mbs_error_msg("[%d] in check_user_realtime_options !! \n", -466);
}
if (options->y_min_init >= options->y_max_init)
{
printf("\nReal-time options error: y_min_init (%f) >= y_max_init (%f).\n", options->y_min_init, options->y_max_init);
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> options error: y_min_init (%f) >= y_max_init (%f).\n", options->y_min_init, options->y_max_init);
mbs_error_msg("[%d] in check_user_realtime_options !! \n", -466);
}
for(i=0; i<options->nb_models; i++)
{
if (options->nb_q[i] < 0)
{
printf("\nReal-time options error: nb_q[%d] (%d) negative.\n", i, options->nb_q[i]);
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> options error: nb_q[%d] (%d) negative.\n", i, options->nb_q[i]);
mbs_error_msg("[%d] in check_user_realtime_options !! \n", -466);
}
}
// warnings generated
if (options->init_speed_factor <= 0.0)
{
printf("\nReal-time options warning: init_speed_factor (%f) <= 0.0; set to 1.0.\n", options->init_speed_factor);
mbs_warning_msg(">Real-time> options warning: init_speed_factor (%f) <= 0.0; set to 1.0.\n", options->init_speed_factor);
options->init_speed_factor = 1.0;
}
if (options->start_viewpoint < -1)
{
printf("\nReal-time options warning: start_viewpoint (%d) < -1; set to 0.\n", options->start_viewpoint);
mbs_warning_msg(">Real-time> options warning: start_viewpoint (%d) < -1; set to 0.\n", options->start_viewpoint);
options->start_viewpoint = 0;
}
if (options->curve_width < 1)
{
printf("\nReal-time options warning: curve_width (%d) < 1; set to 3.\n", options->curve_width);
mbs_warning_msg(">Real-time> options warning: curve_width (%d) < 1; set to 3.\n", options->curve_width);
options->curve_width = 3;
}
if (options->screen_width < 200)
{
printf("\nReal-time options warning: screen_width (%d) < 200; set to 660.\n", options->screen_width);
mbs_warning_msg(">Real-time> options warning: screen_width (%d) < 200; set to 660.\n", options->screen_width);
options->screen_width = 660;
}
if (options->screen_height < 200)
{
printf("\nReal-time options warning: screen_height (%d) < 200; set to 520.\n", options->screen_height);
mbs_warning_msg(">Real-time> options warning: screen_height (%d) < 200; set to 520.\n", options->screen_height);
options->screen_height = 520;
}
if (options->max_nb_curves < 0)
{
printf("\nReal-time options warning: max_nb_curves (%d) < 0; set to 12.\n", options->max_nb_curves);
mbs_warning_msg(">Real-time> options warning: max_nb_curves (%d) < 0; set to 12.\n", options->max_nb_curves);
options->max_nb_curves = 12;
}
if (options->max_nb_legends > options->max_nb_curves)
{
printf("\nReal-time options warning: max_nb_legends (%d) > max_nb_curves (%d); set to %d.\n", options->max_nb_legends, options->max_nb_curves, options->max_nb_curves);
mbs_warning_msg(">Real-time> options warning: max_nb_legends (%d) > max_nb_curves (%d); set to %d.\n", options->max_nb_legends, options->max_nb_curves, options->max_nb_curves);
options->max_nb_legends = options->max_nb_curves;
}
if (options->fqc_visu <= 0.0)
{
printf("\nReal-time options warning: fqc_visu (%f) <= 0.0; set to 30.0.\n", options->fqc_visu);
mbs_warning_msg(">Real-time> options warning: fqc_visu (%f) <= 0.0; set to 30.0.\n", options->fqc_visu);
options->fqc_visu = 30.0;
}
if (options->fqc_screen <= 0.0)
{
printf("\nReal-time options warning: fqc_screen (%f) <= 0.0; set to 30.0.\n", options->fqc_screen);
mbs_warning_msg(">Real-time> options warning: fqc_screen (%f) <= 0.0; set to 30.0.\n", options->fqc_screen);
options->fqc_screen = 30.0;
}
}
......@@ -562,8 +563,8 @@ Simu_realtime* init_simu_realtime(MbsData* mbs_data, Realtime_option *options, i
// check the number of constraints
if (nb_constraints < 0)
{
printf("Error: negative number of realtime constraints!\n");
exit(1);
mbs_msg("\t >Real-time> Error: negative number of realtime constraints! \n");
mbs_error_msg("[%d] in init_simu_realtime !! \n", -466);
}
// memory allocation
......@@ -581,8 +582,8 @@ Simu_realtime* init_simu_realtime(MbsData* mbs_data, Realtime_option *options, i
#else
if (options->flag_visu)
{
printf("\nTo use the Java visualization (realtime->options->flag_visu activated), set the CMake flag 'FLAG_VISU' to ON !\n");
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> To use the Java visualization (realtime->options->flag_visu activated), set the CMake flag 'FLAG_VISU' to ON !\n");
mbs_error_msg("[%d] in init_simu_realtime !! \n", -466);
}
#endif
......@@ -594,8 +595,8 @@ Simu_realtime* init_simu_realtime(MbsData* mbs_data, Realtime_option *options, i
#else
if (options->flag_plot)
{
printf("\nTo use the real-time features (realtime->options->flag_plot activated), set the CMake flag 'FLAG_PLOT' to ON !\n");
exit(EXIT_FAILURE);
mbs_msg("\t >Real-time> To use the real-time features (realtime->options->flag_plot activated), set the CMake flag 'FLAG_PLOT' to ON ! \n");
mbs_error_msg("[%d] in init_simu_realtime !! \n", -466);
}
#endif
......
......@@ -13,6 +13,7 @@
#include "events_sdl.h"
#include "set_plot.h"
#include "realtime_functions.h"
#include "mbs_message.h"
#ifdef JAVA
#include "java_functions.h"
......@@ -86,7 +87,7 @@ Screen_sdl* init_screen_sdl(Realtime_option *options)
if (screen_sdl->nb_joysticks >= 1)
{
#ifdef PRINT_REPORT
printf("Number of joysticks detected: %d\n\n", screen_sdl->nb_joysticks);
mbs_msg("Number of joysticks detected: %d\n\n", screen_sdl->nb_joysticks);
#endif
screen_sdl->joysticks = (SDL_Joystick**) malloc(screen_sdl->nb_joysticks*sizeof(SDL_Joystick*));
......@@ -531,8 +532,8 @@ void free_screen_sdl(Screen_sdl *screen_sdl)
*/
void log_SDL_error(char *SDL_function)
{
printf("%s error: %s\n",SDL_function, SDL_GetError());
exit(EXIT_FAILURE);
mbs_msg("\t >SDL> %s error: %s\n",SDL_function, SDL_GetError());
mbs_error_msg("[%d] in log_SDL_error !! \n", -466);
}
/*! \brief change the color in SDL
......
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