-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fill in message_info timestamps #163
Fill in message_info timestamps #163
Conversation
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>
Signed-off-by: Luetkebohle Ingo (CR/AEX3) <ingo.luetkebohle@de.bosch.com>
I'm curious why you changed this, to not have the received timestamp? Does it matter so long as it is consistent within a single implementation? I don't really mind either way, but it seemed like the received timestamp was more useful than wrong. |
The timestamps are intended to see which event came first. However, when you just take system time at the moment of calling rcl_take_request, the timestamps will merely reflect the call order and so carry no value (you could have gotten the same result by calling it yourself just prior to the call). In contrast, Fast-RTPS since 1.10 takes a real received timestamp when it receives the data and stores it in the SampleInfo, from where the rmw_fastrtps implementation of take_request copies it. For this reason, I think it is important to communicate to the user whether the middleware really supports a genuine received timestamp or not. 0 is used to signify that it doesn't. |
Thanks @iluetkeb for helping with implementing this also for cyclone dds, it really makes a difference to me. I just wanted to add a suggestion on how to get a receive time stamp without having to rely on Cyclone to provide it. The RMW layer relies on a custom sample implementation to perform direct ROS2-to-CDR conversion and to get access to the serialized form for rmw_cyclonedds/rmw_cyclonedds_cpp/src/serdata.hpp Lines 48 to 61 in 2638f4a
It won’t be returned in the sample info because cyclone currently only implements the fields defined in the standard, but that can be worked around by using
That gives you a reference to the sample that you can then deserialize by calling ddsi_serdata_to_sample on it. That way you get everything.
(I don’t know what the rules are for loaned samples, but with this sample implementation, and for those topics where the CDR representation matches the in-memory representation and where there are no endianness issues, the same trick would be feasible.) |
This fills the timestamps in the message_info.