forked from tier4/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add vector map inside area filter (tier4#1530)
* feat: add no detection area filter Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * ci(pre-commit): autofix * chore: add documents Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * pre-commit fix Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * remove comments Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * fix comments Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * refactor condition to launch points filter Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * fix container name Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * ci(pre-commit): autofix * chore: add visualization for no obstacle segmentation area Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * feat: allow any tags to be given by launch arguments Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: remove unnecessary includes Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * feat: move the polygon removing function to util and use it Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: move the place and change the name of node Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: pre-commit fix Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: remove unnecessary using Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: modify container name Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: fix comments Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: fix comments Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: use output arguments for a large data Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * chore: using namespace of PolygonCgal for readability Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> * feat: add functions for multiple polygons Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> Signed-off-by: Tomohito Ando <tomohito.ando@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
Showing
14 changed files
with
617 additions
and
87 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
88 changes: 88 additions & 0 deletions
88
.../scenario_planning/lane_driving/behavior_planning/vector_map_inside_area_filter.launch.py
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,88 @@ | ||
# Copyright 2022 TIER IV, Inc. All rights reserved. | ||
# | ||
# 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. | ||
|
||
from launch import LaunchDescription | ||
from launch.actions import DeclareLaunchArgument | ||
from launch.actions import SetLaunchConfiguration | ||
from launch.conditions import IfCondition | ||
from launch.conditions import UnlessCondition | ||
from launch.substitutions import LaunchConfiguration | ||
from launch_ros.actions import ComposableNodeContainer | ||
from launch_ros.actions import LoadComposableNodes | ||
from launch_ros.descriptions import ComposableNode | ||
|
||
|
||
def generate_launch_description(): | ||
def add_launch_arg(name: str, default_value=None): | ||
return DeclareLaunchArgument(name, default_value=default_value) | ||
|
||
set_container_executable = SetLaunchConfiguration( | ||
"container_executable", | ||
"component_container", | ||
condition=UnlessCondition(LaunchConfiguration("use_multithread")), | ||
) | ||
|
||
set_container_mt_executable = SetLaunchConfiguration( | ||
"container_executable", | ||
"component_container_mt", | ||
condition=IfCondition(LaunchConfiguration("use_multithread")), | ||
) | ||
|
||
composable_nodes = [ | ||
ComposableNode( | ||
package="pointcloud_preprocessor", | ||
plugin="pointcloud_preprocessor::VectorMapInsideAreaFilterComponent", | ||
name="vector_map_inside_area_filter_node", | ||
remappings=[ | ||
("input", "/perception/obstacle_segmentation/pointcloud"), | ||
("input/vector_map", "/map/vector_map"), | ||
("output", "vector_map_inside_area_filtered/pointcloud"), | ||
], | ||
parameters=[ | ||
{ | ||
"polygon_type": LaunchConfiguration("polygon_type"), | ||
} | ||
], | ||
# this node has QoS of transient local | ||
extra_arguments=[{"use_intra_process_comms": False}], | ||
), | ||
] | ||
|
||
vector_map_area_filter_container = ComposableNodeContainer( | ||
name="vector_map_area_filter_container", | ||
namespace="", | ||
package="rclcpp_components", | ||
executable=LaunchConfiguration("container_executable"), | ||
composable_node_descriptions=composable_nodes, | ||
condition=UnlessCondition(LaunchConfiguration("use_pointcloud_container")), | ||
output="screen", | ||
) | ||
|
||
load_composable_nodes = LoadComposableNodes( | ||
composable_node_descriptions=composable_nodes, | ||
target_container=LaunchConfiguration("container_name"), | ||
condition=IfCondition(LaunchConfiguration("use_pointcloud_container")), | ||
) | ||
|
||
return LaunchDescription( | ||
[ | ||
add_launch_arg("use_multithread", "true"), | ||
add_launch_arg("use_pointcloud_container", "true"), | ||
add_launch_arg("container_name", "vector_map_area_filter_container"), | ||
set_container_executable, | ||
set_container_mt_executable, | ||
vector_map_area_filter_container, | ||
load_composable_nodes, | ||
] | ||
) |
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
4 changes: 4 additions & 0 deletions
4
...g/pointcloud_preprocessor/docs/image/vector_map_inside_area_filter_overview.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
sensing/pointcloud_preprocessor/docs/vector-map-inside-area-filter.md
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,39 @@ | ||
# vector_map_inside_area_filter | ||
|
||
## Purpose | ||
|
||
The `vector_map_inside_area_filter` is a node that removes points inside the vector map area that has given type by parameter. | ||
|
||
## Inner-workings / Algorithms | ||
|
||
- Get the vector map area that has given type by parameter of `polygon_type` | ||
- Extract the vector map area that intersects with the bounding box of input points to reduce the calculation cost | ||
- Create the 2D polygon from the extracted vector map area | ||
- Remove input points inside the polygon | ||
|
||
![vector_map_inside_area_filter_figure](./image/vector_map_inside_area_filter_overview.svg) | ||
|
||
## Inputs / Outputs | ||
|
||
This implementation inherits `pointcloud_preprocessor::Filter` class, so please see also [README](../README.md). | ||
|
||
### Input | ||
|
||
| Name | Type | Description | | ||
| -------------------- | -------------------------------------------- | ------------------------------------ | | ||
| `~/input` | `sensor_msgs::msg::PointCloud2` | input points | | ||
| `~/input/vector_map` | `autoware_auto_mapping_msgs::msg::HADMapBin` | vector map used for filtering points | | ||
|
||
### Output | ||
|
||
| Name | Type | Description | | ||
| ---------- | ------------------------------- | --------------- | | ||
| `~/output` | `sensor_msgs::msg::PointCloud2` | filtered points | | ||
|
||
### Core Parameters | ||
|
||
| Name | Type | Description | | ||
| -------------- | ------ | --------------------------- | | ||
| `polygon_type` | string | polygon type to be filtered | | ||
|
||
## Assumptions / Known limits |
Oops, something went wrong.