valetudo-map-parser 0.1.9a4__py3-none-any.whl → 0.1.9a5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- valetudo_map_parser/rand25_handler.py +86 -11
- {valetudo_map_parser-0.1.9a4.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/METADATA +1 -1
- {valetudo_map_parser-0.1.9a4.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/RECORD +6 -6
- {valetudo_map_parser-0.1.9a4.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9a4.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9a4.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/WHEEL +0 -0
@@ -231,8 +231,8 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
231
231
|
if not self.rooms_pos and not self.room_propriety:
|
232
232
|
self.room_propriety = await self.get_rooms_attributes(destinations)
|
233
233
|
|
234
|
-
# Always check robot position for zooming
|
235
|
-
if self.rooms_pos and robot_position:
|
234
|
+
# Always check robot position for zooming (fallback)
|
235
|
+
if self.rooms_pos and robot_position and not hasattr(self, 'robot_pos'):
|
236
236
|
self.robot_pos = await self.async_get_robot_in_room(
|
237
237
|
(robot_position[0] * 10),
|
238
238
|
(robot_position[1] * 10),
|
@@ -248,6 +248,68 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
248
248
|
size_x, size_y, background_color
|
249
249
|
)
|
250
250
|
self.img_base_layer = await self.async_copy_array(img_np_array)
|
251
|
+
|
252
|
+
# Check active zones BEFORE auto-crop to enable proper zoom functionality
|
253
|
+
# This needs to run on every frame, not just frame 0
|
254
|
+
if (
|
255
|
+
self.shared.image_auto_zoom
|
256
|
+
and self.shared.vacuum_state == "cleaning"
|
257
|
+
and robot_position
|
258
|
+
and destinations # Check if we have destinations data for room extraction
|
259
|
+
):
|
260
|
+
_LOGGER.debug(
|
261
|
+
"%s: Attempting early room extraction for active zone checking",
|
262
|
+
self.file_name
|
263
|
+
)
|
264
|
+
# Extract room data early if we have destinations
|
265
|
+
try:
|
266
|
+
temp_room_properties = await self.rooms_handler.async_extract_room_properties(
|
267
|
+
m_json, destinations
|
268
|
+
)
|
269
|
+
if temp_room_properties:
|
270
|
+
# Create temporary rooms_pos for robot room detection
|
271
|
+
temp_rooms_pos = []
|
272
|
+
for room_id, room_data in temp_room_properties.items():
|
273
|
+
temp_rooms_pos.append(
|
274
|
+
{"name": room_data["name"], "outline": room_data["outline"]}
|
275
|
+
)
|
276
|
+
|
277
|
+
# Store original rooms_pos and temporarily use the new one
|
278
|
+
original_rooms_pos = self.rooms_pos
|
279
|
+
self.rooms_pos = temp_rooms_pos
|
280
|
+
|
281
|
+
# Perform robot room detection to check active zones
|
282
|
+
robot_room_result = await self.async_get_robot_in_room(
|
283
|
+
robot_position[0], robot_position[1], robot_position_angle
|
284
|
+
)
|
285
|
+
|
286
|
+
# Restore original rooms_pos
|
287
|
+
self.rooms_pos = original_rooms_pos
|
288
|
+
|
289
|
+
_LOGGER.debug(
|
290
|
+
"%s: Early robot room detection for zoom: robot in %s, zooming=%s",
|
291
|
+
self.file_name,
|
292
|
+
robot_room_result.get("in_room", "unknown"),
|
293
|
+
self.zooming
|
294
|
+
)
|
295
|
+
except Exception as e:
|
296
|
+
_LOGGER.debug(
|
297
|
+
"%s: Early room extraction failed: %s, falling back to robot-position zoom",
|
298
|
+
self.file_name,
|
299
|
+
e
|
300
|
+
)
|
301
|
+
# Fallback to robot-position-based zoom if room extraction fails
|
302
|
+
if (
|
303
|
+
self.shared.image_auto_zoom
|
304
|
+
and self.shared.vacuum_state == "cleaning"
|
305
|
+
and robot_position
|
306
|
+
):
|
307
|
+
self.zooming = True
|
308
|
+
_LOGGER.debug(
|
309
|
+
"%s: Enabling fallback robot-position-based zoom",
|
310
|
+
self.file_name
|
311
|
+
)
|
312
|
+
|
251
313
|
return self.img_base_layer, robot_position, robot_position_angle
|
252
314
|
|
253
315
|
async def _draw_map_elements(
|
@@ -294,19 +356,32 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
294
356
|
img_np_array, robot_position, robot_position_angle, robot_color
|
295
357
|
)
|
296
358
|
|
297
|
-
#
|
298
|
-
|
299
|
-
|
359
|
+
# Store robot position for potential zoom function use
|
360
|
+
if robot_position:
|
361
|
+
self.robot_position = robot_position
|
362
|
+
|
363
|
+
# Check if zoom should be enabled based on active zones
|
300
364
|
if (
|
301
365
|
self.shared.image_auto_zoom
|
302
366
|
and self.shared.vacuum_state == "cleaning"
|
303
|
-
and robot_position
|
304
|
-
and not self.zooming # Not already enabled
|
367
|
+
and robot_position
|
305
368
|
):
|
306
|
-
#
|
307
|
-
|
308
|
-
|
309
|
-
|
369
|
+
# For Rand256, we need to check active zones differently since room data is not available yet
|
370
|
+
# Use a simplified approach: enable zoom if any active zones are set
|
371
|
+
active_zones = self.shared.rand256_active_zone
|
372
|
+
if active_zones and any(zone for zone in active_zones):
|
373
|
+
self.zooming = True
|
374
|
+
_LOGGER.debug(
|
375
|
+
"%s: Enabling zoom for Rand256 - active zones detected: %s",
|
376
|
+
self.file_name,
|
377
|
+
active_zones
|
378
|
+
)
|
379
|
+
else:
|
380
|
+
self.zooming = False
|
381
|
+
_LOGGER.debug(
|
382
|
+
"%s: Zoom disabled for Rand256 - no active zones set",
|
383
|
+
self.file_name
|
384
|
+
)
|
310
385
|
|
311
386
|
img_np_array = await self.async_auto_trim_and_zoom_image(
|
312
387
|
img_np_array,
|
@@ -17,11 +17,11 @@ valetudo_map_parser/hypfer_handler.py,sha256=xekDAFZMDBaErDchpGJY3ALIscUNbId9gR5
|
|
17
17
|
valetudo_map_parser/hypfer_rooms_handler.py,sha256=NkpOA6Gdq-2D3lLAxvtNuuWMvPXHxeMY2TO5RZLSHlU,22652
|
18
18
|
valetudo_map_parser/map_data.py,sha256=3CG3l_fWeEwWCT5j9nfnqPuClU01m7exwuYWV3K9jIk,18618
|
19
19
|
valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
|
-
valetudo_map_parser/rand25_handler.py,sha256=
|
20
|
+
valetudo_map_parser/rand25_handler.py,sha256=5iiF2J4LDiV4QCC9K7FIb24ezvVecZZ7-mT8KNdSCHM,27079
|
21
21
|
valetudo_map_parser/reimg_draw.py,sha256=1q8LkNTPHEA9Tsapc_JnVw51kpPYNhaBU-KmHkefCQY,12507
|
22
22
|
valetudo_map_parser/rooms_handler.py,sha256=YP8OLotBH-RXluv398l7TTT2zIBHJp91b8THWxl3NdI,17794
|
23
|
-
valetudo_map_parser-0.1.
|
24
|
-
valetudo_map_parser-0.1.
|
25
|
-
valetudo_map_parser-0.1.
|
26
|
-
valetudo_map_parser-0.1.
|
27
|
-
valetudo_map_parser-0.1.
|
23
|
+
valetudo_map_parser-0.1.9a5.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
|
24
|
+
valetudo_map_parser-0.1.9a5.dist-info/METADATA,sha256=79_OWGKVat6lwL24wVMN3FnDHPiXqqSpAHp_WKEcfPI,3320
|
25
|
+
valetudo_map_parser-0.1.9a5.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
|
26
|
+
valetudo_map_parser-0.1.9a5.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
27
|
+
valetudo_map_parser-0.1.9a5.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|