-
Notifications
You must be signed in to change notification settings - Fork 53
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
refactor(robosense): composable sensor behavior #104
base: main
Are you sure you want to change the base?
Conversation
Performance is still degraded when compared to baseline (PR #77) but I will fix that shortly.
|
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #104 +/- ##
========================================
+ Coverage 6.43% 8.11% +1.68%
========================================
Files 136 77 -59
Lines 10895 8192 -2703
Branches 854 844 -10
========================================
- Hits 701 665 -36
+ Misses 9618 6953 -2665
+ Partials 576 574 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
🟢 Performance fixedPerformance now matches PR #77 within 2%. Why is Boost necessary (why not use
|
helios 931fc70 |
helios_pr105 d9b0746 |
helios_pr105_boost dc7f88c |
helios_pr105_boost_timestamp 1fd80c4 |
|
---|---|---|---|---|
d_total AVG | 1.02077 | 4.61202 | 1.09336 | 1.04474 |
n_out AVG | 47285.3 | 47285.8 | 47285.1 | 47286 |
d_total STD | 0.0733364 | 0.149254 | 0.0582077 | 0.0612363 |
n_out STD | 47.2906 | 46.7324 | 47.5576 | 47.7135 |
d_total AVG % rel to helios | 100 | 451.816 | 107.111 | 102.348 |
n_out AVG % rel to helios | 100 | 100.001 | 99.9995 | 100.001 |
d_total STD % rel to helios | 100 | 203.52 | 79.3708 | 83.5006 |
n_out STD % rel to helios | 100 | 98.8196 | 100.565 | 100.894 |
Currently there is a lot of code duplication happening between sensor models, e.g. for accessing specific fields, determining return types, etc. Furthermore, exotic/non-standard sensors require extra branches or parameters in the decoder. This commit introduces sensor mixins and generic field accessors, which together can be used to compose a wide range of sensor implementations. Currently handled functionalities: * Generic accessors for packet blocks and units * Generic accessors for boost::endian and native struct members * Mixin for getting point azimuth/elevation * Mixin for getting channel IDs * Mixin for getting distance units, distances * Mixin for getting point intensity * Mixin for getting sensor return mode * Mixin for checking scan completion (not limited to angle-based checks) * Mixin for getting packet and point timestamps * Mixin for point pre-validation (e.g. distance !=0 etc.) Sensors implemented using this system must inherit from SensorPase<PacketT>, as well as from all of the used generic/specific mixins they are composed of.
…ntation, rewrite decoder In anticipation of the Robosense M1 PR, the `robosense_decoder.hpp` had to become more generic to support non-angle-based scan cutting along with completely different mechanisms for angle data, dual return and timestamps. Thus, Robosense is the first vendor to be moved to the new composable sensor model, starting with Helios and Bpearl. * Introduce decode groups: multiple packets can be grouped and decoded together, as is necessary for RSM1 * Packet/Block/Unit stride definition for generically handling different return group layouts * Decoder now uses generic sensor member functions to access all point data * Rewrite sensor classes to use SensorBase and mixins * Add SensorInfo classes for the info decoder * Currently, timing and return types are not fully re-implemented * `angle_corrector.hpp` is deleted in favor of sensor mixins * The driver now instantiates sensor objects passed to the decoder
…ocated boost::container::static_vector
1fd80c4
to
545872a
Compare
config file can be used as well, for now. Once setting return modes becomes possible (robosense publishes communication API for sensor) this must be revised
PR Type
Related Links
This PR depends on:
Description
Currently there is a lot of code duplication happening between sensor models (and even more between vendors), e.g. for accessing specific fields, determining return types, etc. Furthermore, sensors with non-ring-based scan patterns (such as the Robosense M1) require extra logic and parameters in the decoder.
This PR introduces sensor mixins and generic field accessors, which together can be used to compose a wide range of sensor implementations. This is the first step towards the ultimate goal of having one decoder handle (almost) all vendors and sensor models.
Here is a before/after comparison of decoding functionality:
unit.distance != 0
All mixins have default implementations (opt-in) that correspond to the behavior prior to this PR.
Sensors implemented using this system must inherit from SensorBase, as well as from all of the used generic/specific mixins they are composed of.
Review Procedure
Remarks
The sensor mixins introduced in this PR are a compromise given that we cannot use C++20's concepts. Thus, the code inherently cannot be as beautiful as in modern C++. Still, I feel like this is close to the best we can do in terms of
Still, please let me know any feedback/criticism!!
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