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

Enable Traffic light module #154

Merged
merged 14 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
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
4 changes: 4 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ else # zenoh-bridge-ros2dds & Autoware
export ROS_LOCALHOST_ONLY=1
sudo ip link set lo multicast on # Enable multicast for DDS

# Require the traffic_light node to use the correct topic for traffic light recognition.
if ! grep -q '<arg name="namespace1" value="traffic_light"/>' /opt/autoware/share/tier4_perception_launch/launch/perception.launch.xml; then
sudo sed -i '/<include file="$(find-pkg-share tier4_perception_launch)\/launch\/traffic_light_recognition\/traffic_light.launch.xml">/a\ <arg name="namespace1" value="traffic_light"/>' /opt/autoware/share/tier4_perception_launch/launch/perception.launch.xml
fi
fi

# Able to access binary after pip install
Expand Down
16 changes: 16 additions & 0 deletions script/build_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,19 @@ ros2 launch autoware_lidar_transfusion lidar_transfusion.launch.xml \
model_path:=$AUTOWARE_CARLA_ROOT/autoware_data/lidar_transfusion \
model_param_path:=$(ros2 pkg prefix autoware_launch --share)/config/perception/object_recognition/detection/lidar_model/transfusion.param.yaml \
build_only:=true

# traffic light (car)
ros2 launch autoware_traffic_light_classifier traffic_light_classifier.launch.xml \
car_traffic_light_classifier_label_name:=traffic_light_classifier_mobilenetv2_batch_6 \
car_traffic_light_classifier_model_name:=traffic_light_classifier_mobilenetv2_batch_6 \
traffic_light_classifier_model_path:=$AUTOWARE_CARLA_ROOT/autoware_data/traffic_light_classifier \
traffic_light_classifier_param_path:=$(ros2 pkg prefix autoware_traffic_light_classifier --share)/config/car_traffic_light_classifier.param.yaml \
build_only:=true

# traffic light (pedestrian)
ros2 launch autoware_traffic_light_classifier traffic_light_classifier.launch.xml \
pedestrian_traffic_light_classifier_label_name:=ped_traffic_light_classifier_mobilenetv2_batch_4 \
pedestrian_traffic_light_classifier_model_name:=ped_traffic_light_classifier_mobilenetv2_batch_4 \
traffic_light_classifier_model_path:=$AUTOWARE_CARLA_ROOT/autoware_data/traffic_light_classifier \
traffic_light_classifier_param_path:=$(ros2 pkg prefix autoware_traffic_light_classifier --share)/config/pedestrian_traffic_light_classifier.param.yaml \
build_only:=true
4 changes: 2 additions & 2 deletions script/download_map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ fi

if [ ! -f "$MAP_PATH/lanelet2_map.osm" ] || [ ! -f "$MAP_PATH/pointcloud_map.pcd" ] || [ ! -f "$MAP_PATH/map_projector_info.yaml" ]; then
echo "Download map from Internet..."
gdown --fuzzy -O $MAP_PATH/lanelet2_map.osm https://drive.google.com/file/d/1CMfWin62qIEqQbcIQ6UfplztZDjMBKD6/view
gdown --fuzzy -O $MAP_PATH/lanelet2_map.osm https://drive.google.com/file/d/1eTuRuXWCLHzunwD11zgDahIjVrKLpv__/view
gdown --fuzzy -O $MAP_PATH/pointcloud_map.pcd https://drive.google.com/file/d/1MvJlfjkw3LWFUs5hdE_KQ2_CQTusU8UN/view
gdown --fuzzy -O $MAP_PATH/map_projector_info.yaml https://drive.google.com/file/d/1h1me3TXSoTBL86S94QKlkwSpwUeZXv2J/view
gdown --fuzzy -O $MAP_PATH/map_projector_info.yaml https://drive.google.com/file/d/1Nl3NsDADGQliMgjk7_En5Fc14ja7sIZF/view
echo "Download complete"
fi
22 changes: 22 additions & 0 deletions script/download_models.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,28 @@ declare -A models=(
https://awf.ml.dev.web.auto/perception/models/object_detection_semseg_yolox_s/v1/yolox-sPlus-opt-pseudoV2-T4-960x960-T4-seg16cls.onnx \
https://awf.ml.dev.web.auto/perception/models/object_detection_semseg_yolox_s/v1/yolox-sPlus-opt-pseudoV2-T4-960x960-T4-seg16cls.EntropyV2-calibration.table \
https://awf.ml.dev.web.auto/perception/models/object_detection_semseg_yolox_s/v1/semseg_color_map.csv"

["traffic_light_classifier"]="\
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_mobilenetv2_batch_1.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_mobilenetv2_batch_4.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_mobilenetv2_batch_6.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_efficientNet_b1_batch_1.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_efficientNet_b1_batch_4.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/traffic_light_classifier_efficientNet_b1_batch_6.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v3/ped_traffic_light_classifier_mobilenetv2_batch_1.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v3/ped_traffic_light_classifier_mobilenetv2_batch_4.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v3/ped_traffic_light_classifier_mobilenetv2_batch_6.onnx \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v2/lamp_labels.txt \
https://awf.ml.dev.web.auto/perception/models/traffic_light_classifier/v3/lamp_labels_ped.txt"

["traffic_light_fine_detector"]="\
https://awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3/tlr_car_ped_yolox_s_batch_1.onnx \
https://awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3/tlr_car_ped_yolox_s_batch_4.onnx \
https://awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3/tlr_car_ped_yolox_s_batch_6.onnx \
https://awf.ml.dev.web.auto/perception/models/tlr_yolox_s/v3/tlr_labels.txt"

["tvm_utility"]="\
https://autoware-modelzoo.s3.us-east-2.amazonaws.com/models/3.0.0-20221221/yolo_v2_tiny-x86_64-llvm-3.0.0-20221221.tar.gz"
)

# Function for download models
Expand Down
26 changes: 26 additions & 0 deletions script/run-autoware-traffic-light.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -e

export VEHICLE_NAME="${1:-v1}"
export ZENOH_CARLA_IP_PORT="${2:-'127.0.0.1:7447'}"
export ZENOH_FMS_IP_PORT="${3:-'127.0.0.1:7887'}"

# Add default port for Zenoh IP in Carla and FMS
if [[ ${ZENOH_CARLA_IP_PORT} != *":"* ]]; then
export ZENOH_CARLA_IP_PORT="${ZENOH_CARLA_IP_PORT}:7447"
fi
if [[ ${ZENOH_FMS_IP_PORT} != *":"* ]]; then
export ZENOH_FMS_IP_PORT="${ZENOH_FMS_IP_PORT}:7887"
fi

# Log folder
LOG_PATH=autoware_log/`date '+%Y-%m-%d_%H:%M:%S'`/
mkdir -p ${LOG_PATH}

# Run the program
parallel --verbose --lb ::: \
"ros2 launch autoware_carla_launch autoware_zenoh.launch.xml is_simulation:=false use_traffic_light_recognition:=true \
Copy link
Owner

Choose a reason for hiding this comment

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

I forgot why we need is_simulation:=false. Could you please add the comment here?

2>&1 | tee ${LOG_PATH}/autoware.log" \
"${AUTOWARE_CARLA_ROOT}/external/zenoh-plugin-ros2dds/target/release/zenoh-bridge-ros2dds \
-n /${VEHICLE_NAME} -d ${ROS_DOMAIN_ID} -c ${ZENOH_BRIDGE_ROS2DDS_CONFIG} -e tcp/${ZENOH_CARLA_IP_PORT} -e tcp/${ZENOH_FMS_IP_PORT} \
2>&1 | tee ${LOG_PATH}/zenoh_bridge_ros2dds.log"
6 changes: 5 additions & 1 deletion src/autoware_carla_launch/launch/autoware_zenoh.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<arg name="launch_deprecated_api" default="true" description="launch deprecated API"/>
<!-- Manual Controll -->
<arg name="manual_control" default="true" description="Enable topic relay for manual control"/>

<arg name="is_simulation" default="true"/>
<arg name="use_traffic_light_recognition" default="false"/>

<group scoped="false">
<include file="$(find-pkg-share autoware_launch)/launch/autoware.launch.xml">
<!-- Common -->
Expand Down Expand Up @@ -65,6 +67,8 @@
<!-- Tools -->
<arg name="rviz" value="$(var rviz)"/>
<arg name="rviz_config" value="$(var rviz_config)"/>
<arg name="is_simulation" value="$(var is_simulation)"/>
<arg name="use_traffic_light_recognition" value="$(var use_traffic_light_recognition)"/>
</include>
</group>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ sensor_kit_base_link:
pitch: 0.0 #0.325
yaw: 0.0 #2.0943951
camera4/camera_link:
x: 0.0 #0.07356
x: 2.3 #0.07356
y: 0.0
z: 0.0 #-0.0525
roll: 0.0
pitch: 0.0 #-0.03
yaw: 0.0 #-0.005
roll: 1.57
pitch: -3.14 #-0.03
yaw: 1.57 #-0.005
camera5/camera_link:
x: 0.0 #-0.07356
y: 0.0
Expand Down