valetudo-map-parser 0.1.9b100__py3-none-any.whl → 0.1.10b1__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/drawable.py +42 -59
- valetudo_map_parser/map_data.py +1 -1
- {valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/METADATA +1 -1
- {valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/RECORD +7 -7
- {valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/WHEEL +0 -0
@@ -545,95 +545,78 @@ class Drawable:
|
|
545
545
|
angle: float,
|
546
546
|
fill: Color,
|
547
547
|
robot_state: str | None = None,
|
548
|
+
radius: int = 25 # user-configurable
|
548
549
|
) -> NumpyArray:
|
549
550
|
"""
|
550
|
-
Draw the robot
|
551
|
-
Optimized with NumPy vectorized operations for better performance.
|
551
|
+
Draw the robot with configurable size. All elements scale with radius.
|
552
552
|
"""
|
553
|
-
#
|
553
|
+
# Minimum radius to keep things visible
|
554
|
+
radius = max(8, min(radius, 25))
|
555
|
+
|
554
556
|
height, width = layers.shape[:2]
|
555
557
|
if not (0 <= x < width and 0 <= y < height):
|
556
558
|
return layers
|
557
|
-
|
558
|
-
#
|
559
|
-
|
560
|
-
box_size = radius * 2 + 2 # Add a small margin
|
561
|
-
|
562
|
-
# Calculate the region to draw on
|
559
|
+
|
560
|
+
# Bounding box
|
561
|
+
box_size = radius * 2 + 2
|
563
562
|
top_left_x = max(0, x - radius - 1)
|
564
563
|
top_left_y = max(0, y - radius - 1)
|
565
564
|
bottom_right_x = min(width, x + radius + 1)
|
566
565
|
bottom_right_y = min(height, y + radius + 1)
|
567
|
-
|
568
|
-
# Skip if the robot is completely outside the image
|
566
|
+
|
569
567
|
if top_left_x >= bottom_right_x or top_left_y >= bottom_right_y:
|
570
568
|
return layers
|
571
|
-
|
572
|
-
# Create a temporary layer for the robot
|
569
|
+
|
573
570
|
tmp_width = bottom_right_x - top_left_x
|
574
571
|
tmp_height = bottom_right_y - top_left_y
|
575
572
|
tmp_layer = layers[top_left_y:bottom_right_y, top_left_x:bottom_right_x].copy()
|
576
|
-
|
577
|
-
# Calculate the robot center in the temporary layer
|
573
|
+
|
578
574
|
tmp_x = x - top_left_x
|
579
575
|
tmp_y = y - top_left_y
|
580
|
-
|
581
|
-
#
|
582
|
-
r_scaled = radius
|
583
|
-
r_cover
|
576
|
+
|
577
|
+
# All geometry proportional to radius
|
578
|
+
r_scaled = max(1, radius / 11.0)
|
579
|
+
r_cover = int(r_scaled * 12)
|
580
|
+
r_lidar = max(1, int(r_scaled * 3))
|
581
|
+
r_button = max(1, int(r_scaled * 1))
|
582
|
+
lidar_offset = int(radius * 0.6) # was fixed 15
|
583
|
+
button_offset = int(radius * 0.8) # was fixed 20
|
584
|
+
|
584
585
|
lidar_angle = np.deg2rad(angle + 90)
|
585
|
-
|
586
|
-
r_button = r_scaled * 1
|
587
|
-
|
588
|
-
# Set colors based on robot state
|
586
|
+
|
589
587
|
if robot_state == "error":
|
590
588
|
outline = Drawable.ERROR_OUTLINE
|
591
589
|
fill = Drawable.ERROR_COLOR
|
592
590
|
else:
|
593
591
|
outline = (fill[0] // 2, fill[1] // 2, fill[2] // 2, fill[3])
|
594
|
-
|
595
|
-
#
|
596
|
-
tmp_layer = Drawable._filled_circle(
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
# Draw the robot direction indicator
|
592
|
+
|
593
|
+
# Body
|
594
|
+
tmp_layer = Drawable._filled_circle(tmp_layer, (tmp_y, tmp_x), radius, fill, outline, 1)
|
595
|
+
|
596
|
+
# Direction wedge
|
601
597
|
angle -= 90
|
602
598
|
a1 = ((angle + 90) - 80) / 180 * math.pi
|
603
599
|
a2 = ((angle + 90) + 80) / 180 * math.pi
|
604
|
-
x1 = int(tmp_x - r_cover *
|
605
|
-
y1 = int(tmp_y + r_cover *
|
606
|
-
x2 = int(tmp_x - r_cover *
|
607
|
-
y2 = int(tmp_y + r_cover *
|
608
|
-
|
609
|
-
# Draw the direction line
|
610
|
-
if (
|
611
|
-
0 <= x1 < tmp_width
|
612
|
-
and 0 <= y1 < tmp_height
|
613
|
-
and 0 <= x2 < tmp_width
|
614
|
-
and 0 <= y2 < tmp_height
|
615
|
-
):
|
600
|
+
x1 = int(tmp_x - r_cover * np.sin(a1))
|
601
|
+
y1 = int(tmp_y + r_cover * np.cos(a1))
|
602
|
+
x2 = int(tmp_x - r_cover * np.sin(a2))
|
603
|
+
y2 = int(tmp_y + r_cover * np.cos(a2))
|
604
|
+
if 0 <= x1 < tmp_width and 0 <= y1 < tmp_height and 0 <= x2 < tmp_width and 0 <= y2 < tmp_height:
|
616
605
|
tmp_layer = Drawable._line(tmp_layer, x1, y1, x2, y2, outline, width=1)
|
617
|
-
|
618
|
-
#
|
619
|
-
lidar_x = int(tmp_x +
|
620
|
-
lidar_y = int(tmp_y +
|
606
|
+
|
607
|
+
# Lidar
|
608
|
+
lidar_x = int(tmp_x + lidar_offset * np.cos(lidar_angle))
|
609
|
+
lidar_y = int(tmp_y + lidar_offset * np.sin(lidar_angle))
|
621
610
|
if 0 <= lidar_x < tmp_width and 0 <= lidar_y < tmp_height:
|
622
|
-
tmp_layer = Drawable._filled_circle(
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
butt_x = int(tmp_x - 20 * np.cos(lidar_angle))
|
628
|
-
butt_y = int(tmp_y - 20 * np.sin(lidar_angle))
|
611
|
+
tmp_layer = Drawable._filled_circle(tmp_layer, (lidar_y, lidar_x), r_lidar, outline)
|
612
|
+
|
613
|
+
# Button
|
614
|
+
butt_x = int(tmp_x - button_offset * np.cos(lidar_angle))
|
615
|
+
butt_y = int(tmp_y - button_offset * np.sin(lidar_angle))
|
629
616
|
if 0 <= butt_x < tmp_width and 0 <= butt_y < tmp_height:
|
630
|
-
tmp_layer = Drawable._filled_circle(
|
631
|
-
|
632
|
-
)
|
633
|
-
|
634
|
-
# Copy the robot layer back to the main layer
|
617
|
+
tmp_layer = Drawable._filled_circle(tmp_layer, (butt_y, butt_x), r_button, outline)
|
618
|
+
|
635
619
|
layers[top_left_y:bottom_right_y, top_left_x:bottom_right_x] = tmp_layer
|
636
|
-
|
637
620
|
return layers
|
638
621
|
|
639
622
|
@staticmethod
|
valetudo_map_parser/map_data.py
CHANGED
@@ -4,7 +4,7 @@ valetudo_map_parser/config/async_utils.py,sha256=e1j9uTtg4dhPVWvB2_XgqaH4aeSjRAP
|
|
4
4
|
valetudo_map_parser/config/auto_crop.py,sha256=Aes7vfv4z8ihYvGaH5Nryj6Y9mHDerZLIeyvePjf9aQ,19259
|
5
5
|
valetudo_map_parser/config/color_utils.py,sha256=nXD6WeNmdFdoMxPDW-JFpjnxJSaZR1jX-ouNfrx6zvE,4502
|
6
6
|
valetudo_map_parser/config/colors.py,sha256=DG-oPQoN5gsnwDbEsuFr8a0hRCxmbFHObWa4_5pr-70,29910
|
7
|
-
valetudo_map_parser/config/drawable.py,sha256=
|
7
|
+
valetudo_map_parser/config/drawable.py,sha256=oiTRYA1P7XDioqbsc5WNrFgPF4xUTd0xQ_Arrd7HXYY,32788
|
8
8
|
valetudo_map_parser/config/drawable_elements.py,sha256=o-5oiXmfqPwNQLzKIhkEcZD_A47rIU9E0CqKgWipxgc,11516
|
9
9
|
valetudo_map_parser/config/enhanced_drawable.py,sha256=QlGxlUMVgECUXPtFwIslyjubWxQuhIixsRymWV3lEvk,12586
|
10
10
|
valetudo_map_parser/config/optimized_element_map.py,sha256=52BCnkvVv9bre52LeVIfT8nhnEIpc0TuWTv1xcNu0Rk,15744
|
@@ -15,13 +15,13 @@ valetudo_map_parser/config/utils.py,sha256=p_ez39FPUNXxXSOEJZ16T1eQXzNJwRJN1F30i
|
|
15
15
|
valetudo_map_parser/hypfer_draw.py,sha256=mMA0MLmV3Man47VUmj823xwyHprJJmb0nXxmutRNK58,28976
|
16
16
|
valetudo_map_parser/hypfer_handler.py,sha256=kXi7f1YGHlC3yPD6knX_8rbJCH8j7uvIOhjdG0C7_as,24061
|
17
17
|
valetudo_map_parser/hypfer_rooms_handler.py,sha256=NkpOA6Gdq-2D3lLAxvtNuuWMvPXHxeMY2TO5RZLSHlU,22652
|
18
|
-
valetudo_map_parser/map_data.py,sha256=
|
18
|
+
valetudo_map_parser/map_data.py,sha256=Ogk3SE7iiNYMdlO8aFFnKOsbrqY28DR5NekbGs_Z84M,18901
|
19
19
|
valetudo_map_parser/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
20
20
|
valetudo_map_parser/rand256_handler.py,sha256=daaSQ5ktMUYMnYxJkjS75UdBchpXVZ58HIomwHBFivs,27651
|
21
21
|
valetudo_map_parser/reimg_draw.py,sha256=LNPEW8jtf7w4R0IM9FMy3YJQzwY21isq9eLhs3ai9o8,12735
|
22
22
|
valetudo_map_parser/rooms_handler.py,sha256=ovqQtAjauAqwUNPR0aX27P2zhheQmqfaFhDE3_AwYWk,17821
|
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.10b1.dist-info/LICENSE,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
|
24
|
+
valetudo_map_parser-0.1.10b1.dist-info/METADATA,sha256=YcpN77ru36Y02pGm3KgRU9bcHCTtbDaYZtvYAEZGuFI,3321
|
25
|
+
valetudo_map_parser-0.1.10b1.dist-info/NOTICE.txt,sha256=5lTOuWiU9aiEnJ2go8sc7lTJ7ntMBx0g0GFnNrswCY4,2533
|
26
|
+
valetudo_map_parser-0.1.10b1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
27
|
+
valetudo_map_parser-0.1.10b1.dist-info/RECORD,,
|
File without changes
|
{valetudo_map_parser-0.1.9b100.dist-info → valetudo_map_parser-0.1.10b1.dist-info}/NOTICE.txt
RENAMED
File without changes
|
File without changes
|