open-rmf / rmf_site

Experimental visualizer for dense buildings in RMF
32 stars 13 forks source link

Add level fiducials to reference drawing features #164

Closed luca-della-vedova closed 1 year ago

luca-della-vedova commented 1 year ago

Bug fix

Fixed bug

This PR fixes map alignment when importing legacy projects that include a list of features / constraints but no fiducials, a typical case is a building with only one level (hence no fiducials) but one or more robot maps (hence the sets of constraints and features).

Fix applied

Previously, no level anchors were spawned so the optimization ran during map alignment would also transform the reference drawing and find an average of all the drawings. With this PR, level anchors are spawned and added to the fiducials in the position where the reference drawing is. The result is that the reference drawing will be "sticky" and stay in its original position with only the imported robot layers being translated.

I had to increase the scope of the reference drawing site id which required wrapping it in an Option to handle the "no reference drawing" case. This added a few (safe) boilerplate unwraps.

Before this PR:

Screencast from 2023-08-17 10-54-01.webm

After this PR:

Screencast from 2023-08-17 12-41-16.webm