-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(object_filter): add detected object filter (#1221)
* Add detected object filter Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Refactor class name Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Add readme Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * ADd lanelet filter option Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * change default parameter Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * refactor Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Update readme Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * change detection launch Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * ADd unknown only option Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Update launcher Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Fix bug Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Move object filter into detected_object_validator Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * ci(pre-commit): autofix * Add config parameter yaml for position filter Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Add config for each class Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * ci(pre-commit): autofix * Fix config Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Use shape instead of position Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Update read me Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Use disjoint instead of intersects Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * ci(pre-commit): autofix * Fix typo, remove debug code. Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> * Use shared_ptr Signed-off-by: Shunsuke Miura <shunsuke.miura@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4022551
commit 47e517a
Showing
15 changed files
with
645 additions
and
1 deletion.
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
11 changes: 11 additions & 0 deletions
11
perception/detected_object_validation/config/object_lanelet_filter.param.yaml
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,11 @@ | ||
/**: | ||
ros__parameters: | ||
filter_target_label: | ||
UNKNOWN : true | ||
CAR : false | ||
TRUCK : false | ||
BUS : false | ||
TRAILER : false | ||
MOTORCYCLE : false | ||
BICYCLE : false | ||
PEDESTRIAN : false |
16 changes: 16 additions & 0 deletions
16
perception/detected_object_validation/config/object_position_filter.param.yaml
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,16 @@ | ||
/**: | ||
ros__parameters: | ||
filter_target_label: | ||
UNKNOWN : true | ||
CAR : false | ||
TRUCK : false | ||
BUS : false | ||
TRAILER : false | ||
MOTORCYCLE : false | ||
BICYCLE : false | ||
PEDESTRIAN : false | ||
|
||
upper_bound_x: 100.0 | ||
lower_bound_x: 0.0 | ||
upper_bound_y: 10.0 | ||
lower_bound_y: -10.0 |
82 changes: 82 additions & 0 deletions
82
...ption/detected_object_validation/include/detected_object_filter/object_lanelet_filter.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,82 @@ | ||
// 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 DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ | ||
#define DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ | ||
|
||
#include <lanelet2_extension/utility/message_conversion.hpp> | ||
#include <lanelet2_extension/utility/query.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
#include <tier4_autoware_utils/geometry/geometry.hpp> | ||
|
||
#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp> | ||
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp> | ||
|
||
#include <tf2_ros/buffer.h> | ||
#include <tf2_ros/transform_listener.h> | ||
|
||
#include <string> | ||
|
||
namespace object_lanelet_filter | ||
{ | ||
using tier4_autoware_utils::LinearRing2d; | ||
using tier4_autoware_utils::MultiPoint2d; | ||
using tier4_autoware_utils::Point2d; | ||
using tier4_autoware_utils::Polygon2d; | ||
|
||
struct Filter_target_label | ||
{ | ||
bool UNKNOWN; | ||
bool CAR; | ||
bool TRUCK; | ||
bool BUS; | ||
bool TRAILER; | ||
bool MOTORCYCLE; | ||
bool BICYCLE; | ||
bool PEDESTRIAN; | ||
}; | ||
|
||
class ObjectLaneletFilterNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit ObjectLaneletFilterNode(const rclcpp::NodeOptions & node_options); | ||
|
||
private: | ||
void objectCallback(const autoware_auto_perception_msgs::msg::DetectedObjects::ConstSharedPtr); | ||
void mapCallback(const autoware_auto_mapping_msgs::msg::HADMapBin::ConstSharedPtr); | ||
|
||
rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr object_pub_; | ||
rclcpp::Subscription<autoware_auto_mapping_msgs::msg::HADMapBin>::SharedPtr map_sub_; | ||
rclcpp::Subscription<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr object_sub_; | ||
|
||
lanelet::LaneletMapPtr lanelet_map_ptr_; | ||
lanelet::ConstLanelets road_lanelets_; | ||
|
||
tf2_ros::Buffer tf_buffer_; | ||
tf2_ros::TransformListener tf_listener_; | ||
|
||
Filter_target_label filter_target_; | ||
|
||
bool transformDetectedObjects( | ||
const autoware_auto_perception_msgs::msg::DetectedObjects &, const std::string &, | ||
const tf2_ros::Buffer &, autoware_auto_perception_msgs::msg::DetectedObjects &); | ||
LinearRing2d getConvexHull(const autoware_auto_perception_msgs::msg::DetectedObjects &); | ||
lanelet::ConstLanelets getIntersectedLanelets( | ||
const LinearRing2d &, const lanelet::ConstLanelets &); | ||
bool isPolygonOverlapLanelets(const Polygon2d &, const lanelet::ConstLanelets &); | ||
}; | ||
|
||
} // namespace object_lanelet_filter | ||
|
||
#endif // DETECTED_OBJECT_FILTER__OBJECT_LANELET_FILTER_HPP_ |
68 changes: 68 additions & 0 deletions
68
...tion/detected_object_validation/include/detected_object_filter/object_position_filter.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,68 @@ | ||
// 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 DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ | ||
#define DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ | ||
|
||
#include <lanelet2_extension/utility/message_conversion.hpp> | ||
#include <lanelet2_extension/utility/query.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
#include <tier4_autoware_utils/geometry/geometry.hpp> | ||
|
||
#include <autoware_auto_mapping_msgs/msg/had_map_bin.hpp> | ||
#include <autoware_auto_perception_msgs/msg/detected_objects.hpp> | ||
|
||
#include <tf2_ros/buffer.h> | ||
#include <tf2_ros/transform_listener.h> | ||
|
||
#include <string> | ||
|
||
namespace object_position_filter | ||
{ | ||
struct Filter_target_label | ||
{ | ||
bool UNKNOWN; | ||
bool CAR; | ||
bool TRUCK; | ||
bool BUS; | ||
bool TRAILER; | ||
bool MOTORCYCLE; | ||
bool BICYCLE; | ||
bool PEDESTRIAN; | ||
}; | ||
|
||
class ObjectPositionFilterNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit ObjectPositionFilterNode(const rclcpp::NodeOptions & node_options); | ||
|
||
private: | ||
void objectCallback(const autoware_auto_perception_msgs::msg::DetectedObjects::ConstSharedPtr); | ||
|
||
rclcpp::Publisher<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr object_pub_; | ||
rclcpp::Subscription<autoware_auto_perception_msgs::msg::DetectedObjects>::SharedPtr object_sub_; | ||
|
||
tf2_ros::Buffer tf_buffer_; | ||
tf2_ros::TransformListener tf_listener_; | ||
|
||
float upper_bound_x_; | ||
float upper_bound_y_; | ||
float lower_bound_x_; | ||
float lower_bound_y_; | ||
Filter_target_label filter_target_; | ||
}; | ||
|
||
} // namespace object_position_filter | ||
|
||
#endif // DETECTED_OBJECT_FILTER__OBJECT_POSITION_FILTER_HPP_ |
14 changes: 14 additions & 0 deletions
14
perception/detected_object_validation/launch/object_lanelet_filter.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,14 @@ | ||
<?xml version="1.0"?> | ||
<launch> | ||
<arg name="vector_map_topic" default="/map/vector_map"/> | ||
<arg name="input/object" default="in_objects"/> | ||
<arg name="output/object" default="out_objects"/> | ||
<arg name="filtering_range_param" default="$(find-pkg-share detected_object_validation)/config/object_lanelet_filter.param.yaml"/> | ||
|
||
<node pkg="detected_object_validation" exec="object_lanelet_filter_node" name="object_lanelet_filter" output="screen"> | ||
<remap from="input/vector_map" to="$(var vector_map_topic)"/> | ||
<remap from="input/object" to="$(var input/object)"/> | ||
<remap from="output/object" to="$(var output/object)"/> | ||
<param from="$(var filtering_range_param)"/> | ||
</node> | ||
</launch> |
12 changes: 12 additions & 0 deletions
12
perception/detected_object_validation/launch/object_position_filter.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,12 @@ | ||
<?xml version="1.0"?> | ||
<launch> | ||
<arg name="input/object" default="in_objects"/> | ||
<arg name="output/object" default="out_objects"/> | ||
<arg name="filtering_range_param" default="$(find-pkg-share detected_object_validation)/config/object_position_filter.param.yaml"/> | ||
|
||
<node pkg="detected_object_validation" exec="object_position_filter_node" name="object_position_filter" output="screen"> | ||
<remap from="input/object" to="$(var input/object)"/> | ||
<remap from="output/object" to="$(var output/object)"/> | ||
<param from="$(var filtering_range_param)"/> | ||
</node> | ||
</launch> |
50 changes: 50 additions & 0 deletions
50
perception/detected_object_validation/object-lanelet-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,50 @@ | ||
# object_lanelet_filter | ||
|
||
## Purpose | ||
|
||
The `object_lanelet_filter` is a node that filters detected object by using vector map. | ||
The objects only inside of the vector map will be published. | ||
|
||
## Inner-workings / Algorithms | ||
|
||
## Inputs / Outputs | ||
|
||
### Input | ||
|
||
| Name | Type | Description | | ||
| ------------------ | ----------------------------------------------------- | ---------------------- | | ||
| `input/vector_map` | `autoware_auto_mapping_msgs::msg::HADMapBin` | vector map | | ||
| `input/object` | `autoware_auto_perception_msgs::msg::DetectedObjects` | input detected objects | | ||
|
||
### Output | ||
|
||
| Name | Type | Description | | ||
| --------------- | ----------------------------------------------------- | ------------------------- | | ||
| `output/object` | `autoware_auto_perception_msgs::msg::DetectedObjects` | filtered detected objects | | ||
|
||
## Parameters | ||
|
||
### Core Parameters | ||
|
||
| Name | Type | Default Value | Description | | ||
| -------------------------------- | ---- | ------------- | ----------------------------------------- | | ||
| `filter_target_label.UNKNOWN` | bool | false | If true, unknown objects are filtered. | | ||
| `filter_target_label.CAR` | bool | false | If true, car objects are filtered. | | ||
| `filter_target_label.TRUCK` | bool | false | If true, truck objects are filtered. | | ||
| `filter_target_label.BUS` | bool | false | If true, bus objects are filtered. | | ||
| `filter_target_label.TRAILER` | bool | false | If true, trailer objects are filtered. | | ||
| `filter_target_label.MOTORCYCLE` | bool | false | If true, motorcycle objects are filtered. | | ||
| `filter_target_label.BICYCLE` | bool | false | If true, bicycle objects are filtered. | | ||
| `filter_target_label.PEDESTRIAN` | bool | false | If true, pedestrian objects are filtered. | | ||
|
||
## Assumptions / Known limits | ||
|
||
Filtering is performed based on the shape polygon of the object. | ||
|
||
## (Optional) Error detection and handling | ||
|
||
## (Optional) Performance characterization | ||
|
||
## (Optional) References/External links | ||
|
||
## (Optional) Future extensions / Unimplemented parts |
53 changes: 53 additions & 0 deletions
53
perception/detected_object_validation/object-position-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,53 @@ | ||
# object_position_filter | ||
|
||
## Purpose | ||
|
||
The `object_position_filter` is a node that filters detected object based on x,y values. | ||
The objects only inside of the x, y bound will be published. | ||
|
||
## Inner-workings / Algorithms | ||
|
||
## Inputs / Outputs | ||
|
||
### Input | ||
|
||
| Name | Type | Description | | ||
| -------------- | ----------------------------------------------------- | ---------------------- | | ||
| `input/object` | `autoware_auto_perception_msgs::msg::DetectedObjects` | input detected objects | | ||
|
||
### Output | ||
|
||
| Name | Type | Description | | ||
| --------------- | ----------------------------------------------------- | ------------------------- | | ||
| `output/object` | `autoware_auto_perception_msgs::msg::DetectedObjects` | filtered detected objects | | ||
|
||
## Parameters | ||
|
||
### Core Parameters | ||
|
||
| Name | Type | Default Value | Description | | ||
| -------------------------------- | ----- | ------------- | --------------------------------------------------------------- | | ||
| `filter_target_label.UNKNOWN` | bool | false | If true, unknown objects are filtered. | | ||
| `filter_target_label.CAR` | bool | false | If true, car objects are filtered. | | ||
| `filter_target_label.TRUCK` | bool | false | If true, truck objects are filtered. | | ||
| `filter_target_label.BUS` | bool | false | If true, bus objects are filtered. | | ||
| `filter_target_label.TRAILER` | bool | false | If true, trailer objects are filtered. | | ||
| `filter_target_label.MOTORCYCLE` | bool | false | If true, motorcycle objects are filtered. | | ||
| `filter_target_label.BICYCLE` | bool | false | If true, bicycle objects are filtered. | | ||
| `filter_target_label.PEDESTRIAN` | bool | false | If true, pedestrian objects are filtered. | | ||
| `upper_bound_x` | float | 100.00 | Bound for filtering. Only used if filter_by_xy_position is true | | ||
| `lower_bound_x` | float | 0.00 | Bound for filtering. Only used if filter_by_xy_position is true | | ||
| `upper_bound_y` | float | 50.00 | Bound for filtering. Only used if filter_by_xy_position is true | | ||
| `lower_bound_y` | float | -50.00 | Bound for filtering. Only used if filter_by_xy_position is true | | ||
|
||
## Assumptions / Known limits | ||
|
||
Filtering is performed based on the center position of the object. | ||
|
||
## (Optional) Error detection and handling | ||
|
||
## (Optional) Performance characterization | ||
|
||
## (Optional) References/External links | ||
|
||
## (Optional) Future extensions / Unimplemented parts |
Oops, something went wrong.