Robotics StackExchange | Archived questions

When does rosbag start capturing messages and why I see the delay in two messages?

I am trying to understand how much time it takes for rosbag to start capturing packet as soon as we type rosbag record -a .

After analyzing packets captured in the wireshark ( see the wireshark packet at https://goo.gl/9kR2WC) , I found that before receiving any messages from ros nodes, roscord subscribers do several packet negotiations with ROS MASTER and then closes the connection to directly connect with rosnode to receive message from them (In enclosed wireshark capture file, packet no. 91 to 314). I want to know that during this packet negotiation, are ros messages buffered and once connection is established they are recorded or during this packet negotiation are ros messages dropped?

The reason is my bot publishes position and velocity. Differentiating position should give velocity. When I plot differentiated position and velocity, I find that there is lag of 0.4 second in velocity data and time shifting velocity by 0.4 second matches the differentiated position. Please note that positions and velocity data comes from two different sensor(it means they come from two different ros nodes).

My whole point of discussion is to find out the source of the delay or why I need to do time shift in velocity.

Asked by cybodroid on 2016-03-21 17:14:34 UTC

Comments

Are you using bag timestamps or message timestamps? One of the goals of message timestamps is to provide the source time for a message, so that even if it's received with some delay, the original time-series data can be reconstructed correctly.

Asked by ahendrix on 2016-03-21 19:00:13 UTC

I am using MATLAB to read rosbag files http://www.mathworks.com/help/robotics/examples/work-with-rosbag-logfiles.html?refresh=true

Asked by cybodroid on 2016-03-21 22:51:25 UTC

I'm not familiar with the matlab bindings for ROS. I suspect you're using the TimerSeries extraction to read messages, but it's not clear if that method of reading the bag file uses the bag timestamps or the timestamps from the message headers.

Asked by ahendrix on 2016-03-21 22:58:29 UTC

You may want to try including both the header.stamp and your data when you extract data from the bag, and see how the extracted timestamps compare to the header timestamps.

Asked by ahendrix on 2016-03-21 22:59:44 UTC

Answers

rosbag connects to publishers like any other node: http://wiki.ros.org/ROS/Technical%20Overview#Establishing_a_topic_connection

No message sent before the connection is established will be buffered or queued in any way. (For the rosbag subscriber, other subscribers with established connections will queue as expected.) Anything sent during the negotiations will be dropped.

As @ahendrix mentions you should make sure to use the embedded timestamps not the time or receipt. And if those are off I would suggest looking at your data sources to make sure that they are applying timestamps correctly and their timesources are synchronized.

Asked by tfoote on 2019-03-01 13:23:34 UTC

Comments