Skip to content

Commit 60b8f85

Browse files
Merge pull request #100 from facontidavide/feat/viz-lossy-preprocessing
feat: add cloudini v5 adaptive codec
2 parents 9d19297 + a7b9859 commit 60b8f85

30 files changed

Lines changed: 5596 additions & 572 deletions

.github/workflows/ros-rolling.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ concurrency:
1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
17+
# Rolling is allowed to fail: ros-rolling-point-cloud-interfaces was dropped
18+
# from the apt sync circa 2026-04-25 (last green Rolling on main: 2026-04-20).
19+
# Remove this once upstream restores the package or we migrate off it.
20+
continue-on-error: true
1721
container:
1822
image: rostooling/setup-ros-docker:ubuntu-noble-ros-rolling-ros-base-latest
1923
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
/cloudini_py/__pycache__/*
2020
/cloudini_foxglove/src/cloudini_wasm_single.js
2121
/cloudini_foxglove/release/cloudini.foxglove-cloudini-converter-*.foxe
22+
/.claude/worktrees/

CLAUDE.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,56 @@ ros2 run cloudini_ros test_direct_publisher --ros-args \
172172
# Convert a bare .mcap file (if sibling metadata.yaml exists, it is also transformed)
173173
./build_release/tools/cloudini_rosbag_converter -c -y -f DATA/my_bag/my_bag_0.mcap
174174

175+
# Convert with --viz: visualization-oriented lossy preprocessing
176+
# (drop NaN points, voxel-dedupe at xyz resolution, quantize FLOAT64 to 1us).
177+
# Roughly halves output size on real LIDAR with stage-2 ZSTD.
178+
./build_release/tools/cloudini_rosbag_converter -c -y --viz -f DATA/my_bag/
179+
175180
# Decode back to PointCloud2
176181
./build_release/tools/cloudini_rosbag_converter -d -y -f DATA/my_bag_encoded/
177182
```
178183

184+
**Visualization workflow (`--viz`)**:
185+
186+
The `--viz` flag bundles three lossy preprocessing operations applied per
187+
message before V4 encoding:
188+
1. Drop points whose geometry triple (xyz) contains NaN/inf.
189+
2. Voxel-dedupe at the xyz resolution (default 1mm). Hash-based,
190+
order-preserving — first occurrence of each voxel wins.
191+
3. Quantize FLOAT64 fields without an explicit resolution to 1µs (typically
192+
per-point timestamps stored as seconds-since-epoch).
193+
194+
The wire format produced is plain V4 — any standard `mcap` / ROS2 consumer
195+
reads it without changes. The flag is for compression workflows where the
196+
original NaN/duplicate/sub-µs-precision data isn't needed by downstream
197+
visualizers. Empirical results on real LIDAR bags: ratio drops from ~30-40%
198+
(V4 lossless) to ~13-30% codec-only, ~15-17% after stage-2 ZSTD.
199+
200+
Implementation: `cloudini_ros::applyVizLossyPreprocessing` in
201+
`cloudini_lib/src/ros_msg_utils.cpp`. Public API in `ros_msg_utils.hpp`.
202+
203+
**Codec benchmark**:
204+
```bash
205+
# Per-topic ratio + encode/decode speed for V4 vs V4+viz
206+
./build_release/tools/mcap_codec_benchmark DATA/my_bag.mcap --max-messages 100
207+
208+
# Add --zstd for after-ZSTD-3 sizes (production-equivalent)
209+
./build_release/tools/mcap_codec_benchmark DATA/my_bag.mcap --max-messages 100 --zstd
210+
211+
# --explain prints field schema + viz-preprocessing effect for the first
212+
# message of each topic (NaN count, dedup count, FLOAT64 fields quantized)
213+
./build_release/tools/mcap_codec_benchmark DATA/my_bag.mcap --explain
214+
```
215+
216+
**V5 naming note**: A previous research branch
217+
(`feat/lossy-v2-bitpacked-default`, git tag `v5-reference-2026-05`) used "V5"
218+
for a GPU-decodable bit-packed format. That format is archived and should not
219+
be confused with the current V5 wire version on this branch. Current V5 keeps
220+
the V4 float paths and adds adaptive integer sections per chunk: integer fields
221+
can choose V4 delta-varint, palette indexes, raw-value RLE, or Delta-RLE
222+
for repeated increments. Use
223+
`mcap_codec_benchmark` to compare V4/V5 and V4-viz/V5-viz.
224+
179225
### Debugging with ROS2 CLI
180226

181227
```bash

0 commit comments

Comments
 (0)