Skip to content

Commit 1628aca

Browse files
andigclaude
andcommitted
feat: render Q7 restricted areas
Project areaInfo zone polygons into pixel space and draw them through the shared no-go drawable. Per-kind type mapping (no-go vs no-mop) is left for when more zone samples are available. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent e0dea2a commit 1628aca

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

roborock/map/b01_map_parser.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from vacuum_map_parser_base.config.color import ColorsPalette, SupportedColor
1515
from vacuum_map_parser_base.config.drawable import Drawable
1616
from vacuum_map_parser_base.config.image_config import ImageConfig
17-
from vacuum_map_parser_base.map_data import ImageData, MapData, Path, Point, Room
17+
from vacuum_map_parser_base.map_data import Area, ImageData, MapData, Path, Point, Room
1818

1919
from roborock.exceptions import RoborockException
2020
from roborock.map.proto.b01_scmap_pb2 import RobotMap # type: ignore[attr-defined]
@@ -29,6 +29,7 @@
2929

3030
_B01_DRAWABLES = [
3131
Drawable.CHARGER,
32+
Drawable.NO_GO_AREAS,
3233
Drawable.PATH,
3334
Drawable.ROOM_NAMES,
3435
Drawable.VACUUM_POSITION,
@@ -164,6 +165,17 @@ def _place_poses(map_data: MapData, parsed: RobotMap, projector: _WorldToPixel)
164165
# A saved map carries no live pose; show the robot at its dock.
165166
map_data.vacuum_position = Point(map_data.charger.x, map_data.charger.y, map_data.charger.a)
166167

168+
areas = [
169+
Area(*(coord for point in area.points for coord in projector.to_pixel(point.x, point.y)))
170+
for area in parsed.areaInfo
171+
if len(area.points) == 4
172+
]
173+
if areas:
174+
# areaInfo type semantics are not yet mapped per zone kind; render all
175+
# restricted areas through the no-go drawable for now.
176+
map_data.no_go_areas = areas
177+
has_drawables = True
178+
167179
if parsed.HasField("historyPose"):
168180
pixels = [
169181
Point(*projector.to_pixel(point.x, point.y))

0 commit comments

Comments
 (0)