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(hesai): set PTP lock offset on sensor configuration #239

Merged
merged 10 commits into from
Dec 3, 2024

Conversation

mojomex
Copy link
Collaborator

@mojomex mojomex commented Nov 27, 2024

PR Type

  • Improvement
  • Bug Fix

Related Links

Description

This PR adds support for the SET_PTP_LOCK_OFFSET and GET_PTP_LOCK_OFFSET PTC commands.
In the inquiry linked above, it was observed that not explicitly setting PTP lock offset sometimes causes the value to reset to 1 us on at least OT128. While this is likely a sensor firmware bug, being able to set this offset from within Nebula should improve usability, and should eliminate the need to use Hesai's web interface or desktop GUI.

PR Author should check the checkboxes below when creating the PR.

  • Assign PR to reviewer

Checklist for the PR Reviewer

Reviewers should check the checkboxes below before approval.

  • Commits are properly organized and messages are according to the guideline
  • (Optional) Unit tests have been written for new behavior
  • PR title describes the changes

Post-Review Checklist for the PR Author

PR Author should check the checkboxes below before merging.

  • All open points are addressed and tracked via issues or tickets

CI Checks

  • Build and test for PR: Required to pass before the merge.

Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 7.69231% with 24 lines in your changes missing coverage. Please review.

Project coverage is 26.07%. Comparing base (06be1f7) to head (a52297a).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
.../nebula_hesai_hw_interfaces/hesai_hw_interface.cpp 0.00% 14 Missing ⚠️
nebula_ros/src/hesai/hesai_ros_wrapper.cpp 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #239      +/-   ##
==========================================
- Coverage   26.11%   26.07%   -0.05%     
==========================================
  Files         101      101              
  Lines        9213     9232      +19     
  Branches     2212     2213       +1     
==========================================
+ Hits         2406     2407       +1     
- Misses       6418     6436      +18     
  Partials      389      389              
Flag Coverage Δ
differential 26.07% <7.69%> (?)
total ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mojomex
Copy link
Collaborator Author

mojomex commented Nov 27, 2024

Evaluation

Sensor Model SW Version FW Version Ctrl. FW Version Works?
OT128 1.3.19 1.3.13 1.3.10 🟢
OT128 (bench) 1.4.01 1.4.1 1.4.1 🟢
QT128 (bench) 3.1.66 3.1.40 3.1.36 🟢
Pandar40P 2.10.4 4.3.40a 4.51 🔴
Pandar64 2.7.7 4.3.15b 5.10 🔴

Here is a demo of OT128:

ptp-lock-offset.mp4

It has been confirmed that by restarting Nebula, for OT128, the setting can revert to the old value (Hesai firmware bug or PTC documentation inaccurate). With this PR, it is immediately set to the desired value again.

For the other sensors tested that support th command, this bug was not observed. The value persisted over Nebula restarts.

@mojomex mojomex marked this pull request as draft November 27, 2024 05:51
@mojomex mojomex marked this pull request as ready for review November 29, 2024 07:15
@mojomex mojomex force-pushed the fix/hesai-ptp-lock-offset-setting branch from 6fc9002 to d3c6bf4 Compare November 29, 2024 07:18
@mojomex
Copy link
Collaborator Author

mojomex commented Nov 29, 2024

Restricting this feature to only affect OT128 and QT128, as other sensors have been found to not support it (maybe a firmware update would change that).

Sadly, the current architecture for sensor configurations in Nebula forces us to add the parameter to ALL Hesai sensors, even if without any effect.

@mojomex mojomex requested review from TomohitoAndo and drwnz December 2, 2024 07:26
@mojomex mojomex self-assigned this Dec 2, 2024
Copy link
Collaborator

@drwnz drwnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to the documentation as well, but otherwise LGTM!

@mojomex mojomex force-pushed the fix/hesai-ptp-lock-offset-setting branch from d3c6bf4 to 3007f2d Compare December 2, 2024 07:47
Copy link

@TomohitoAndo TomohitoAndo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add to the documentation as well, but otherwise LGTM!

If this is done, LGTM.

@mojomex mojomex enabled auto-merge (squash) December 3, 2024 04:36
@mojomex mojomex disabled auto-merge December 3, 2024 04:54
@mojomex mojomex merged commit 97959dd into main Dec 3, 2024
11 of 13 checks passed
@mojomex mojomex deleted the fix/hesai-ptp-lock-offset-setting branch December 3, 2024 04:54
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.

3 participants