Skip to content
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

Fix for at least two types of timestamps in PointCloud2 messages #13

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

tizianoGuadagnino
Copy link
Collaborator

This is mainly to tackle the issue reported in #12 . In essence, some drivers (in this case the Livox driver) express the timestamps in nanoseconds, while other vendors (e.g. Ouster if my mind doesn't fail me) report the stamp directly in seconds. To handle the scenario I decided to count the digits of the timestamps, as we know that ROS stores the seconds and nanoseconds in int32. As this type cannot handle more than 10 digits, any stamp with more than 10 digits in the integer part of the floating point is assumed to be expressed in nanoseconds and converted.

It will need some testing to be sure but on the preliminary analysis, I don't see any difference in results for our data. @KenN7 can you test it on your stuff? or if you can send me the data ;)

@tizianoGuadagnino tizianoGuadagnino linked an issue Oct 29, 2024 that may be closed by this pull request
@KenN7
Copy link
Contributor

KenN7 commented Nov 5, 2024

Hi there,
I cannot send you my data unfortunately, but i can tell you, that from my initial tests, it seems to work fine :)

@KenN7
Copy link
Contributor

KenN7 commented Nov 5, 2024

I was only wondering whether it is normal that the method outputs less points on rviz when the computation is faster ? (in debug vs release)

@tizianoGuadagnino
Copy link
Collaborator Author

I was only wondering whether it is normal that the method outputs less points on rviz when the computation is faster ? (in debug vs release)

I would guess that is a rendering issue from RVIZ, if you check the size of the published PointCloud2 msg it doesn't seems to change

@tizianoGuadagnino
Copy link
Collaborator Author

@benemer from my side we can merge this, I will wait for your trigger

@benemer
Copy link
Member

benemer commented Nov 7, 2024

What do you think about this solution? It is a bit lighter and still uses the fact that ROS represents seconds in int32. This means that if your timestamp is larger than this, it must be measured in nanoseconds (assuming it's either seconds or nanoseconds).

In both solutions, this conversion fails if the message contains a timestamp in nanoseconds smaller than the max value of an int32, which is 2.147483647 seconds. This should not be very important since it only occurs if you use nanoseconds and relative timestamps starting from 0. But in that case, the way we infer the timestamps of the beginning and end of the scan will also fail because this assumes absolute timestamps for the points.

This conversion is not easy because the message timestamp could also contain milliseconds (for whatever reason). However, with this, we at least support the most common scenarios.

@tizianoGuadagnino
Copy link
Collaborator Author

Any solution we bring will be ugly and not elegant in some way. I will stick to what was here to close this after 2 weeks because this was already tested in both scenarios. Any breaking point in this part is going to be my fault. Hopefully, someone else come up with more issues like this so that we can further robustify this part. Thanks @KenN7 for now ;)

@tizianoGuadagnino tizianoGuadagnino merged commit 8c8f801 into main Nov 7, 2024
11 checks passed
@tizianoGuadagnino tizianoGuadagnino deleted the 12-timestamp-problem branch November 7, 2024 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timestamp problem
3 participants