Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix level alignment when levels have no measurements #212

Merged
merged 1 commit into from
Apr 9, 2024

Conversation

luca-della-vedova
Copy link
Member

Bug fix

Fixed bug

Legacy traffic editor allows having levels with no measurements, it actually only uses measurements for the reference level and uses fiducials instead to compute the transform between other levels and the reference.
The code path would do a divide by 0 if there was a level with no measurements and result in a NaN alignment / silent failure in importing the project.

Fix applied

This PR makes sure we don't divide by 0 and initializes the scale to the same "sensible" default that is used in traffic editor (5 cm per pixel).

To test it, try to run the site editor and import https://github.com/open-rmf/roscon_workshop/blob/main/roscon_maps/maps/workshop/workshop.building.yaml before and after this PR. The first will panic (panic is actually caused by an external library when we pass it NaN values, not the site editor), with the PR it should load correctly.

I checked and the map seems to be imported with the same scale as traffic editor after the fix.

Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
@mxgrey mxgrey merged commit 1f331d7 into main Apr 9, 2024
5 checks passed
@mxgrey mxgrey deleted the luca/fix_nan_alignment branch April 9, 2024 07:21
reuben-thomas pushed a commit to reuben-thomas/rmf_site that referenced this pull request Jun 17, 2024
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
Signed-off-by: Reuben Thomas <reubenthomas123@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants