set sound speed
@RaulTrombin đang làm issue này rồi.
Từ ngày 12/2/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Hi
i try to set the speed of the sound but it's not working.
from brping import Ping1D
# ---------- Configuration ----------
PORT = "/dev/serial0"
BAUDRATE = 115200
SOUND_SPEED_MS = 1447 # à adapter à ton milieu
# -----------------------------------
# Timestamp à l'initialisation
start_time = datetime.now()
FILENAME = f"ping_depth_{start_time.strftime('%Y%m%d_%H%M%S')}.csv"
myPing = Ping1D()
myPing.connect_serial(PORT, BAUDRATE)
rg = myPing.get_profile()
print(f"get_profile: {rg}")
# Conversion en mm/s pour Ping1D
SOUND_SPEED_MM_S = 1450000 # exemple
ok = myPing.set_speed_of_sound(SOUND_SPEED_MM_S)
print(ok)
res = myPing.get_speed_of_sound()
print(res)
when i run my code I receive this issue
styx4d@Echosondeur:~/Documents $ python Pind1D_only.py
Opening /dev/serial0 at 115200 bps
get_profile: {'distance': 4449, 'confidence': 0, 'transmit_duration': 191, 'ping_number': 45983, 'scan_start': 0, 'scan_length': 6782, 'gain_setting': 6, 'profile_data': b'\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfd\xfdH\x0f,\x90w%\x05\x15@-\x12\x02\x03\x06\x07\t\x06\x02\x01\x02\x00\x00\x01\x03\x04\x01\x00\x01\x00\x00\x00\x00\x01\x01\x00\x00\x03\x06\x06\x01\x01\x00\x00\x00\x00\x00\x01\x05\x03\x00\x00\x00\x00\x01\x00\x00\x00\x01\x01\x00\x00\x01\x04\x00\x00\x00\x01\x02\x00\x02\x01\x00\x00\x00\x00\x03\x06\x08\x07\t\x04\x03\x01\x00\x00\x00\x01\x02\x03\t\n\x10\x0b\x03\x02\x00\x00\x03\x04\x01\x01\x00\x00\x03\x04\x04\x05\x01\x00\x00\x00\x02\x05\x07\x04\x03\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00%\x00\x00\x00\x00\x1f\xffu\x8a\x906\x1e`\x19\x00fF\x17\x00\x1b+\x1f"\x00..~\xed\xfd\x02g\x14\x00(g^P&QN '}
Traceback (most recent call last):
File "/home/styx4d/Documents/Pind1D_only.py", line 26, in <module>
ok = myPing.set_speed_of_sound(SOUND_SPEED_MM_S)
File "/home/styx4d/.local/lib/python3.13/site-packages/bluerobotics_ping-0.2.3-py3.13.egg/brping/ping1d.py", line 520, in set_speed_of_sound
and (self._speed_of_sound != speed_of_sound)):
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Ping1D' object has no attribute '_speed_of_sound'. Did you mean: 'get_speed_of_sound'?
Thanks for your help
- Ngôn ngữ chính
- Python
- Star
- 60
- Fork
- 39
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của bluerobotics/ping-python
-
avoid using print() function Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bluerobotics/ping-python#141 · 2 bình luận · 1 reaction ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bluerobotics/ping-python#74 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
bluerobotics/ping-python#171 ·
-
Code after return Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
bluerobotics/ping-python#167 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 32/100
bluerobotics/ping-python#159 ·
Tất cả issue của bluerobotics/ping-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100