valetudo-map-parser 0.1.9a3__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/config/auto_crop.py +27 -16
- valetudo_map_parser/rand25_handler.py +86 -11
- {valetudo_map_parser-0.1.9a3.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/METADATA +1 -1
- {valetudo_map_parser-0.1.9a3.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/RECORD +7 -7
- {valetudo_map_parser-0.1.9a3.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9a3.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9a3.dist-info → valetudo_map_parser-0.1.9a5.dist-info}/WHEEL +0 -0
@@ -186,22 +186,33 @@ class AutoCrop:
|
|
186
186
|
try:
|
187
187
|
# For Hypfer vacuums, check room_propriety first, then rooms_pos
|
188
188
|
if hasattr(self.handler, 'room_propriety') and self.handler.room_propriety:
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
189
|
+
# Handle different room_propriety formats
|
190
|
+
room_data_dict = None
|
191
|
+
|
192
|
+
if isinstance(self.handler.room_propriety, dict):
|
193
|
+
# Hypfer handler: room_propriety is a dictionary
|
194
|
+
room_data_dict = self.handler.room_propriety
|
195
|
+
elif isinstance(self.handler.room_propriety, tuple) and len(self.handler.room_propriety) >= 1:
|
196
|
+
# Rand256 handler: room_propriety is a tuple (room_properties, zone_properties, point_properties)
|
197
|
+
room_data_dict = self.handler.room_propriety[0]
|
198
|
+
|
199
|
+
if room_data_dict and isinstance(room_data_dict, dict):
|
200
|
+
for room_id, room_data in room_data_dict.items():
|
201
|
+
if room_data.get('name') == room_name:
|
202
|
+
outline = room_data.get('outline', [])
|
203
|
+
if outline:
|
204
|
+
xs, ys = zip(*outline)
|
205
|
+
left, right = min(xs), max(xs)
|
206
|
+
up, down = min(ys), max(ys)
|
207
|
+
|
208
|
+
if rand256:
|
209
|
+
# Apply scaling for rand256 vacuums
|
210
|
+
left = round(left / 10)
|
211
|
+
right = round(right / 10)
|
212
|
+
up = round(up / 10)
|
213
|
+
down = round(down / 10)
|
214
|
+
|
215
|
+
return left, right, up, down
|
205
216
|
|
206
217
|
# Fallback: check rooms_pos (used by both Hypfer and Rand256)
|
207
218
|
if hasattr(self.handler, 'rooms_pos') and self.handler.rooms_pos:
|
@@ -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,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
valetudo_map_parser/__init__.py,sha256=Fz-gtKf_OlZcDQqVfGlBwIWi5DJAiRucMbBMdQ2tX_U,1060
|
2
2
|
valetudo_map_parser/config/__init__.py,sha256=DQ9plV3ZF_K25Dp5ZQHPDoG-40dQoJNdNi-dfNeR3Zc,48
|
3
|
-
valetudo_map_parser/config/auto_crop.py,sha256=
|
3
|
+
valetudo_map_parser/config/auto_crop.py,sha256=m3D1EtsxiBpp4DUwymLVlLYOEX0-Lk7j8t0rxQNFpjQ,18757
|
4
4
|
valetudo_map_parser/config/color_utils.py,sha256=nXD6WeNmdFdoMxPDW-JFpjnxJSaZR1jX-ouNfrx6zvE,4502
|
5
5
|
valetudo_map_parser/config/colors.py,sha256=DG-oPQoN5gsnwDbEsuFr8a0hRCxmbFHObWa4_5pr-70,29910
|
6
6
|
valetudo_map_parser/config/drawable.py,sha256=2MeVHXqZuVuJk3eerMJYGwo25rVetHx3xB_vxecEFOQ,34168
|
@@ -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
|