-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix shape recognition orientation edge case (#2229)
This PR augments the inner map key (from `Cosmic Location` to `(Cosmic Location, AbsoluteDir)`) for the `foundByName` field in the recognition registry to account for a shape that may have two non-overlapping orientations placed at the same coordinate. ## Testing ``` scripts/test/run-tests.sh --test-options '--pattern "structure"' ``` ## Other changes and refactoring * Enhanced logging: add a new constructor for logging that indicates which shape (if any) was recognized * Extract the inner logic from `entityModified` into a function `entityModifiedLoggable` that does not dictate the logging structure * Introduce a new `RecognitionActiveStatus` parameter that allows API users to temporarily disable recognition of "contained" structures while constructing larger structures * Inline the `registerBestStructureMatch` function
- Loading branch information
Showing
7 changed files
with
126 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
60 changes: 60 additions & 0 deletions
60
...ios/Testing/1575-structure-recognizer/2229-position-uniqueness-multiple-orientations.yaml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
version: 1 | ||
name: Structure recognition - rotated structures at same position | ||
description: | | ||
A map keyed by (position, structure name) would not be sufficient to | ||
account for multiple orientations of the same structure, sharing the | ||
same top-left corner position. | ||
This is why the found structure registry must include orientation | ||
in its key. | ||
creative: false | ||
objectives: | ||
- teaser: Recognize both structures | ||
goal: | ||
- | | ||
Two `thingy`{=structure} structures should be recognized immediately. | ||
Without distinguishing them by orientation in the registry, only | ||
one would be recognized. | ||
condition: | | ||
foundStructure <- structure "thingy" 0; | ||
return $ case foundStructure | ||
(\_. false) | ||
(\result. fst result == 2); | ||
robots: | ||
- name: base | ||
dir: north | ||
devices: | ||
- logger | ||
solution: | | ||
noop; | ||
structures: | ||
- name: thingy | ||
recognize: [north, east] | ||
structure: | ||
palette: | ||
'x': [stone, rock] | ||
'y': [dirt] | ||
mask: '.' | ||
map: | | ||
y.y | ||
yxx | ||
known: [rock] | ||
world: | ||
dsl: | | ||
{blank} | ||
placements: | ||
- src: thingy | ||
- src: thingy | ||
offset: [0, 0] | ||
orient: | ||
up: east | ||
palette: | ||
'.': [grass, erase] | ||
'B': [grass, erase, base] | ||
upperleft: [-3, 3] | ||
map: | | ||
.........B. | ||
........... | ||
........... | ||
........... | ||
........... |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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