Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

set sound speed

未关闭
#169 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@RaulTrombin 已经在做这个了。

开始于 2026年2月12日。

评估

这个 Issue 还没有评估数据。

描述

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

主要语言
Python
星标
60
派生
39
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

bluerobotics/ping-python 的其他 Issue

查看 bluerobotics/ping-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。