Autoware Mini Lecture 7:�Traffic light detection
Tambet Matiisen
26th March 2024
Architecture
Localization
Global planner
Map�Destination
Object�detection
Lidar
Radar�Camera
Local planner
current pose + speed
detected objects
global path
Controller
local path
Traffic light detection
Map
API�Camera
stopline status
Steering�Speed�Turn signals
Map
GNSS�Lidar�Camera
Traffic light detection
Inputs:
Outputs:
Traffic light detection
Map
API�Camera
stopline status
Traffic light detection
Camera-based
API-based
Fusion
01 Camera-based
02 API-based
03 Fusion
Camera-based
01
Representing traffic lights on the map
Camera-based traffic light detection process
Project traffic �light location to camera image
Crop out �traffic light
Classify cropped out image
red
yellow
green
unknown
Calculating the location of the traffic light w.r.t. the camera
x,y
z
camera_fl
map
Question
source ~/autoware_mini_ws/devel/setup.bash�roslaunch autoware_mini start_bag.launch
rosrun rqt_tf_tree rqt_tf_tree
Frames/transforms involved in figuring out traffic light location
x,y
z
lidar_center
base_link
camera_fl
map
Produced by localizer�Reliability: low
Measured manually�Reliability: high
Calibrated, manual fine-tuning�Reliability: medium
Looking up and applying the transform
transform = self.tf_buffer.lookup_transform(‘camera_fl’, ‘map’, img_msg.header.stamp)
point_map = PointStamped(point=Point(float(x), float(y), float(z)))
point_camera = do_transform_point(point_map, transform).point
Pinhole camera model
O is the focal point of the camera
X,Y,Z represent the axes in camera optical frame, respective coordinates are (x,y,z)
U,V represent the axes in image plane, respective coordinates are (u, v)
R is the image center, f is focal length
Q is the projection of P onto image plane
U
V
X
Y
Z
x
y
z
Pinhole camera model
Due to similar triangles:��
Similarly:��
f - focal length of the camera
U
-u
X
Z
x
z
Question
What are the pixel coordinates of a point (1, 2, 10) in a camera optical frame given that
Camera intrinsic matrix
Compact way to represent pinhole camera coordinate conversions
fx,fy - focal length in pixels (can be different due to multitude of reasons)
cx, cy - center of the image in pixels
uz, vz - pixel coordinates, need to be normalized by dividing with z
Question
Open ~/autoware_mini_ws/src/vehicle_platform/config/calib/camera_fr.yaml
This is a config file for the same camera in previous question.
Camera distortions
Rectification
Unrectified image
Rectified image
Projection of 3D coordinates to 2D plane
camera_model = PinholeCameraModel()
camera_model.fromCameraInfo(camera_info_msg)
camera_model.rectifyImage(image, image)
u, v = self.camera_model.project3dToPixel((point_camera.x, point_camera.y, point_camera.z))
Classification of the traffic light
Camera-based traffic light detection process
Project traffic �light location to camera image
Crop out �traffic light
Classify cropped out image
red
yellow
green
unknown
Camera-based detection in Autoware Mini
source ~/autoware_mini_ws/devel/setup.bash�roslaunch autoware_mini start_bag.launch
Problems with camera-based detection
API-based
02
API-based detection
MQTT Broker
Traffic lights publish their status over authenticated TLS connection
Cars subscribe to the status of traffic lights on their path over anonymous TLS connection
MQTT Explorer
sudo snap install mqtt-explorer�mqtt-explorer
Everything is traffic light?
Pedestrian crossing, bus stop, roundabout publish if it is safe to drive.
MQTT Broker
API-based detection in Autoware Mini
source ~/autoware_mini_ws/devel/setup.bash�roslaunch autoware_mini start_sim.launch tfl_detector=mqtt
Fusion
03
Traffic light detection
Left camera detection
Majority merger
MQTT detection
autoware_msgs/TrafficLightResultArray
Right camera detection
Priority merger
Majority merger in Autoware Mini
source ~/autoware_mini_ws/devel/setup.bash�roslaunch autoware_mini start_bag.launch
Plotjuggler
sudo apt install ros-noetic-plotjuggler�rosrun plotjuggler plotjuggler
Key takeaways