-
Notifications
You must be signed in to change notification settings - Fork 55
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
feat: hesai timezone unit tests #81
Conversation
The sensor-specific duplicates of the ..._test_main and ..._test files have been refactored into a single generic implementation that takes only the sensor parameters as input. The ReadBag function has been refactored such that it takes a callback function which is called on every point cloud scan. This allows for easy and concise implementation of new test cases.
Decoders should always decode pointcloud timestamps in UST. This new unit test decodes the same pointcloud in different timezones and checks if the decoded times are equal.
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #81 +/- ##
==========================================
+ Coverage 8.03% 31.80% +23.76%
==========================================
Files 108 7 -101
Lines 9069 742 -8327
Branches 844 463 -381
==========================================
- Hits 729 236 -493
+ Misses 7778 94 -7684
+ Partials 562 412 -150
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
@amc-nu All resolved, thank you for reviewing! |
PR Type
Related Links
#78 fix: hesai_decoder replace mktime with timegm -- the motivation for this PR
#80 Generic hesai unit tests -- unit test refactoring which this PR depends on
Description
Depends on #80 Generic hesai unit tests.
This PR implements a unit test for all Hesai sensor models which tests for correct timezone handling.
The expected decoder behavior is that, regardless of system timezone settings, pointcloud timestamps
are output in UST.
As demonstrated by #78, using the wrong function to parse timestamps can lead to timezone-dependent behavior,
which was, until now, hard to catch during development.
The new unit test sets the process' timezone settings to different values and decodes the same rosbag in each of them.
The pointcloud timestamps as returned by
HesaiDriver::ConvertScanToPointcloud
, decoded in different timezones, are then checked for equality.Review Procedure
Change between
mktime
andgmtime
in line 59 inhesai_packet.hpp
, compile and run the unit tests.They should fail for
mktime
and pass fortimegm
, as pointed out in #78.With
timegm
:With
mktime
:The timestamps can be converted to human-readable form in the terminal using
date -ud @<timestamp>
:Remarks
Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks