Recording only a single message instance

asked 2021-04-20 01:32:22 -0500

StevenCoral gravatar image

updated 2021-04-20 01:33:00 -0500

Hi all,
I need to save some metadata about my recording session (e.g. camera info), but a recording session can last for several seconds to over an hour, so I don't want to be recording that same info every second.
I am interested in having a mechanism where a certain topic is recorded only once by rosbag, similarly to how /tf_static has only 1 message instance recorded every time you run "rosbag record".
Is there a way to reproduce this behavior? how would it be implemented?
(as in providing the rosbag command line some arguments not documented here or somehow letting the info-publishing node publish a message once only when another node subscribes to that topic or something).
P.S. I cannot use the parameter server for that job due to other system constraints.

Many thanks in advance,
Steve

edit retag flag offensive close merge delete

Comments

Not an answer, but a comment on this part of your question:

I am interested in having a mechanism where a certain topic is recorded only once by rosbag, similarly to how /tf_static has only 1 message instance recorded every time you run "rosbag record". Is there a way to reproduce this behavior? how would it be implemented?

The tf_static topic is using a latched topic, which is why only "a single message instance is recorded".

This is not a property you can change without having access to the source of the publisher, so if the CameraInfo publisher does not also use latching, you cannot add that later (I've also not seen CameraInfo publishers do that often, as there is the (implicit) assumption there is a 1-to-1 correspondence between sensor_msgs/Images (and similar messages) and CameraInfo messages).

gvdhoorn gravatar image gvdhoorn  ( 2021-04-20 02:20:39 -0500 )edit