Prevent double-transform of prior-session keyframes during map load#23
Draft
Prevent double-transform of prior-session keyframes during map load#23
Conversation
Co-authored-by: JokerJohn <25702851+JokerJohn@users.noreply.github.com> Agent-Logs-Url: https://github.com/JokerJohn/MS-Mapping/sessions/1f69dbc5-9352-477c-ab74-baccffa678e2
Copilot
AI
changed the title
[WIP] Fix map misalignment in prior map alignment
Prevent double-transform of prior-session keyframes during map load
Mar 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multi-session runs showed near-overlap but persistent local misalignment and unstable cross-session loop registration. The issue path is consistent with prior-session local maps being constructed from clouds that were no longer in their original LiDAR frame.
Root cause addressed: cloud frame mutation in prior-map loading
DataSaver::ReadPosesAndPointCloudswas transforming each loaded keyframe cloud in place after assigning it tomeasurement.lidar.measurement.lidaris local and applies pose transforms again.Change made: preserve local-frame storage, transform only for aggregation
measurements[index].lidarunchanged (raw/local frame).cloud_worldfor global map accumulation only.Impact on multi-session behavior
Original prompt
This section details on the original issue you should resolve
<issue_title>Map misalignment and GMM map question</issue_title>
<issue_description>I had a hard time getting fastlio working correctly for some reason so I switched to using lio-sam (followed comments in #9). I created a prior map just fine, and used rviz to set the pose for the next mapping session. It completed successfully; however, I realized that the map alignment isn't correct in a few places. It's close but not quite there. Is this expected?
Also, as seen in the above image and in the images in the tutorial section. Points are added to the prior map for more than just new objects (e.g. ground points). From the paper, I thought that the GMM idea was that only points that were significantly different from the prior map would be added, but this isn't what I'm seeing in practice. Am I misunderstanding something?</issue_description>
<agent_instructions>check if this problem exits?</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@JokerJohn Hi @bboyack,I think this issue may be related to the accuracy of LIO. I suggest trying Fast-LIO2 first to rule it out. When adapting Fast-LIO2, the key point is to ensure that the timestamps of points in the handler function are in milliseconds and fall within the range 0–100 ms.
Regarding your GMM module, I’m not sure how it has been implemented, so it’s difficult to trace the exact cause of the problem you mentioned. Theoretically, frames that have significant difference with the prior map should be treated as redundant and thus not used in the merged map.</comment_new>
<comment_new>@JokerJohn
Hi, @bboyack
I understand your issue now. The problem stems from pose errors in the initial frame of session 2, which leads to poor alignment. I suggest checking the following configurations:
If all the above are satisfactory and the problem persists, it indicates that the pose graph optimization hasn't properly adjusted the constraint edges at the starting point of session 2.
This occurs because the code directly applies odometry noise (1e-6, 1e-4) to construct relative constraints between the starting point and session 1's old pose graph. The system places high trust in this relative pose and therefore makes minimal adjustments. You can modify this to use loop closure noise (my default setting is 1e-2, 1e-2), allowing the graph optimization to adjust this constraint with loop closure weights.
auto LOOPGaussianNoise = noiseModel::Diagonal::Sigmas((Vector(6) << 0.1, 0.1, 0.1, 0.1, 0.1, 0.1).finished());Additionally, there's an alternative approach: if you have high confidence in the initial pose, you can directly use M2F mode, which will fix session 2's initial point. The drawback is that the overall map consistency may not be as good.
@JokerJohn @bboyackAfter reviewing your log, I've found several issues:
initial_poseby manually aligning session 2's first frame with session 1's map using CloudCompare (this process is described in the tutorial, you can find this two point cloud in the results folder).I also notice some issues with your Fast-LIO parameter settings. I recommend configuring: