-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add blockage diagnostics (#461)
* feat!: add blockage diagnostic Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * docs: add documentation Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: add adjustable param Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * feat!: add blockage diagnostic Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * docs: add documentation Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: add adjustable param Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * ci(pre-commit): autofix * chore: rearrange header file Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: fix typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: rearrange header Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: revert accident change Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: fix typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * docs: add limits Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: check overflow Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7168952
commit 2f3e335
Showing
15 changed files
with
457 additions
and
47 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# blockage_diag | ||
|
||
## Purpose | ||
|
||
To ensure the performance of LiDAR and safety for autonomous driving, the abnormal condition diagnostics feature is needed. | ||
LiDAR blockage is abnormal condition of LiDAR when some unwanted objects stitch to and block the light pulses and return signal. | ||
This node's purpose is to detect the existing of blockage on LiDAR and its related size and location. | ||
|
||
## Inner-workings / Algorithms | ||
|
||
This node bases on the no-return region and its location to decide if it is a blockage. | ||
|
||
![blockage situation](./image/blockage_diag.png) | ||
|
||
The logic is showed as below | ||
|
||
![blockage_diag_flowchart](./image/blockage_diag_flowchart.drawio.svg) | ||
|
||
## Inputs / Outputs | ||
|
||
This implementation inherits `pointcloud_preprocessor::Filter` class, please refer [README](../README.md). | ||
|
||
### Input | ||
|
||
| Name | Type | Description | | ||
| --------------------------- | ------------------------------- | --------------------------------------------------------------- | | ||
| `~/input/pointcloud_raw_ex` | `sensor_msgs::msg::PointCloud2` | The raw point cloud data is used to detect the no-return region | | ||
|
||
### Output | ||
|
||
| Name | Type | Description | | ||
| ---------------------------------------------------- | --------------------------------------- | -------------------------------------------------- | | ||
| `~/output/blockage_diag/debug/blockage_mask_image` | `sensor_msgs::msg::Image` | The mask image of detected blockage | | ||
| `~/output/blockage_diag/debug/ground_blockage_ratio` | `tier4_debug_msgs::msg::Float32Stamped` | The area ratio of blockage region in ground region | | ||
| `~/output/blockage_diag/debug/sky_blockage_ratio` | `tier4_debug_msgs::msg::Float32Stamped` | The area ratio of blockage region in sky region | | ||
| `~/output/blockage_diag/debug/lidar_depth_map` | `sensor_msgs::msg::Image` | The depth map image of input point cloud | | ||
|
||
## Parameters | ||
|
||
| Name | Type | Description | | ||
| -------------------------- | ------ | -------------------------------------------------- | | ||
| `blockage_ratio_threshold` | float | The threshold of blockage area ratio | | ||
| `blockage_count_threshold` | float | The threshold of number continuous blockage frames | | ||
| `horizontal_ring_id` | int | The id of horizontal ring of the LiDAR | | ||
| `angle_range` | vector | The effective range of LiDAR | | ||
| `vertical_bins` | int | The LiDAR channel number | | ||
| `model` | string | The LiDAR model | | ||
|
||
## Assumptions / Known limits | ||
|
||
1. Only Hesai Pandar40P and Hesai PandarQT were tested. For a new LiDAR, it is neccessary to check order of channel id in vertical distribution manually and modifiy the code. | ||
2. The current method is still limited for dust type of blockage when dust particles are sparsely distributed. | ||
|
||
## (Optional) Error detection and handling | ||
|
||
## (Optional) Performance characterization | ||
|
||
## References/External links | ||
|
||
## (Optional) Future extensions / Unimplemented parts |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
sensing/pointcloud_preprocessor/docs/image/blockage_diag_flowchart.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...pointcloud_preprocessor/docs/image/outlier_filter-dual_return_detail.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...ointcloud_preprocessor/docs/image/outlier_filter-dual_return_overall.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 80 additions & 0 deletions
80
...loud_preprocessor/include/pointcloud_preprocessor/blockage_diag/blockage_diag_nodelet.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,80 @@ | ||
// Copyright 2022 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. | ||
|
||
#ifndef POINTCLOUD_PREPROCESSOR__BLOCKAGE_DIAG__BLOCKAGE_DIAG_NODELET_HPP_ | ||
#define POINTCLOUD_PREPROCESSOR__BLOCKAGE_DIAG__BLOCKAGE_DIAG_NODELET_HPP_ | ||
|
||
#include "pointcloud_preprocessor/filter.hpp" | ||
|
||
#include <diagnostic_updater/diagnostic_updater.hpp> | ||
#include <image_transport/image_transport.hpp> | ||
#include <opencv2/highgui/highgui.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <diagnostic_msgs/msg/diagnostic_array.hpp> | ||
#include <sensor_msgs/msg/point_cloud2.hpp> | ||
#include <std_msgs/msg/header.hpp> | ||
#include <tier4_debug_msgs/msg/float32_stamped.hpp> | ||
|
||
#include <cv_bridge/cv_bridge.h> | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace pointcloud_preprocessor | ||
{ | ||
using diagnostic_updater::DiagnosticStatusWrapper; | ||
using diagnostic_updater::Updater; | ||
|
||
class BlockageDiagComponent : public pointcloud_preprocessor::Filter | ||
{ | ||
protected: | ||
virtual void filter( | ||
const PointCloud2ConstPtr & input, [[maybe_unused]] const IndicesPtr & indices, | ||
PointCloud2 & output); | ||
/** \brief Parameter service callback result : needed to be hold */ | ||
OnSetParametersCallbackHandle::SharedPtr set_param_res_; | ||
|
||
/** \brief Parameter service callback */ | ||
rcl_interfaces::msg::SetParametersResult paramCallback(const std::vector<rclcpp::Parameter> & p); | ||
image_transport::Publisher lidar_depth_map_pub_; | ||
image_transport::Publisher blockage_mask_pub_; | ||
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr ground_blockage_ratio_pub_; | ||
rclcpp::Publisher<tier4_debug_msgs::msg::Float32Stamped>::SharedPtr sky_blockage_ratio_pub_; | ||
|
||
private: | ||
void onBlockageChecker(DiagnosticStatusWrapper & stat); | ||
Updater updater_{this}; | ||
uint vertical_bins_; | ||
std::vector<double> angle_range_deg_; | ||
uint horizontal_ring_id_ = 12; | ||
float blockage_ratio_threshold_; | ||
float ground_blockage_ratio_ = -1.0f; | ||
float sky_blockage_ratio_ = -1.0f; | ||
std::vector<float> ground_blockage_range_deg_ = {0.0f, 0.0f}; | ||
std::vector<float> sky_blockage_range_deg_ = {0.0f, 0.0f}; | ||
uint erode_kernel_ = 10; | ||
uint ground_blockage_count_ = 0; | ||
uint sky_blockage_count_ = 0; | ||
uint blockage_count_threshold_; | ||
std::string lidar_model_; | ||
|
||
public: | ||
EIGEN_MAKE_ALIGNED_OPERATOR_NEW | ||
explicit BlockageDiagComponent(const rclcpp::NodeOptions & options); | ||
}; | ||
|
||
} // namespace pointcloud_preprocessor | ||
|
||
#endif // POINTCLOUD_PREPROCESSOR__BLOCKAGE_DIAG__BLOCKAGE_DIAG_NODELET_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
9 changes: 9 additions & 0 deletions
9
sensing/pointcloud_preprocessor/launch/blockage_diag.launch.xml
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,9 @@ | ||
<launch> | ||
<arg name="input_topic_name" default="pointcloud_raw_ex" /> | ||
<arg name="output_topic_name" default="blockage_diag/pointcloud" /> | ||
|
||
<node pkg="pointcloud_preprocessor" exec="blockage_diag_node" name="blockage_diag"> | ||
<remap from="input" to="$(var input_topic_name)" /> | ||
<remap from="output" to="$(var output_topic_name)" /> | ||
</node> | ||
</launch> |
Oops, something went wrong.