feat: decode Q10 (03 01) saved-map obstacle markers#1
Draft
tubededentifrice wants to merge 2 commits into
Draft
Conversation
Saved-map frames (marker `03 01`) share the current-map (`01 01`) header/grid/room layout but append an obstacle-marker section to the tail, after the carpet block: `[count:u8]` then `count` int16-BE (x, y) pairs in raw obstacle coordinates. - Parse `03 01` frames (`is_saved_map_packet`; `parse_map_packet` now accepts both markers) and decode the obstacle section into `Q10MapPacket.obstacles`. Located after a validated carpet block, so a frame without one decodes no obstacles rather than misreading the tail. - Place obstacles onto `MapData.obstacles` in `render_q10_map` using a fixed header-anchored scale (`col = ox/10 + x/50`, `row = oy/10 - y/50`, resolution 50 around the header pixel origin) -- independent of the fitted path calibration, so they appear as soon as the saved map arrives. - Route `03 01` through the protocol dispatch; the map trait needs no change. Fixtures + byte-level decode ground-truthed against two real ss07 captures shared by @andrewlyeats (2- and 53-obstacle frames, map id zeroed): obstacle raw (-4633, -1946) with header origin (1651, 434) lands at grid px (72.4, 82.3), matching his expected decode. Follow-ups (not in this PR): the trailing 17-byte-header path package and the skip-clean section that also live in the `03 01` tail.
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.
Draft / stacked on Python-roborock#848 — builds on the
q10-map-layersrender pipeline (render_q10_map/MapDataplacement). Base isq10-map-layersso this diff shows only the obstacle work; retarget tomainonce Python-roborock#848 merges.Implements the obstacle-layer follow-up @andrewlyeats offered in #848 (gist: https://gist.github.com/andrewlyeats/6c0c5892ab61e6d1c75d4c42c9202903).
What
Saved-map frames (marker
03 01) share the current-map (01 01) header/grid/room layout but append an obstacle-marker section to the tail, after the carpet block:03 01frames —is_saved_map_packet();parse_map_packet()now accepts both markers — and decode the obstacle section intoQ10MapPacket.obstacles. Obstacles are located immediately after a validated carpet block (sameuncompressed_len == w*hguard as the carpet parser), so a frame without one decodes no obstacles rather than misreading the tail.MapData.obstaclesinrender_q10_map, using the fixed header-anchored obstacle scale (col = ox/10 + x/50,row = oy/10 − y/50→ aGridCalibration(resolution=50, origin=header.origin_pixels())). This is independent of the fitted path calibration, so obstacles show up as soon as the saved map arrives (no clean required).03 01through the protocol dispatch; the map trait needs no change (obstacles flow through the existingQ10MapPacketpath).Provenance / fixtures
Byte-level decode ground-truthed against two real ss07 captures @andrewlyeats shared (map id zeroed, rest as-captured), added as fixtures:
b01_q10_saved_map_2obstacles.bin— 2 obstacles; headerW=219 H=254 ox=1651 oy=434 res=5b01_q10_saved_map_53obstacles.bin— 53 obstaclesHis expected decode reproduces exactly: raw
(-4633, -1946)→ grid px(72.4, 82.3), raw(-5231, -3852)→(60.5, 120.4).Tests
Parser (marker recognition, 2/53 obstacle decode, synthetic tail, no-carpet defensiveness), render (placement at the expected pixels, keepalive-header no-op), protocol dispatch.
pre-commit(ruff + mypy) clean; full suite green.Not in this PR (follow-ups)
The
03 01tail also carries the skip-clean section and the trailing path package (17-byte header + int16(x, y)points, same geometry as02 01). Left for a follow-up to keep this focused on obstacles.