ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Is there a way to get ROS_INFO, ROS_ERROR, etc to output line numbers?

asked 2012-10-25 11:28:58 -0600

SuperElectric gravatar image

updated 2014-01-28 17:14:04 -0600

ngrennan gravatar image

The title says it all. Is there a flag somewhere I can set to get the ROS_INFO/ROS_ERROR/... macros to output line numbers, or is that something I'm going to have to feed to ROS_INFO myself by using __LINE__?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-09-28 10:19:49 -0600

kunaltyagi gravatar image

updated 2018-06-10 20:34:44 -0600

This page's section about Console Output Formatting is what you are looking for.

Essentially

export ROSCONSOLE_FORMAT='[${severity}] [${time}]@${line}: ${message}'
  • ${line} for __LINE__
  • ${function} for __func__
  • ${file} for __FILE__
  • ${node} for the node name, no pre-processor equivalent.
edit flag offensive delete link more
5

answered 2012-10-25 11:31:06 -0600

jbohren gravatar image

If you double-click a given roslog message in rxconsole, it will bring up a window with this information.

edit flag offensive delete link more

Comments

Hmm; this isn't working for me. I'm sure I could get it working, but before I invest energy in that, I'd like to revisit the original question: is there any way to get ROS_INFO to print the line number (without need of external tools like rxconsole)?

SuperElectric gravatar image SuperElectric  ( 2012-11-26 07:15:22 -0600 )edit

What's not working? When you double-click a line in rxconsole, it shows "Location" which is a file and line number. This information is contained in all messages on the rosout topic. If you rostopic echo rosout you will see file: and line: message fields for each rosout message.

jbohren gravatar image jbohren  ( 2012-11-27 03:29:54 -0600 )edit

Question Tools

Stats

Asked: 2012-10-25 11:28:58 -0600

Seen: 7,512 times

Last updated: Jun 10 '18