Parse sub-second digits in ROSCONSOLE_FORMAT

asked 2021-11-15 09:12:36 -0500

ptriantd gravatar image

updated 2021-11-16 03:01:35 -0500

In ROS noetic, one can change the way dates and times are represented by doing export ROSCONSOLE_FORMAT='${time:format string}'.

I am using the following: export ROSCONSOLE_FORMAT='[${severity}] [${time:%Y-%m-%d %H:%M:%S.%f}]: ${message}' because displaying only the seconds is not enough for my application.

However, it seems that there are 2 types of logs (maybe roscpp vs rospy?):

Type 1

[ INFO] [1636988628.662548891]: msg

This gets parsed ok, i.e. I get the first 6 decimal points (not 9 though which is weird)

For example, I see [ INFO] [2021-11-14 14:35:45.662548]: msg

Type 2

[INFO] [1636988672.555812]: msg

This does not get parsed ok, i.e. I get the string %f instead of the actual decimal points.

For example, I see [ INFO] [2021-11-14 14:35:45.%f]: msg

That's surprising given that this has 6 decimal points which is what I'm getting in Type 1. Any idea how to parse this correctly?

edit retag flag offensive close merge delete

Comments

Can you paste the output you are getting? What do you mean by "parsed OK"?

Geoff gravatar image Geoff  ( 2021-11-15 17:04:28 -0500 )edit

Updated question with more concrete examples.

ptriantd gravatar image ptriantd  ( 2021-11-16 03:01:57 -0500 )edit