PX4Flow message stamps according to ROS clock #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
With your current PX4flow driver version the ROS messages come with the sensor clock as stamp (more stable and regular than ROS clock).
This means that they cannot be used directly in other nodes that require a stamp check.
Basically the sensor clock starts when the hardware is powered, thus provoking a big time stamp jump between actual ROS clock and the stamp appended to the messages.
A usual solution here could be to add a ROS::Time::now() in the message stamps before publishing them (considering the high frame rate), however in this particular case the publisher objects are inside a for loop that depends on the serial reading.
Through the serial can come several packages of the same type, flow for instance, thus all published message would have the same time stamp using ROS::Time::now().
Instead, the patch gets the sensor clock when is stable (after first serial reading) and synchronizes the message stamps considering the ROS clock when this is stable (after a second or so).
By the way, I added also the time stamp to the image messages in case they are published.
I believe this is useful for a general purpose.
If you feel the pull request cannot be accepted, I will keep the fork.
Thank you for your time.
All the best,
Angel.