Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(traffic light recognition): update documents #6724

Open
wants to merge 42 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c0c6e0d
doc: update README for pedestrian traffic light recognition
tzhong518 Apr 2, 2024
cd3c173
fix: precommit
tzhong518 Apr 2, 2024
5c3fee0
fix: spell check
tzhong518 Apr 2, 2024
dd479a6
fix: add image
tzhong518 Apr 3, 2024
8de017a
style(pre-commit): autofix
pre-commit-ci[bot] Apr 2, 2024
1a39999
Update perception/traffic_light_map_based_detector/README.md
tzhong518 Apr 3, 2024
0163497
fix: image size
tzhong518 Apr 3, 2024
1597e17
style(pre-commit): autofix
pre-commit-ci[bot] Sep 3, 2024
15c8cba
fix: topic name
tzhong518 Sep 3, 2024
4e20970
Merge branch 'doc/pedestrian_tlr' of github.com:tzhong518/autoware.un…
tzhong518 Sep 3, 2024
05b338b
style(pre-commit): autofix
pre-commit-ci[bot] Sep 3, 2024
3b51931
fix: topic names in launch file
tzhong518 Sep 5, 2024
1002e45
Update perception/autoware_traffic_light_classifier/README.md
tzhong518 Sep 5, 2024
3993792
Update perception/autoware_traffic_light_classifier/README.md
tzhong518 Sep 5, 2024
e529247
fix: descriptions
tzhong518 Sep 5, 2024
66c69b8
fix: descriptions
tzhong518 Sep 5, 2024
200573c
style(pre-commit): autofix
pre-commit-ci[bot] Sep 5, 2024
84013dd
doc: update README for pedestrian traffic light recognition
tzhong518 Apr 2, 2024
f8f2da5
fix: precommit
tzhong518 Apr 2, 2024
2d72c1b
fix: spell check
tzhong518 Apr 2, 2024
1d37b17
fix: add image
tzhong518 Apr 3, 2024
a98021f
style(pre-commit): autofix
pre-commit-ci[bot] Apr 2, 2024
35b04c7
Update perception/traffic_light_map_based_detector/README.md
tzhong518 Apr 3, 2024
4703cb8
fix: image size
tzhong518 Apr 3, 2024
fe232e5
fix: topic name
tzhong518 Sep 3, 2024
18849ec
style(pre-commit): autofix
pre-commit-ci[bot] Sep 3, 2024
f3efde5
fix: topic names in launch file
tzhong518 Sep 5, 2024
0a6a4be
fix: descriptions
tzhong518 Sep 5, 2024
520454b
style(pre-commit): autofix
pre-commit-ci[bot] Sep 3, 2024
bf207de
Update perception/autoware_traffic_light_classifier/README.md
tzhong518 Sep 5, 2024
f1a384f
Update perception/autoware_traffic_light_classifier/README.md
tzhong518 Sep 5, 2024
5791db0
fix: conflict
tzhong518 Dec 6, 2024
cd04a31
fix: conflict
tzhong518 Dec 6, 2024
dac207e
style(pre-commit): autofix
pre-commit-ci[bot] Dec 6, 2024
f8383d6
Merge branch 'main' into doc/pedestrian_tlr
tzhong518 Dec 6, 2024
dbfab6e
style(pre-commit): autofix
pre-commit-ci[bot] Dec 6, 2024
699174a
fix: precommit
tzhong518 Dec 6, 2024
7f871e4
fix: precommit
tzhong518 Dec 6, 2024
43ee732
Merge branch 'doc/pedestrian_tlr' of github.com:tzhong518/autoware.un…
tzhong518 Dec 6, 2024
0e36360
fix: test
tzhong518 Dec 9, 2024
6e269bc
fix: readme
tzhong518 Dec 9, 2024
3333b54
style(pre-commit): autofix
pre-commit-ci[bot] Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 40 additions & 12 deletions perception/autoware_crosswalk_traffic_light_estimator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@

## Purpose

`crosswalk_traffic_light_estimator` is a module that estimates pedestrian traffic signals from HDMap and detected vehicle traffic signals.
tzhong518 marked this conversation as resolved.
Show resolved Hide resolved
`crosswalk_traffic_light_estimator` is a module that estimates pedestrian traffic signals from HDMap and detected traffic signals.

## Inputs / Outputs

### Input

| Name | Type | Description |
| ------------------------------------ | ------------------------------------------------ | ------------------ |
| `~/input/vector_map` | `autoware_map_msgs::msg::LaneletMapBin` | vector map |
| `~/input/route` | `autoware_planning_msgs::msg::LaneletRoute` | route |
| `~/input/classified/traffic_signals` | `tier4_perception_msgs::msg::TrafficSignalArray` | classified signals |
| Name | Type | Description |
| ----------------------------------- | ------------------------------------------------------- | ------------------ |
| `~/input/vector_map` | `autoware_map_msgs::msg::LaneletMapBin` | vector map |
| `~/input/route` | `autoware_planning_msgs::msg::LaneletRoute` | route |
Copy link
Contributor

@ktro2828 ktro2828 Sep 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you describe route message is optional?

Copy link
Contributor Author

@tzhong518 tzhong518 Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

| `~/input/classified/traffic_lights` | `autoware_perception_msgs::msg::TrafficLightGroupArray` | classified signals |

### Output

| Name | Type | Description |
| -------------------------- | ------------------------------------------------------- | --------------------------------------------------------- |
| `~/output/traffic_signals` | `autoware_perception_msgs::msg::TrafficLightGroupArray` | output that contains estimated pedestrian traffic signals |
| Name | Type | Description |
| ------------------------- | ------------------------------------------------------- | --------------------------------------------------------- |
| `~/output/traffic_lights` | `autoware_perception_msgs::msg::TrafficLightGroupArray` | output that contains estimated pedestrian traffic signals |

## Parameters

| Name | Type | Description | Default value |
| :---------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------ |
| `use_last_detect_color` | `bool` | If this parameter is `true`, this module estimates pedestrian's traffic signal as RED not only when vehicle's traffic signal is detected as GREEN/AMBER but also when detection results change GREEN/AMBER to UNKNOWN. (If detection results change RED or AMBER to UNKNOWN, this module estimates pedestrian's traffic signal as UNKNOWN.) If this parameter is `false`, this module use only latest detection results for estimation. (Only when the detection result is GREEN/AMBER, this module estimates pedestrian's traffic signal as RED.) | `true` |
| `last_detect_color_hold_time` | `double` | The time threshold to hold for last detect color. | `2.0` |
| `last_detect_color_hold_time` | `double` | The time threshold to hold for last detected vehicle traffic light color. | `2.0` |
knzo25 marked this conversation as resolved.
Show resolved Hide resolved
| `last_colors_hold_time` | `double` | The time threshold to hold for history detected pedestrian traffic light color. |
knzo25 marked this conversation as resolved.
Show resolved Hide resolved

## Inner-workings / Algorithms

1. Estimate the color of pedestrian traffic light from HDMap and detected vehicle traffic signals.
2. If pedestrian traffic light recognition is available, determine the final state based on classification result and estimation result.

### Estimation

```plantuml

start
Expand Down Expand Up @@ -58,7 +64,7 @@ end

If traffic between pedestrians and vehicles is controlled by traffic signals, the crosswalk traffic signal maybe **RED** in order to prevent pedestrian from crossing when the following conditions are satisfied.

### Situation1
#### Situation1

- crosswalk conflicts **STRAIGHT** lanelet
- the lanelet refers **GREEN** or **AMBER** traffic signal (The following pictures show only **GREEN** case)
Expand All @@ -70,7 +76,7 @@ If traffic between pedestrians and vehicles is controlled by traffic signals, th
<img src="images/intersection1.svg" width=80%>
</div>

### Situation2
#### Situation2

- crosswalk conflicts different turn direction lanelets (STRAIGHT and LEFT, LEFT and RIGHT, RIGHT and STRAIGHT)
- the lanelets refer **GREEN** or **AMBER** traffic signal (The following pictures show only **GREEN** case)
Expand All @@ -79,6 +85,28 @@ If traffic between pedestrians and vehicles is controlled by traffic signals, th
<img src="images/intersection2.svg" width=80%>
</div>

### Final state

```plantumul
start
if (the pedestrian traffic light classification result exists)then
: update the flashing flag according to the classification result(in_signal) and last_signals
if (the traffic light is flashing?)then(yes)
: update the traffic light state
else(no)
: the traffic light state is the same with the classification result
if (the classification result not exists)
: the traffic light state is the same with the estimation
: output the current traffic light state
end
```

#### Update flashing flag

<div align="center">
<img src="images/flashing_state.png" width=50%>
</div>

## Assumptions / Known limits

## Future extensions / Unimplemented parts
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<node pkg="autoware_crosswalk_traffic_light_estimator" exec="crosswalk_traffic_light_estimator_node" name="crosswalk_traffic_light_estimator" output="screen">
<remap from="~/input/vector_map" to="/map/vector_map"/>
<remap from="~/input/route" to="/planning/mission_planning/route"/>
<remap from="~/input/classified/traffic_signals" to="classified/traffic_signals"/>
<remap from="~/output/traffic_signals" to="traffic_signals"/>
<remap from="~/input/classified/traffic_lights" to="classified/traffic_lights"/>
<remap from="~/output/traffic_lights" to="traffic_lights"/>
<param from="$(var crosswalk_traffic_light_estimator_param_file)"/>
</node>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ CrosswalkTrafficLightEstimatorNode::CrosswalkTrafficLightEstimatorNode(
"~/input/route", rclcpp::QoS{1}.transient_local(),
std::bind(&CrosswalkTrafficLightEstimatorNode::onRoute, this, _1));
sub_traffic_light_array_ = create_subscription<TrafficSignalArray>(
"~/input/classified/traffic_signals", rclcpp::QoS{1},
"~/input/classified/traffic_lights", rclcpp::QoS{1},
std::bind(&CrosswalkTrafficLightEstimatorNode::onTrafficLightArray, this, _1));

pub_traffic_light_array_ =
this->create_publisher<TrafficSignalArray>("~/output/traffic_signals", rclcpp::QoS{1});
this->create_publisher<TrafficSignalArray>("~/output/traffic_lights", rclcpp::QoS{1});
pub_processing_time_ = std::make_shared<DebugPublisher>(this, "~/debug");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class MapBasedPredictionNode : public rclcpp::Node
rclcpp::Subscription<TrackedObjects>::SharedPtr sub_objects_;
rclcpp::Subscription<LaneletMapBin>::SharedPtr sub_map_;
autoware::universe_utils::InterProcessPollingSubscriber<TrafficLightGroupArray>
sub_traffic_signals_{this, "/traffic_signals"};
sub_traffic_signals_{this, "/traffic_lights"};

// debug publisher
std::unique_ptr<autoware::universe_utils::StopWatch<std::chrono::milliseconds>> stop_watch_ptr_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<arg name="param_path" default="$(find-pkg-share autoware_map_based_prediction)/config/map_based_prediction.param.yaml"/>

<arg name="vector_map_topic" default="/map/vector_map"/>
<arg name="traffic_signals_topic" default="/perception/traffic_light_recognition/traffic_signals"/>
<arg name="traffic_signals_topic" default="/perception/traffic_light_recognition/traffic_lights"/>
<arg name="output_topic" default="objects"/>
<arg name="input_topic" default="/perception/object_recognition/tracking/objects"/>

<node pkg="autoware_map_based_prediction" exec="map_based_prediction" name="map_based_prediction" output="both">
<param from="$(var param_path)"/>
<remap from="/vector_map" to="$(var vector_map_topic)"/>
<remap from="/traffic_signals" to="$(var traffic_signals_topic)"/>
<remap from="/traffic_lights" to="$(var traffic_lights_topic)"/>
<remap from="~/output/objects" to="$(var output_topic)"/>
<remap from="~/input/objects" to="$(var input_topic)"/>
</node>
Expand Down
16 changes: 8 additions & 8 deletions perception/autoware_traffic_light_arbiter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ The table below outlines how the matching process determines the output based on

#### Input

| Name | Type | Description |
| -------------------------------- | ----------------------------------------------------- | -------------------------------------------------------- |
| ~/sub/vector_map | autoware_map_msgs::msg::LaneletMapBin | The vector map to get valid traffic signal ids. |
| ~/sub/perception_traffic_signals | autoware_perception_msgs::msg::TrafficLightGroupArray | The traffic signals from the image recognition pipeline. |
| ~/sub/external_traffic_signals | autoware_perception_msgs::msg::TrafficLightGroupArray | The traffic signals from an external system. |
| Name | Type | Description |
| ------------------------------- | ----------------------------------------------------- | -------------------------------------------------------- |
| ~/sub/vector_map | autoware_map_msgs::msg::LaneletMapBin | The vector map to get valid traffic signal ids. |
| ~/sub/perception_traffic_lights | autoware_perception_msgs::msg::TrafficLightGroupArray | The traffic signals from the image recognition pipeline. |
| ~/sub/external_traffic_lights | autoware_perception_msgs::msg::TrafficLightGroupArray | The traffic signals from an external system. |

#### Output

| Name | Type | Description |
| --------------------- | ----------------------------------------------------- | -------------------------------- |
| ~/pub/traffic_signals | autoware_perception_msgs::msg::TrafficLightGroupArray | The merged traffic signal state. |
| Name | Type | Description |
| -------------------- | ----------------------------------------------------- | -------------------------------- |
| ~/pub/traffic_lights | autoware_perception_msgs::msg::TrafficLightGroupArray | The merged traffic signal state. |

## Parameters

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<launch>
<arg name="perception_traffic_signals" default="/internal/traffic_signals"/>
<arg name="external_traffic_signals" default="/external/traffic_signals"/>
<arg name="output_traffic_signals" default="/traffic_light_arbiter/traffic_signals"/>
<arg name="perception_traffic_lights" default="/internal/traffic_lights"/>
<arg name="external_traffic_lights" default="/external/traffic_lights"/>
<arg name="output_traffic_lights" default="/traffic_light_arbiter/traffic_lights"/>
<arg name="traffic_light_arbiter_param_path" default="$(find-pkg-share autoware_traffic_light_arbiter)/config/traffic_light_arbiter.param.yaml"/>

<push-ros-namespace namespace="traffic_light_arbiter"/>
<node_container pkg="rclcpp_components" exec="component_container" name="container" namespace="">
<composable_node pkg="autoware_traffic_light_arbiter" plugin="autoware::TrafficLightArbiter" name="arbiter">
<remap from="~/sub/vector_map" to="/map/vector_map"/>
<remap from="~/sub/perception_traffic_signals" to="$(var perception_traffic_signals)"/>
<remap from="~/sub/external_traffic_signals" to="$(var external_traffic_signals)"/>
<remap from="~/pub/traffic_signals" to="$(var output_traffic_signals)"/>
<remap from="~/sub/perception_traffic_lights" to="$(var perception_traffic_lights)"/>
<remap from="~/sub/external_traffic_lights" to="$(var external_traffic_lights)"/>
<remap from="~/pub/traffic_lights" to="$(var output_traffic_lights)"/>
<param from="$(var traffic_light_arbiter_param_path)"/>
</composable_node>
</node_container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ TrafficLightArbiter::TrafficLightArbiter(const rclcpp::NodeOptions & options)
std::bind(&TrafficLightArbiter::onMap, this, std::placeholders::_1));

perception_tlr_sub_ = create_subscription<TrafficSignalArray>(
"~/sub/perception_traffic_signals", rclcpp::QoS(1),
"~/sub/perception_traffic_lights", rclcpp::QoS(1),
std::bind(&TrafficLightArbiter::onPerceptionMsg, this, std::placeholders::_1));

external_tlr_sub_ = create_subscription<TrafficSignalArray>(
"~/sub/external_traffic_signals", rclcpp::QoS(1),
"~/sub/external_traffic_lights", rclcpp::QoS(1),
std::bind(&TrafficLightArbiter::onExternalMsg, this, std::placeholders::_1));

pub_ = create_publisher<TrafficSignalArray>("~/pub/traffic_signals", rclcpp::QoS(1));
pub_ = create_publisher<TrafficSignalArray>("~/pub/traffic_lights", rclcpp::QoS(1));
}

void TrafficLightArbiter::onMap(const LaneletMapBin::ConstSharedPtr msg)
Expand Down
Loading
Loading