Ask Your Question

ros does not show any debug messages

asked 2018-05-15 20:55:21 -0500

frodyteen gravatar image

updated 2018-05-15 21:06:39 -0500

So, I am trying to debug a package, and was thinking of using ROS_DEBUG() AND ROS_DEBUG_STREAM() to print out all my variables on either rqt_console or the /rosout topic following this site.

So I added the following lines in the cpp file:

  ROS_DEBUG("HELLO %s", "world");
  ROS_DEBUG_STREAM("hello " << "world");
  SERIAL_EXCEPT(SerialException, "buffer filled without end of line being found");

Also, I tried to put the debugging messages at the beginning of the main loop, shown below:

int main(int argc, char **argv)
  ros::init(argc, argv, "dsp3000");
  ROS_DEBUG("Hello %s", "world");
  ROS_DEBUG_STREAM("Hello " << "world");

  string port_name;
  ros::param::param<std::string>("~port", port_name, "/dev/ttyUSB0");
  int32_t mode;
  ros::param::param<int32_t>("~mode", mode, KVH_DSP3000_RATE);

Here is a picture of rqt_console: image description After catkin_make and running the node, i don't see ros.<your_package_name> anywhere, also rqt_console shows zero message in the debug option, however, ROS_ERROR & ROS_INFO messages gets printed out. I know that my code reaches there because the the serial_exception message gets prints out.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-15 23:35:22 -0500

AdamSorrel gravatar image

updated 2018-05-16 00:02:20 -0500

You could try to set a logging level for your package to debug by adding the following configuration file (don't forget to change the package name):

# Override my package to output everything

You can load this set of parameters from a launch file simply adding:

<env name="ROSCONSOLE_CONFIG_FILE" value="$(find YOUR_PACKAGE_NAME)/custom_rosconsole.conf"/>

This should work for C++. There is a different method for python nodes it seems.

This answer has been pretty much taken from here.

edit flag offensive delete link more


okay, so I created a .conf in my package folder, now I am able to see debug in my terminal, do you know how o print to rqt_console as well? thank you.

frodyteen gravatar imagefrodyteen ( 2018-05-16 18:17:02 -0500 )edit

Did you try to check settings (the gray cogwheel in the top left corner). In there you can set logging level for each node separately.

AdamSorrel gravatar imageAdamSorrel ( 2018-05-18 03:36:41 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-05-15 20:55:21 -0500

Seen: 1,654 times

Last updated: May 16 '18