Fuse Lidar and Camera Obstacles
You are given two lists of obstacles detected by different sensors: lidar_obstacles and camera_obstacles.
Each obstacle has a box with coordinates [x, y, w, h], where x and y are the center coordinates, and w and h are the width and height.
Write a function fuse(lidar_obstacles: List[LidarObstacle], camera_obstacles: List[CameraObstacle]) -> List[...].
The goal is to merge the two lists into one list of obstacles for the current timestamp.
- Trust lidar obstacles more when a lidar obstacle overlaps with a camera obstacle.
- If there is no overlap, append both obstacles to the result.
- Return the fused list of obstacles.
This problem asks you to fuse obstacle detections from lidar and camera into a single result list. Each obstacle is represented by a box using center coordinates plus width and height. The key idea is to detect overlaps between boxes, prefer the lidar obstacle when a match exists, and keep both obstacles when there is no overlap. A clean solution usually converts each box into rectangle bounds and applies overlap matching carefully.