Skip to content

feat: decode Q10 map geometry metadata - #881

Merged
allenporter merged 3 commits into
Python-roborock:mainfrom
tubededentifrice:agent/q10-map-decoding
Jul 19, 2026
Merged

feat: decode Q10 map geometry metadata#881
allenporter merged 3 commits into
Python-roborock:mainfrom
tubededentifrice:agent/q10-map-decoding

Conversation

@tubededentifrice

@tubededentifrice tubededentifrice commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Extracts the low-level, independently reviewable map decoding work from #848. The original PR remains open and unchanged as a reference.

Changes

  • Decode Q10 grid-header calibration metadata and trace heading.
  • Decode erase zones and carpet masks from map packet tails.
  • Correct virtual-wall framing and axis ordering, with live-capture coverage.
  • Add device-agnostic fixed-origin calibration support and Q10 grid decomposition helpers.

This PR intentionally contains no trait, API orchestration, rendering-composition, or CLI changes.

Validation

  • uv run pytest tests/map/test_b01_q10_map_parser.py tests/devices/traits/b01/q10/test_map.py — 39 passed
  • The complete split stack passes uv run pytest — 802 passed
  • uv run pre-commit run --show-diff-on-failure --color=always --all-files

Stack

  1. This low-level decoding PR
  2. Pure Q10 renderer
  3. Low-level DPS trait + high-level map content trait

Q7 reuse is proposed independently and does not block the Q10 stack.

@tubededentifrice
tubededentifrice marked this pull request as ready for review July 19, 2026 15:58
_WALL_RECORD_SIZE = 8 # two (x, y) int16-BE endpoints


def parse_virtual_wall_blob(data: bytes | str | None) -> list[Q10Zone]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pick either bytes or str and not both?

ox, oy = origin
classify = layers.classifier
# 1 = floor, 2 = wall/background (blocked), 0 = other. Index by cell.
klass = bytes(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about (1) lets go ahead and unroll this since its pretty hard to read as one line and (2) Make enums or constants to self document these magic numbers?

(When i read this line klass looks like a single byte, but then below i see it being accessed like a 2d array, so having trouble following)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I just read the other code and see this is the same. OK maybe we just do the cleanup later.

return LAYER_FLOOR


def decompose_layers(packet: "Q10MapPacket") -> GridLayers:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work as a @property on Q10MapPacket?

],
)
def test_classify_q10_cell(value: int, expected: str) -> None:
assert classify_q10_cell(value) == expected

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is in the map module, not the grid layers module so testing for it should be in the map module. Here and below with decompose_layers as well

@allenporter
allenporter merged commit d2b6822 into Python-roborock:main Jul 19, 2026
7 checks passed
@allenporter

Copy link
Copy Markdown
Contributor

I'm going to merge and we can tackle cleanups in additional follow up PRs.

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