Skip to content

Software

scan_detection_fusion

From github.com/HexboxRC/scan_detection_fusion (opens in a new tab)

  • Perception
  • Tool
  • Apache-2.0

A ROS 2 library that fuses 2D camera object detections with a planar LiDAR scan to give labeled obstacles with range estimates and ground footprint polygons for navigation.

Facts

GitHub stars
5read on 29 Nov 2026
Last update
6 Sept 2026Newest commit on main
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate
Hardware it needs, as the project states it
A planar 2D LiDAR publishing a LaserScan, and a camera-based object detector; a camera driver supplying camera_info is optional.

Checked on GitHub on 29 Nov 2026.

Licenses

Code
Apache-2.0 (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (Apache-2.0) at commit 0d7de31 (opens in a new tab), on 16 Oct 2026.

Commercial use
Yes

At a glance

What it is
  • Matches each detection's bearing to LiDAR returns at that bearing and estimates a robust range.
  • Routes LiDAR sampling to the vertical region of each bounding box where the class intersects the scan plane.
  • Publishes a width by depth ground polygon per object, sized from a per-class table and refined from the observed angular span.
  • Projects detected objects into the map frame and publishes them as a JSON registry, RViz markers and footprint polygons.
  • The fusion algorithm is a plain ROS-free Python class, so it can be used and tested without the ROS graph.
  • Targets ROS 2 Jazzy and works with standard vision_msgs detections, camera_info and TF transforms.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
Apache-2.0. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Active, last commit on 6 Sept 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 0d7de31

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @HexboxRC, at commit 0d7de31, under Apache-2.0 (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

scan_detection_fusion

(opens in a new tab) (opens in a new tab) (opens in a new tab)

A reusable ROS 2 library that fuses 2D camera object detections with a planar LiDAR scan to produce range-resolved, semantically labeled obstacles and class-aware footprint polygons for navigation.

A monocular detector knows what an object is and roughly which direction it lies in, but not how far away it is. A 2D LiDAR knows precise distance at every bearing, but nothing about what it is seeing. This package marries the two: it matches each detection's bearing to the LiDAR returns at that bearing, estimates a robust range, projects the result into the map frame, and publishes a labeled object together with a reconstructed ground footprint.

The fusion algorithm is implemented as a plain, ROS-free Python class (LidarCameraFuser) wrapped by a thin ROS 2 node, so the math can be reused and unit-tested independently of the ROS graph. https://index.ros.org/p/scan_detection_fusion/ (opens in a new tab)

Status

This is an open-source ROS 2 package targeting the Jazzy distribution. It is standards-based: detections arrive as vision_msgs/Detection2DArray, camera geometry is read from sensor_msgs/CameraInfo, and sensor placement is taken from the TF tree, so it is not tied to any particular detector or robot.

What it produces

For each detection the node publishes a fused object carrying its class label, estimated range, bearing, map-frame position, and the angular span it subtended. On top of the baseline fusion, two contributions sharpen the output:

Semantic zone routing. LiDAR sampling is directed to the vertical region of the bounding box where a given class actually intersects the scan plane, rather than sampling the whole box, so the range estimate reflects the physical object and not the background behind it.

Class-aware footprint reconstruction. Each object is given a full W × D ground polygon (published as geometry_msgs/PolygonStamped for a Nav2 obstacle layer) from a per-class size table. When the observed LiDAR arc implies a wider object than the table assumes, the width is refined from the measured angular span using

W_obs = 2 · d̂ · tan( (θ_right − θ_left) / 2 )

where d̂ is the estimated range and (θ_right − θ_left) is the detection's angular span. The polygon is oriented so its width spans perpendicular to the line of sight and its depth along it.

Installation
From the ROS index (preferred)

Once released into the Jazzy distribution this package will be installable with:

sudo apt install ros-jazzy-scan-detection-fusion
Currently in Testing Repo (use below)
sudo sh -c 'echo "deb http://packages.ros.org/ros2-testing/ubuntu noble main" > /etc/apt/sources.list.d/ros2-testing.list'
sudo apt update
sudo apt install ros-jazzy-scan-detection-fusion
From source
cd ~/ros2_ws/src
git clone https://github.com/HexboxRC/scan_detection_fusion.git
cd ~/ros2_ws
rosdep install --from-paths src --ignore-src -r -y
colcon build --packages-select scan_detection_fusion
source install/setup.bash
Running the node
ros2 run scan_detection_fusion fuser_node

The following must already be publishing on the graph:

SourceProvides
LiDAR driver/scan (sensor_msgs/LaserScan)
Object detector/detections (vision_msgs/Detection2DArray)
Camera driver/camera_info (sensor_msgs/CameraInfo) — optional
SLAM Toolbox or AMCLTF map → base_footprint

Every topic name is a parameter, so the node remaps onto an existing graph without code changes:

ros2 run scan_detection_fusion fuser_node --ros-args \
  -p topic_scan:=/lidar/scan -p topic_detections:=/yolo/detections
Interface
Subscribed
TopicTypeNotes
/scansensor_msgs/LaserScanplanar scan
/detectionsvision_msgs/Detection2DArraypixel bounding boxes + class IDs
/camera_infosensor_msgs/CameraInfooptional; supplies focal length for pixel→angle
/amcl_posegeometry_msgs/PoseWithCovarianceStampedoptional secondary pose
Published
TopicTypeNotes
/detected_objectsstd_msgs/StringJSON object registry
/object_markersvisualization_msgs/MarkerArrayRViz cylinders + labels
/object_footprintsgeometry_msgs/PolygonStampedone polygon per object
Pixel-to-angle conversion

The node converts a detection's pixel bounding box to a bearing using the camera horizontal field of view. If camera_info is available it derives the focal length from the intrinsics; otherwise it falls back to the hfov_deg and image_width parameters. The active source is logged once at startup.

Detection labels

Semantic zone routing and the footprint size table are keyed by string class labels (e.g. chair, person, couch). A feeding detector must emit those strings as the class_id in Detection2DArray.results[]. Unknown labels fall back to a default footprint size.

Parameters
ParameterDefaultDescription
stale_sec5.0seconds before an unseen object is dropped
publish_hz2.0publish timer frequency
lidar_angle_offset_deg0.0LiDAR mounting-angle correction
min_detection_range0.20ignore LiDAR returns closer than this (m)
max_detection_range6.0ignore LiDAR returns farther than this (m)
angle_expand_deg4.0angular padding added to each bbox edge
ema_alpha0.35EMA weight on the newest measurement (0–1)
estimatorq1range estimator: q1 | median | mean | trimmed_mean | adaptive
use_parallax_correctionfalseenable camera–LiDAR bearing correction
camera_framecamera_linkTF frame used to derive parallax offset
use_spatial_keystruegrid-cell identity keys (reduce ID collisions)
spatial_bin_size0.75grid cell size for spatial keys (m)
publish_footprintstruepublish footprint polygons
footprint_width_refinetruerefine width from the observed LiDAR arc
hfov_deg60.0horizontal FOV fallback when no camera_info
image_width640image width fallback when no camera_info
map_framemapmap frame
base_framebase_footprintrobot base frame

Topic-name parameters (topic_scan, topic_detections, topic_camera_info, topic_amcl_pose, topic_detected_objects, topic_object_markers, topic_object_footprints) default to the names above.

Using the algorithm without ROS

LidarCameraFuser has no ROS dependency and can be used directly:

import math
from scan_detection_fusion.lidar_camera_fuser import LidarCameraFuser

fuser = LidarCameraFuser(
    min_range=0.20, max_range=6.0, lidar_offset=0.0,
    angle_expand=math.radians(4.0), ema_alpha=0.35, stale_sec=5.0,
    estimator='adaptive',
)

fuser.fuse(
    detections=[{'label': 'chair', 'friendly_label': 'Chair', 'confidence': 0.9,
                 'center_angle_rad': 0.10, 'left_angle_rad': 0.15,
                 'right_angle_rad': 0.05}],
    ranges=scan_ranges, angle_min=-math.pi, angle_increment=0.00581,
    robot_x=1.0, robot_y=2.0, robot_yaw=0.0, has_pose=True,
)
print(fuser.registry)
Tests
colcon test --packages-select scan_detection_fusion
colcon test-result --verbose

The suite covers the distance estimators, the angular-window search (including wrap-around at ±π), parallax bearing correction, spatial-bin keying, the map-frame transform, EMA smoothing, and footprint geometry — all without ROS or hardware.

License

Apache-2.0. See LICENSE (opens in a new tab).

Citation

A paper describing the fusion pipeline (semantic zone routing and class-aware footprint reconstruction) is in preparation. Citation details will be added on publication.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.