Robotics StackExchange | Archived questions

ROS console macros not printing anything.

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>

Asked by malharjajoo on 2018-04-09 11:38:44 UTC

Comments

please review the support guidelines:

DO NOT post a screenshot of the terminal or source file

Asked by gvdhoorn on 2018-04-09 11:55:11 UTC

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

Asked by malharjajoo on 2018-04-09 12:26:56 UTC

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

Asked by jarvisschultz on 2018-04-09 17:16:25 UTC

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

Asked by malharjajoo on 2018-04-09 19:24:07 UTC

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

Asked by JamesGiller on 2018-04-09 20:36:09 UTC

Answers