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

feat(hesai): add filtered pointcloud counter function #247

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ike-kazu
Copy link
Contributor

PR Type

  • Improvement

Description

This pr will be able to watch filtered pointcloud's count by each filtering such as distance, fov and so on. It is usefull for finding filtering error while seeking causes of lidar pointclouds error.

Review Procedure

Remarks

Pre-Review Checklist for the PR Author

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 Dec 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 26.40%. Comparing base (97959dd) to head (c20d6bf).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #247      +/-   ##
==========================================
+ Coverage   26.07%   26.40%   +0.33%     
==========================================
  Files         101      101              
  Lines        9232     9171      -61     
  Branches     2213     2185      -28     
==========================================
+ Hits         2407     2422      +15     
+ Misses       6436     6362      -74     
+ Partials      389      387       -2     
Flag Coverage Δ
differential 26.40% <100.00%> (?)
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.

Copy link
Collaborator

@mojomex mojomex left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Here is the review so far. Performance looks good but there are some more counters and naming changes I'd like to request 🙇

Comment on lines +51 to +54
NebulaPointCloud point_azimuth_start;
NebulaPointCloud point_azimuth_end;
NebulaPointCloud point_timestamp_start;
NebulaPointCloud point_timestamp_end;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change these from NebulaPointCloud to their respective data types (e.g. float for azimuth, uint64_t for timestamp.

Comment on lines +42 to +44
uint16_t distance_counter = 0;
uint16_t fov_counter = 0;
uint16_t timestamp_counter = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add filtered to the names, e.g. n_filtered_distance, n_filtered_fov etc.

@@ -36,6 +37,52 @@
namespace nebula::drivers
{

struct HesaiDecodeFilteredInfo
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please also add counters for

  • invalid points (distance == 0), line 198
  • points filtered due to dual_return_threshold (line 238)
  • points filtered due to identical return type (line 217)
  • points kept in total (= not filtered) (shall be equal to the final pointcloud size)

/// @brief For each channel, its firing offset relative to the block in nanoseconds
std::array<int, SensorT::packet_t::n_channels> channel_firing_offset_ns_;
/// @brief For each return mode, the firing offset of each block relative to its packet in
/// nanoseconds
std::array<std::array<int, SensorT::packet_t::n_blocks>, SensorT::packet_t::max_returns>
block_firing_offset_ns_;

void get_minmax_info(const NebulaPoint & point)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be moved into HesaiDecodeFilteredInfo so it is clear to readers that it belongs to that struct.

NebulaPointCloud point_timestamp_start;
NebulaPointCloud point_timestamp_end;

void clear()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please make sure that all fields are reset (e.g. timestamp_counter is missing)

Comment on lines +45 to +54
float distance_start = 0;
float distance_end = 0;
float raw_azimuth_start = 0;
float raw_azimuth_end = 0;
std::uint32_t packet_timestamp_start = 0;
std::uint32_t packet_timestamp_end = 0;
NebulaPointCloud point_azimuth_start;
NebulaPointCloud point_azimuth_end;
NebulaPointCloud point_timestamp_start;
NebulaPointCloud point_timestamp_end;
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • Please rename from start/end to min/max.
  • Please also add unit suffixes like _ns for nanoseconds, _rad for radians, _m for meters etc.
  • packet_timestamp_min/max should probably have type uint64_t (uint32_t cannot represent absolute timestamps in nanoseconds)

Instead of point_, please rename to cloud_ so that it is clear that those values are among the points that were not filtered.
I would suggest replacing raw_ with packet_ as well, so we have packet_ (before filtering) vs. cloud_ (after filtering).

Comment on lines +73 to +75
j["distance_counter"] = distance_counter;
j["fov_counter"] = fov_counter;
j["timestamp_counter"] = timestamp_counter;
Copy link
Collaborator

Choose a reason for hiding this comment

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

For filters, let's output them as a JSON array instead:

"filter_pipeline": [
  { "filter": "distance", "count": 50 },
  { "filter": "fov", "count": 120 }
]

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.

2 participants