49 if(gettimeofday(&tv, NULL)<0)
51 printf(
"\33[31mWARNING:\33[0m problem getting time\n");
54 t = (tv.tv_sec + (tv.tv_usec/1000000.0));
64 for (
int j=0;j<10;j++)
117 double ts = (1/desired_freq);
130 tsf = ts - (ros::Time::now().toSec()-
lar_tic[i]);
132 t=(tsf<0?100:tsf*1E6);
195 lar_tic[i] = ros::Time::now().toSec();
pthread_mutex_t clock_set_mutex
char run_ipc_sleep(double, int, char)
to use this method is required to run set_ipc_sleep method previously
void set_ipc_sleep(int)
method with run_ipc_sleep that allows that to set a refresh rate of a specified code.
pthread_mutex_t lar_toc_mutex
main header file for this module. Includes, global vars, funtion prototypes, etc. ...
void toc(int)
method when used with t1c enables you to know how many time have passed since
pthread_mutex_t clock_tic_mutex
c_timer()
runned when created class
void run_sleep(int, double)
method to use inside thread to avoid collisions between threads
double lar_get_time()
function to get time
pthread_mutex_t lar_tic_mutex
~c_timer()
method ruuned when class is destroyed
void tic(int)
method when used with toc enables you to know how many time have passed since