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 -0500

SuperElectric gravatar image

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

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 -0500

kunaltyagi gravatar image

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

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 -0500

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 -0500 )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 -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

Stats

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

Seen: 6,396 times

Last updated: Jun 10 '18