O'Reilly logo

Robot Operating System Cookbook by Kumar Bipin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Setting the logging level at compile time requires code modification, which is not recommended for most cases; however, it removes the overhead of all the logging functions below a given level. Also, ROS provides ROSCONSOLE_MIN_SEVERITY as a macro variable, which must be set to the minimum desired severity level. These macros are as follows:

  • ROSCONSOLE_SEVERITY_DEBUG
  • ROSCONSOLE_SEVERITY_INFO
  • ROSCONSOLE_SEVERITY_WARN
  • ROSCONSOLE_SEVERITY_ERROR
  • ROSCONSOLE_SEVERITY_FATAL
  • ROSCONSOLE_SEVERITY_NONE

For example, if the desired logging level is an ERROR or higher message, we should define this in the source code as follows:

#define ROSCONSOLE_MIN_SEVERITY ROSCONSOLE_SEVERITY_ERROR

On the other hand, ROSCONSOLE_MIN_SEVERITY could be ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required