forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(traffic_light_category_merger): add new traffic_light_category_m…
…erger package (autowarefoundation#9748) * feat: init traffic light signal merger Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: add tl merger launch Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: cmake lt merger Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: remove unused depend Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: pre-commit Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * feat: add occlusion unknown classifier Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: docs Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: launcher Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * style(pre-commit): autofix * Revert "feat: add occlusion unknown classifier" This reverts commit 9999d28. * fix: launcher Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * refactor Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: add maintainer Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * chore: docs update Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * style(pre-commit): autofix * refactor: rename package Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * fix: typo Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> * change output topic name Signed-off-by: MasatoSaeki <masato.saeki@tier4.jp> --------- Signed-off-by: badai-nguyen <dai.nguyen@tier4.jp> Signed-off-by: MasatoSaeki <masato.saeki@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Masato Saeki <78376491+MasatoSaeki@users.noreply.github.com> Co-authored-by: MasatoSaeki <masato.saeki@tier4.jp>
- Loading branch information
1 parent
91c8501
commit 7f9cdb6
Showing
6 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
perception/autoware_traffic_light_category_merger/CMakeLists.txt
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,28 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(autoware_traffic_light_category_merger) | ||
|
||
# find dependencies | ||
find_package(autoware_cmake REQUIRED) | ||
autoware_package() | ||
|
||
# Targets | ||
ament_auto_add_library(${PROJECT_NAME} SHARED | ||
src/traffic_light_category_merger_node.cpp | ||
) | ||
|
||
rclcpp_components_register_node(${PROJECT_NAME} | ||
PLUGIN "autoware::traffic_light::TrafficLightCategoryMergerNode" | ||
EXECUTABLE traffic_light_category_merger_node) | ||
|
||
|
||
if(BUILD_TESTING) | ||
list(APPEND AMENT_LINT_AUTO_EXCLUDE ament_cmake_uncrustify) | ||
find_package(ament_lint_auto REQUIRED) | ||
ament_lint_auto_find_test_dependencies() | ||
|
||
endif() | ||
|
||
ament_auto_package( | ||
INSTALL_TO_SHARE | ||
launch | ||
) |
22 changes: 22 additions & 0 deletions
22
perception/autoware_traffic_light_category_merger/README.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,22 @@ | ||
`autoware_traffic_light_category_merger` | ||
|
||
## Overview | ||
|
||
`autoware_traffic_light_category_merger` receives the Traffic Light (TL) classification result from Car/Pedestrian classifiers to merge into single classification result. The expect ROIs TL without classification result will be filled as Unknown. | ||
|
||
## Input topics | ||
|
||
| Name | Type | Description | | ||
| -------------------------- | --------------------------------------------- | ----------------------------- | | ||
| `input/car_signals` | tier4_perception_msgs::msg::TrafficLightArray | Car TLs classification | | ||
| `input/pedestrian_signals` | tier4_perception_msgs::msg::TrafficLightArray | Pedestrian TLs classification | | ||
|
||
## Output topics | ||
|
||
| Name | Type | Description | | ||
| ------------------------ | --------------------------------------------- | ------------------------------------- | | ||
| `output/traffic_signals` | tier4_perception_msgs::msg::TrafficLightArray | Car and Pedestrian TLs classification | | ||
|
||
## Node parameters | ||
|
||
N/A |
13 changes: 13 additions & 0 deletions
13
...on/autoware_traffic_light_category_merger/launch/traffic_light_category_merger.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,13 @@ | ||
<launch> | ||
<!-- Output --> | ||
<arg name="input/car_signals" default="classified/car/traffic_signals"/> | ||
<arg name="input/pedestrian_signals" default="classified/pedestrian/traffic_signals"/> | ||
<arg name="output/traffic_signals" default="classification/traffic_signals"/> | ||
|
||
<!-- Node --> | ||
<node pkg="autoware_traffic_light_category_merger" exec="traffic_light_category_merger_node" name="traffic_light_category_merger" output="screen"> | ||
<remap from="input/car_signals" to="$(var input/car_signals)"/> | ||
<remap from="input/pedestrian_signals" to="$(var input/pedestrian_signals)"/> | ||
<remap from="output/traffic_signals" to="$(var output/traffic_signals)"/> | ||
</node> | ||
</launch> |
25 changes: 25 additions & 0 deletions
25
perception/autoware_traffic_light_category_merger/package.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,25 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>autoware_traffic_light_category_merger</name> | ||
<version>0.0.0</version> | ||
<description>The ROS 2 autoware_traffic_light_category_merger package</description> | ||
<maintainer email="yoshi.ri@tier4.jp">Yoshi Ri</maintainer> | ||
<maintainer email="masato.saeki@tier4.jp">Masato Saeki</maintainer> | ||
<maintainer email="dai.nguyen@tier4.jp">Dai Nguyen</maintainer> | ||
<license>Apache License 2.0</license> | ||
<author email="dai.nguyen@tier4.jp">Dai Nguyen</author> | ||
|
||
<buildtool_depend>ament_cmake_auto</buildtool_depend> | ||
|
||
<depend>autoware_test_utils</depend> | ||
<depend>message_filters</depend> | ||
<depend>rclcpp</depend> | ||
<depend>rclcpp_components</depend> | ||
<depend>tier4_perception_msgs</depend> | ||
<build_depend>autoware_cmake</build_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
57 changes: 57 additions & 0 deletions
57
perception/autoware_traffic_light_category_merger/src/traffic_light_category_merger_node.cpp
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,57 @@ | ||
// Copyright 2025 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. | ||
|
||
#include "traffic_light_category_merger_node.hpp" | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace autoware::traffic_light | ||
{ | ||
|
||
TrafficLightCategoryMergerNode::TrafficLightCategoryMergerNode( | ||
const rclcpp::NodeOptions & node_options) | ||
: rclcpp::Node("traffic_light_category_merger_node", node_options), | ||
tf_buffer_(get_clock()), | ||
tf_listener_(tf_buffer_), | ||
car_signal_sub_(this, "input/car_signals", rclcpp::QoS{1}.get_rmw_qos_profile()), | ||
pedestrian_signal_sub_(this, "input/pedestrian_signals", rclcpp::QoS{1}.get_rmw_qos_profile()), | ||
sync_(SyncPolicy(10), car_signal_sub_, pedestrian_signal_sub_) | ||
{ | ||
using std::placeholders::_1; | ||
using std::placeholders::_2; | ||
sync_.registerCallback(std::bind(&TrafficLightCategoryMergerNode::signalsCallback, this, _1, _2)); | ||
pub_traffic_light_signals_ = | ||
create_publisher<TrafficLightArray>("output/traffic_signals", rclcpp::QoS{1}); | ||
} | ||
|
||
void TrafficLightCategoryMergerNode::signalsCallback( | ||
const TrafficLightArray::ConstSharedPtr & car_signals_msg, | ||
const TrafficLightArray::ConstSharedPtr & pedestrian_signals_msg) | ||
{ | ||
TrafficLightArray output; | ||
output.header = car_signals_msg->header; | ||
output.signals.insert( | ||
output.signals.end(), car_signals_msg->signals.begin(), car_signals_msg->signals.end()); | ||
output.signals.insert( | ||
output.signals.end(), pedestrian_signals_msg->signals.begin(), | ||
pedestrian_signals_msg->signals.end()); | ||
pub_traffic_light_signals_->publish(output); | ||
} | ||
|
||
} // namespace autoware::traffic_light | ||
|
||
#include "rclcpp_components/register_node_macro.hpp" | ||
RCLCPP_COMPONENTS_REGISTER_NODE(autoware::traffic_light::TrafficLightCategoryMergerNode) |
62 changes: 62 additions & 0 deletions
62
perception/autoware_traffic_light_category_merger/src/traffic_light_category_merger_node.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,62 @@ | ||
// Copyright 2025 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 TRAFFIC_LIGHT_CATEGORY_MERGER_NODE_HPP_ | ||
#define TRAFFIC_LIGHT_CATEGORY_MERGER_NODE_HPP_ | ||
|
||
#include <autoware/universe_utils/ros/transform_listener.hpp> | ||
#include <rclcpp/rclcpp.hpp> | ||
|
||
#include <tier4_perception_msgs/msg/traffic_light_array.hpp> | ||
|
||
#include <message_filters/subscriber.h> | ||
#include <message_filters/sync_policies/approximate_time.h> | ||
#include <message_filters/synchronizer.h> | ||
|
||
#include <chrono> | ||
#include <memory> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace autoware::traffic_light | ||
{ | ||
using tier4_perception_msgs::msg::TrafficLightArray; | ||
|
||
class TrafficLightCategoryMergerNode : public rclcpp::Node | ||
{ | ||
public: | ||
explicit TrafficLightCategoryMergerNode(const rclcpp::NodeOptions & node_options); | ||
|
||
private: | ||
// Subscriber | ||
tf2_ros::Buffer tf_buffer_; | ||
tf2_ros::TransformListener tf_listener_; | ||
|
||
message_filters::Subscriber<TrafficLightArray> car_signal_sub_; | ||
message_filters::Subscriber<TrafficLightArray> pedestrian_signal_sub_; | ||
|
||
typedef message_filters::sync_policies::ApproximateTime<TrafficLightArray, TrafficLightArray> | ||
SyncPolicy; | ||
message_filters::Synchronizer<SyncPolicy> sync_; | ||
|
||
void signalsCallback( | ||
const TrafficLightArray::ConstSharedPtr & car_signals_msg, | ||
const TrafficLightArray::ConstSharedPtr & pedestrian_signals_msg); | ||
|
||
rclcpp::Publisher<TrafficLightArray>::SharedPtr pub_traffic_light_signals_; | ||
}; | ||
|
||
} // namespace autoware::traffic_light | ||
|
||
#endif // TRAFFIC_LIGHT_CATEGORY_MERGER_NODE_HPP_ |