ROS console macros not printing anything.

asked 2018-04-09 11:38:44 -0600

malharjajoo gravatar image

updated 2018-04-09 12:29:31 -0600

Hi,

I am trying to print something using the ROS_* macros for printing to console but it doesn't work for some reason. Below is a sample of the code -

   if(T_WS_vec.size() > 0) {
        std::cout << "April Tag(s) detected \n";
    }else{
        ROS_ERROR("%s","No april Tag detected ..");
   }

I am certain the else statement is being entered (since regular std::cout in the else statement works ). Regardless, the macros in other parts of the code are also not working.

I am just using catkin_make ( not using catkin_make -DCMAKE_BUILD_TYPE=Release) and I have included both the headers -

#include <ros/ros.h>
#include <ros/console.h>
edit retag flag offensive close merge delete

Comments

2

please review the support guidelines:

DO NOT post a screenshot of the terminal or source file

gvdhoorn gravatar image gvdhoorn  ( 2018-04-09 11:55:11 -0600 )edit

Apologies for that, was not aware of that in the guideline.

malharjajoo gravatar image malharjajoo  ( 2018-04-09 12:26:56 -0600 )edit

Is your node started by a launch file? If so, did you set output="screen"?

jarvisschultz gravatar image jarvisschultz  ( 2018-04-09 17:16:25 -0600 )edit

Hi, yes I am using output="screen" in the launch file.

malharjajoo gravatar image malharjajoo  ( 2018-04-09 19:24:07 -0600 )edit
3

It is possible for ROS console macros to not print anything if you don't have a NodeHandle in scope.

JamesGiller gravatar image JamesGiller  ( 2018-04-09 20:36:09 -0600 )edit