ethzasl-msf - Modular Sensor Fusion
Time delay compensated single and multi sensor fusion framework based on an EKF
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros
msf_macros.h File Reference
#include <chrono>

Go to the source code of this file.

Macros

#define NUMERIC_PREC   4
#define UNUSEDPARAM(x)   x
#define UNUSED(x)   (void)x;
#define STREAMQUAT(q)
#define DEG2RAD   (M_PI/180.0)
#define MSF_LIKELY(x)   __builtin_expect((x),1)
#define MSF_UNLIKELY(x)   __builtin_expect((x),0)
#define MSF_INFO_STREAM(x)   std::cerr<<"\033[0;0m[INFO] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_WARN_STREAM(x)   std::cerr<<"\033[0;33m[WARN] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_ERROR_STREAM(x)   std::cerr<<"\033[1;31m[ERROR] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_INFO_STREAM_ONCE(x)
#define MSF_WARN_STREAM_ONCE(x)
#define MSF_ERROR_STREAM_ONCE(x)
#define MSF_LOG_STREAM_THROTTLE(rate, x)
#define MSF_WARN_STREAM_THROTTLE(rate, x)
#define MSF_ERROR_STREAM_THROTTLE(rate, x)
#define MSF_INFO_STREAM_COND(cond, x)
#define MSF_WARN_STREAM_COND(cond, x)
#define MSF_ERROR_STREAM_COND(cond, x)

Macro Definition Documentation

#define DEG2RAD   (M_PI/180.0)
#define MSF_ERROR_STREAM (   x)    std::cerr<<"\033[1;31m[ERROR] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_ERROR_STREAM_COND (   cond,
 
)
Value:
do \
{ \
if (MSF_UNLIKELY(cond)) \
{ \
MSF_ERROR_STREAM(x); \
} \
} while(0)
#define MSF_ERROR_STREAM_ONCE (   x)
Value:
do \
{ \
static bool __log_stream_once__hit__ = false; \
if (MSF_UNLIKELY(!__log_stream_once__hit__)) \
{ \
__log_stream_once__hit__ = true; \
MSF_ERROR_STREAM(x); \
} \
} while(0)
#define MSF_ERROR_STREAM_THROTTLE (   rate,
 
)
Value:
do \
{ \
static double __log_stream_throttle__last_hit__ = 0.0; \
std::chrono::time_point<std::chrono::system_clock> __log_stream_throttle__now__ = \
std::chrono::system_clock::now(); \
if (MSF_UNLIKELY(__log_stream_throttle__last_hit__ + rate <= \
std::chrono::duration_cast<std::chrono::seconds>(\
__log_stream_throttle__now__.time_since_epoch()).count())) \
{ \
__log_stream_throttle__last_hit__ = \
std::chrono::duration_cast<std::chrono::seconds>\
(__log_stream_throttle__now__.time_since_epoch()).count(); \
MSF_ERROR_STREAM(x); \
} \
} while(0)
#define MSF_INFO_STREAM (   x)    std::cerr<<"\033[0;0m[INFO] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_INFO_STREAM_COND (   cond,
 
)
Value:
do \
{ \
if (MSF_UNLIKELY(cond)) \
{ \
MSF_INFO_STREAM(x); \
} \
} while(0)
#define MSF_INFO_STREAM_ONCE (   x)
Value:
do \
{ \
static bool __log_stream_once__hit__ = false; \
if (MSF_UNLIKELY(!__log_stream_once__hit__)) \
{ \
__log_stream_once__hit__ = true; \
MSF_INFO_STREAM(x); \
} \
} while(0)
#define MSF_LIKELY (   x)    __builtin_expect((x),1)
#define MSF_LOG_STREAM_THROTTLE (   rate,
 
)
Value:
do \
{ \
static double __log_stream_throttle__last_hit__ = 0.0; \
std::chrono::time_point<std::chrono::system_clock> __log_stream_throttle__now__ = \
std::chrono::system_clock::now(); \
if (MSF_UNLIKELY(__log_stream_throttle__last_hit__ + rate <= \
std::chrono::duration_cast<std::chrono::seconds>( \
__log_stream_throttle__now__.time_since_epoch()).count())) \
{ \
__log_stream_throttle__last_hit__ = std::chrono::duration_cast< \
std::chrono::seconds>(__log_stream_throttle__now__.time_since_epoch()).count(); \
MSF_INFO_STREAM(x); \
} \
} while(0)
#define MSF_UNLIKELY (   x)    __builtin_expect((x),0)
#define MSF_WARN_STREAM (   x)    std::cerr<<"\033[0;33m[WARN] "<<x<<"\033[0;0m"<<std::endl;
#define MSF_WARN_STREAM_COND (   cond,
 
)
Value:
do \
{ \
if (MSF_UNLIKELY(cond)) \
{ \
MSF_WARN_STREAM(x); \
} \
} while(0)
#define MSF_WARN_STREAM_ONCE (   x)
Value:
do \
{ \
static bool __log_stream_once__hit__ = false; \
if (MSF_UNLIKELY(!__log_stream_once__hit__)) \
{ \
__log_stream_once__hit__ = true; \
MSF_WARN_STREAM(x); \
} \
} while(0)
#define MSF_WARN_STREAM_THROTTLE (   rate,
 
)
Value:
do \
{ \
static double __log_stream_throttle__last_hit__ = 0.0; \
std::chrono::time_point<std::chrono::system_clock> __log_stream_throttle__now__ = \
std::chrono::system_clock::now(); \
if (MSF_UNLIKELY(__log_stream_throttle__last_hit__ + rate <= \
std::chrono::duration_cast<std::chrono::seconds>( \
__log_stream_throttle__now__.time_since_epoch()).count())) \
{ \
__log_stream_throttle__last_hit__ = \
std::chrono::duration_cast<std::chrono::seconds>( \
__log_stream_throttle__now__.time_since_epoch()).count(); \
MSF_WARN_STREAM(x); \
} \
} while(0)
#define NUMERIC_PREC   4
#define STREAMQUAT (   q)
Value:
"["<<std::setprecision(3)<<(q).w()<<", "<<(q).x()<<", "<< \
(q).y()<<", "<<(q).z()<<std::setprecision(NUMERIC_PREC)<<"]"
#define UNUSED (   x)    (void)x;
#define UNUSEDPARAM (   x)    x