Python client and Range Image Protocol utilities for Water Linked Sonar 3D-15.
Project description
wlsonar
Package wlsonar is a python client library for the Water Linked Sonar 3D-15.
The key features of this package are:
wlsonar.Sonar3Dfor configuration and inspection of system state.wlsonar.range_image_protocolfor Range Image Protocol packets.
Installation
The wlsonar package is hosted on pypi and can be installed with pip:
pip install wlsonar
Quickstart
Following is a snippet showing how to connect to the sonar and receive images.
import wlsonar
import wlsonar.range_image_protocol as rip
# (set to your sonar's IP address
ip = "10.1.2.24"
# connect, enable acoustics, configure to send images over UDP multicast
sonar = wlsonar.Sonar3D(ip)
sonar.set_acoustics_enabled(True)
sonar.set_udp_multicast()
print("Sonar configured, listening for UDP packets...")
# receive UDP packets, parse them into protobuf, and extract voxels
sock = wlsonar.open_sonar_udp_socket()
try:
while True:
packet, _ = sock.recvfrom(wlsonar.UDP_MAX_DATAGRAM_SIZE)
try:
msg = rip.unpackb(packet)
except rip.UnknownProtobufTypeError:
continue
if isinstance(msg, rip.RangeImage):
xyz = wlsonar.range_image_to_xyz(msg)
id = msg.header.sequence_id
print(f"Got range image {id} with {len(xyz)} voxels")
finally:
sock.close()
More elaborate examples can be found in the examples folder.
Documentation and resources
Documentation for this package is provided in the form of:
- Elaborate examples in the examples folder.
- Tests in the tests folder.
- Docstrings in code.
For general documentation about the Sonar 3D-15 see: https://docs.waterlinked.com/sonar-3d/sonar-3d-15/. The integration API that this package interfaces with is documented here: https://docs.waterlinked.com/sonar-3d/sonar-3d-15-api/. See also the replayer: https://sonar.replay.waterlinked.com/.
Development and testing
uv is required for development of the package. Run the following to set up the project:
uv sync
Linting
The package is linted with ruff and mypy:
uv run ruff check
uv run ruff format --diff
uv run mypy .
Testing
The package is tested with pytest:
uv run pytest
There are also end-to-end (e2e) tests to verify the package against a real Sonar 3D-15. Make sure to read the documentation of tests/test_e2e_real_sonar.py, then run the e2e test with:
uv run pytest -m e2e -s --sonar-ip <sonar ip>
Versioning
Versioning is handled with uv. Setting a new version with uv version <new version> and merging to master will build a new version on pypi. We follow semantic versioning.
Protobuf
The Sonar 3D-15 uses a .proto file to define message formats. This package includes generated Python for these messages. When changing the .proto file, run the following to generate new Python code:
uv run protoc \
--proto_path=src/wlsonar/range_image_protocol/_proto/ \
--python_out=src/wlsonar/range_image_protocol/_proto/ \
--mypy_out=src/wlsonar/range_image_protocol/_proto/ \
src/wlsonar/range_image_protocol/_proto/WaterLinkedSonarIntegrationProtocol.proto
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wlsonar-0.1.0.tar.gz.
File metadata
- Download URL: wlsonar-0.1.0.tar.gz
- Upload date:
- Size: 12.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b968ed7daf8e9ff808262731da891838c26cdca5bdfa1ab30921fac842c00408
|
|
| MD5 |
8d55697400513989d11bdeb9ed8a2a7f
|
|
| BLAKE2b-256 |
f44cba19b4a70daaaad6a8f946c51b94c7b2dc7d60f65eebb727ee157a5780ba
|
File details
Details for the file wlsonar-0.1.0-py3-none-any.whl.
File metadata
- Download URL: wlsonar-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
611888a6869b6bf6f081de213c5836fa157a7ff94ca01b1eb0005196e387f7b3
|
|
| MD5 |
d012a5137f386c4e9be881bb4f96a51a
|
|
| BLAKE2b-256 |
4b3b1c21d51606ad4e89fb68e5710e7d760b7d3666a319ccf81b21a7c44fe434
|