generated from tier4/ros2-project-template
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hesai): software-based precise FoV limit & early publishing (#173)
* refactor(hesai): move calibration handling from decoder wrapper to ROS wrapper * chore(hesai): make clang and pre-commit happy * chore(hesai_cmd_response): add missing imports * feat(hesai_decoder): filter points outside of configured FoV * chore(hesai_ros_wrapper): fix clang-tidy errors * feat(hesai_common): calculate FoV padding in calibration config * chore(hesai): fix clang-tidy errors * feat(hesai): automatic hardware FoV oversizing * feat(hesai): publish on cloud_max_angle * fix(hesai_hw_interface): calculate correct FOV angle units * fix(hesai): cut scans correctly in edge cases * test(hesai): add scan cutting tests * fix(hesai_ros_decoder_test): set missing cloud_min_angle, cloud_max_angle in params * fix(at128): disable unsupported lidar range feature for AT128 * test(hesai): rewrite reference data to reflect edge effects of new scan cutting The new scan cutting mechanism filters points based on the corrected angle. This changes the points contained/filtered out at the edges of the scan cut. * fix(at128): do not issue unsupported monitor command * temp: instrumentation for pointcloud time delay * ci(pre-commit): autofix * works now, rebase later * WIP packet loss * refactor(hesai): replace `scan_phase` by `sync_angle` and `cut_angle` * toriaezu working on 360deg lidars * less hacky working version for 360deg lidars * wip AT128 * AT128 maybz? * ci(pre-commit): autofix * AT128 mostly working, edge cases unsure (need real sensor to test) * ci(pre-commit): autofix * AT128 working * Parameter edge cases working * correct cut angle for at128 * chore(hesai): regenerate and fix unit tests * chore: add 'centi' to dictionary * chore(nebula_tests/hesai): make sure each checked cloud contains at least one point * chore(nebula_tests/hesai): add fov params to tests, clean up params * chore(nebula_tests/hesai): add fov cutting unit tests * chore(hesai): make namespaces c++17-style one-liners * chore(hesai): mark single-arg constructor explicit * chore(hesai): favor using over typedef * chore(hesai): initialize uninitialized vars * chore(hesai): clean up imports * chore(hesai): inline function defined in header * chore(hesai): fix case style for some functions and variables * chore(hesai: favor range-based loop over index-based one * chore(hesai): add missing stdexcept include * fix(hesai): fix logic that decides whether to publish packets * chore(continental): fix compiler errors * chore: add missing diagnostic_updater dependency to nebula_tests * fix(hesai_ros_wrapper): reject sync_angle = 360 as this will crash the sensors * fix(hesai_ros_wrapper): disallow cutting at start of scan (except for 360deg FoV) to avoid publishing pointclouds later than necessary. * fix(at128): disallow sync angles outside the [30, 150] deg range * chore(hesai_hw_interface): remove superfluous "starting with FoV" log messages * fix(hesai): return error properly when cut angle is set out-of-range * chore(at128): change `auto` to `int32_t` in angle correction for clarity * chore(at128): change M_PI to M_PIf for clarity Co-authored-by: David Wong <[email protected]> * chore(at128): add note of firmware version where channel output bug occurs * chore(at128): add explanatory comment on why fov bounds are hard-coded * chore(hesai): fix 260deg typo in parameter description * fix(hesai): handle cut at 0/360deg correctly for non-360 and 360deg FoVs * chore(at128): correct return type and rename `all_channels` function, add doc comments * chore(hesai_decoder): replace auto with specific types for number types * chore(hesai): remove unused instrumentation code * chore: update error message printed when setting HW FoV fails * chore(hesai_decoder): add clarifications for decode/output pointcloud handling * chore(hesai): apply suggestions for re-wording documentation comments Co-authored-by: David Wong <[email protected]> * ci(pre-commit): autofix * chore(hesai_ros_wrapper): add missing nebula_packet include * chore(hesai_hw_interface): clarify angle units in `checkAndSetLidarRange` * chore: add ddeg for deci-degrees to cspell dict --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: David Wong <[email protected]>
- Loading branch information
1 parent
528b732
commit 16e1489
Showing
56 changed files
with
1,293 additions
and
580 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ | |
"block_id", | ||
"Bpearl", | ||
"calib", | ||
"centi", | ||
"ddeg", | ||
"DHAVE", | ||
"Difop", | ||
"extrinsics", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
nebula_decoders/include/nebula_decoders/nebula_decoders_common/angles.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright 2024 TIER IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#pragma once | ||
|
||
#include <cmath> | ||
namespace nebula::drivers | ||
{ | ||
|
||
/** | ||
* @brief Tests if `angle` is in the region of the circle defined by `start_angle` and `end_angle`. | ||
* Notably, `end_angle` can be smaller than `start_angle`, in which case the region passes over the | ||
* 360/0 deg bound. This function is unit-independent (but all angles have to have the same unit), | ||
* so degrees, radians, and arbitrary scale factors can be used. | ||
*/ | ||
template <typename T> | ||
bool angle_is_between( | ||
T start_angle, T end_angle, T angle, bool start_inclusive = true, bool end_inclusive = true) | ||
{ | ||
if (!start_inclusive && angle == start_angle) return false; | ||
if (!end_inclusive && angle == end_angle) return false; | ||
|
||
return (start_angle <= angle && angle <= end_angle) || | ||
((end_angle < start_angle) && (angle <= end_angle || start_angle <= angle)); | ||
} | ||
|
||
/** | ||
* @brief Normalizes an angle to the interval [0; max_angle]. This function is unit-independent. | ||
* `max_angle` is 360 for degrees, 2 * M_PI for radians, and the corresponding scaled value for | ||
* scaled units such as centi-degrees (36000). | ||
*/ | ||
template <typename T> | ||
T normalize_angle(T angle, T max_angle) | ||
{ | ||
T factor = std::floor((1.0 * angle) / max_angle); | ||
return angle - (factor * max_angle); | ||
} | ||
|
||
} // namespace nebula::drivers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.