set sound speed

Open
#169 2 comments 0 reactions 1 assignee View on GitHub

@RaulTrombin is already working on this.

Since Feb 12, 2026.

Assessment

This issue has not been assessed yet.

Description

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

Dominant language
Python
Stars
60
Forks
39
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bluerobotics/ping-python

All issues in bluerobotics/ping-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.