Skip to content

Modifying relocalization and mapping for using mid360 lidar - #3393

Open
sharnam2015 wants to merge 18 commits into
dimensionalOS:mainfrom
sharnam2015:sharnam-mid360-relocalization
Open

Modifying relocalization and mapping for using mid360 lidar#3393
sharnam2015 wants to merge 18 commits into
dimensionalOS:mainfrom
sharnam2015:sharnam-mid360-relocalization

Conversation

@sharnam2015

@sharnam2015 sharnam2015 commented Aug 7, 2026

Copy link
Copy Markdown

Contribution path

  • Small, safe change that does not need a tracking issue
  • Linked issue or discussion: DIM-XXX / #XXX / URL

A PR for some of the main things needed for incorporating a mid360 lidar instead of the go2 default.
PLEASE NOTE: Tests still need to be added and the code needs to be cleaned up, formatted

Video link of the relocalization with the 0.03 voxel size (...screen2) attached below

mid360_relocalization_screen_2.mp4

youtube link - https://youtu.be/cWDTVGVOkOM

Video link of the relocalization with all the changes for the mid360 0.03 voxel size, fine voxel adjustment and redist change - https://youtu.be/X0Blmo3WqXE

video link for all the changes with the 0.03 voxel size and pointlio odometry
https://youtu.be/XYFap8_wz-k

Problem

Modifying relocalization specifically for mid360-

Solution

Changed files to first accept the pointlio stream
Then changed voxel size for the more dense mid360 point cloud.
Added a config option for using mid360 settings as a user directly during map building, relocalization and more
Added some evaluation metrics that show the fitness, ICP RMSE values , log them
The changed fine_voxels and redist values for the relocalization for mid360
For mid360 also incorporated pointlio odometry instead of legged odometry in go2

How to Test

Running the relocalization with the mid360 config

cd ~/dimos
source .venv/bin/activate
export LD_LIBRARY_PATH=$HOME/.local/lib:${LD_LIBRARY_PATH:-}

dimos --replay --replay-db=data/recording_mid360_1stofficetrial
--lidar-config mid360
--viewer rerun
run unitree-go2-mid360-relocalization
--map-file=data/recording_mid360_1stofficetrial3

Command to build premap
dimos map global data/recording_mid360_1stofficetrial --export --lidar-config mid360

Logging fitness, and other values after first relocalization
dimos log -f | rg 'relocalize first event|relocalize:'

Using a more refined voxel size while keeping the number of voxels the same - imporves accuracy while just linearly increasing compute a little for mapping , while the ICP registration compute is still the same as number of voxels are the same
image

image

Sensor Specs comparison mid360 with go2
image

Test script and other testing still needs to be added (Ongoing)

FUTURE and NEXT STEPS

  1. BUild and add a regression testing pipeline for such algorithm changes and the results from there
  2. Add more unit tests for each function changed wherever tests are not added
  3. Optimize /modify a bunch of more things like - ICP RMSE based rejection , ICP divergence check,
    all tuned for the mid360
  4. Run a thorough optimization for finding the exact and most optimal values for each of the thresholds, voxel size and more for the mid360
  5. Set some more variables like number of voxels minimum and more too
  6. Adjust the athens lidar angle for those datasets
  7. Adjust the pointlio lidar odometry mount angle to be set by the user
  8. Format the code well
  9. Incorporate production code aspects, safety aspects in the code
  10. Format the code with comments too according to the google coding style or the tempate followed
  11. Use a ground truth that is significantly better than pointlio for comparisons
  12. Run multiple comparisons on more datasets to confirm similarity of results and inferences accross datasets

AI assistance

Used cursor

Checklist

  • I have read and approved the CLA.

@github-actions github-actions Bot added the first-time-contributor PR opened by an author who had not previously committed to this repository label Aug 7, 2026
@sharnam2015 sharnam2015 changed the title Sharnam mid360 relocalization Modifying relocalization and mapping for using mid360 lidar Aug 7, 2026
@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds Mid-360 voxel presets, Point-LIO replay support, relocalization metrics, native-build adjustments, and a Go2/Mid-360 visualization blueprint.

  • Adds configurable 3 cm voxel defaults for Mid-360 mapping and CLI reconstruction.
  • Replays Point-LIO lidar, odometry, and recorded TF streams through the Go2 connection.
  • Reports final ICP fitness and RMSE during relocalization.
  • Registers a Mid-360-specific visualization blueprint and adjusts portable Nix builds.

Confidence Score: 3/5

The PR is not yet safe to merge because Point-LIO replay leaves incompatible root frames and relocalization accepts transforms using a fitness metric inconsistent with its yaw-sensitive gate.

Point-LIO clouds are labeled odom while robot transforms remain rooted at world without a connecting transform, and relocalization discards wall-only fitness before applying the unchanged acceptance threshold to full-cloud fitness.

Files Needing Attention: dimos/robot/unitree/go2/connection.py, dimos/mapping/relocalization/relocalize.py, dimos/mapping/relocalization/module.py

Important Files Changed

Filename Overview
dimos/robot/unitree/go2/connection.py Adds Point-LIO replay decoding and TF replay, but the cloud root remains disconnected from the configured world-rooted robot transforms.
dimos/mapping/relocalization/relocalize.py Adds RMSE reporting while replacing the wall-sensitive returned fitness with full-cloud fitness, leaving the acceptance metric inconsistent.
dimos/mapping/relocalization/module.py Consumes and logs the new RMSE value but continues applying the existing threshold to the changed fitness metric.
dimos/mapping/voxels/module.py Resolves voxel size from explicit configuration or the new process-wide lidar preset.
dimos/robot/unitree/go2/blueprints/basic/unitree_mid360_basic.py Adds a Mid-360 visualization and connection blueprint; it does not itself deploy a voxel mapper.
dimos/hardware/sensors/lidar/livox/cpp/flake.nix Adds a writable unpack phase intended to support nix-portable/proot builds.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    REC[Point-LIO recording] --> DEC[Replay decoder]
    DEC --> CLOUD[Cloud labeled odom]
    REC --> ODOM[Point-LIO odometry]
    ODOM --> BASE[world to base_link TF]
    REC --> STF[Recorded odom to mid360_link TF]
    CLOUD --> MAP[Voxel mapping and relocalization]
    STF --> TF[TF consumers]
    BASE --> TF
    CLOUD -. missing world to odom bridge .-> TF
    MAP --> ICP[Wall candidate scoring]
    ICP --> FULL[Full-cloud final ICP]
    FULL --> GATE[Fitness threshold gate]
Loading

Reviews (2): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile

Comment on lines +263 to +273
tf = Transform.from_pose(
cloud.frame_id,
PoseStamped(
ts=cloud.ts,
frame_id="odom",
position=pose.position,
orientation=pose.orientation,
),
)
out = cloud.transform(tf)
out.frame_id = "odom"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Point-LIO replay loses its root frame

When replaying a dataset recorded with Point-LIO rooted at world, this decoder applies the world-relative observation pose but unconditionally labels the resulting cloud as odom. The replay then publishes world→base_link and recorded world→mid360_link transforms without a world→odom bridge, causing TF-based consumers and visualization to place the lidar in a disconnected or incorrect frame relative to the robot.

Knowledge Base Used: Launching Robots via the CLI and Hardware Vendor Integration

Comment on lines 223 to +237
@@ -231,4 +234,4 @@ def fine_fitness(T: np.ndarray) -> float:
tukey,
_reg.ICPConvergenceCriteria(max_iteration=50),
)
return np.asarray(final.transformation), best_fit
return np.asarray(final.transformation), float(final.fitness), float(final.inlier_rmse)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Full-cloud fitness breaks pose gating

In indoor scenes where floor or ceiling points dominate, returning final.fitness lets horizontal-plane matches inflate the value even when a candidate's walls have the wrong yaw. RelocalizationModule compares this new metric against the unchanged threshold calibrated for wall-only fitness, causing incorrect world-to-map transforms to be accepted or valid transforms to be rejected.

Comment on lines +131 to +141
unitree_mid360_basic = (
autoconnect(
_with_vis,
GO2Connection.blueprint(),
).global_config(n_workers=4, robot_model="unitree_go2")
# we temporarily disabled sensor timestamps
# and are derriving all timestmaps upon reception
# this is because image webrtc stream doesn't have timestamps,
# so it's difficult to corelate the streams otherwise
#
# .configurators(ClockSyncConfigurator())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Mid-360 preset remains disabled

Launching unitree-mid360-basic leaves GlobalConfig.lidar_config at default because this blueprint never selects mid360. Mappers that inherit the global preset therefore resolve to 5 cm voxels instead of the new 3 cm Mid-360 setting, so choosing the Mid-360 blueprint does not activate the advertised denser mapping behavior.

Knowledge Base Used:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first-time-contributor PR opened by an author who had not previously committed to this repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant