Skip to content

Commit 13e86e7

Browse files
fix: align docked Q10 robot position
1 parent 3eddd11 commit 13e86e7

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

roborock/map/b01_q10_render.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,15 @@ def _place_charger_from_header(
259259
map_data: MapData,
260260
packet: Q10MapPacket,
261261
) -> bool:
262-
"""Place the saved dock using its absolute header pixel coordinates."""
262+
"""Place the saved dock using its absolute header pixel coordinates.
263+
264+
The Q10 header angle follows the dock axis, while the shared V1 marker
265+
expects the outward-facing normal, so rotate it by 90 degrees.
266+
"""
263267
header = packet.header_calibration
264268
if header is None or (position := header.charger_pixels()) is None:
265269
return False
266-
map_data.charger = Point(*position, -header.charger_phi)
270+
map_data.charger = Point(*position, 90 - header.charger_phi)
267271
return True
268272

269273

tests/map/test_b01_q10_render.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,13 @@ def test_render_draws_dock_from_header_without_trace() -> None:
164164

165165

166166
def test_place_charger_uses_absolute_header_pixels() -> None:
167-
"""The dock coordinates do not receive the world origin a second time."""
167+
"""The dock uses absolute pixels and converts its axis to a V1 heading."""
168168
packet = replace(_packet(), header_calibration=HEADER)
169169
map_data = MapData()
170170

171171
assert _place_charger_from_header(map_data, packet)
172172

173-
assert map_data.charger == Point(3, 3, -90)
173+
assert map_data.charger == Point(3, 3, 0)
174174

175175

176176
def test_place_docked_robot_uses_shared_v1_marker_geometry() -> None:

0 commit comments

Comments
 (0)