HydroWire
A Python library for applications to interact with HydroWire devices (ROV / robot peripherals) over WebSocket.
Installation
From PyPI (Recommended)
pip install hydrowire
From Source (Development)
git clone https://github.com/yourusername/hydrowire.git
cd hydrowire
pip install -e .
Features
- 🔌 WebSocket Communication: Send JSON commands to ROV devices
- 🎯 Device Targeting: Route commands to specific devices using device IDs
- ⚙️ Async-First Design: Built on asyncio for efficient concurrent operations
- 🎨 GUI Ready: Framework for integrating graphical interfaces
- 📦 Library-First: Designed to be embedded in main applications
Installation
pip install -r requirements.txt
For development:
pip install -r dev-requirements.txt
Quick Start
Basic Usage
import asyncio
from hydrowire import HydroWireManager as ROVManager
async def main():
# Initialize manager
manager = ROVManager("ws://localhost:8000")
# Start communication
await manager.start()
try:
# Send a command to a device
response = await manager.send_command(
device_id="arm_1",
command={"action": "move", "position": 45},
expect_response=True
)
print(response)
finally:
await manager.close()
asyncio.run(main())
Using the Global Start Function
import asyncio
from hydrowire import start
async def main():
# Quick start with convenience function
manager = await start("ws://localhost:8000")
try:
await manager.send_command(
device_id="camera_main",
command={"action": "capture"}
)
finally:
await manager.close()
asyncio.run(main())
API Reference
ROVManager
The main class for interacting with ROV systems.
Initialization
manager = ROVManager(rov_uri, timeout=10.0)
rov_uri(str): WebSocket URI for ROV (e.g.,ws://localhost:8000)timeout(float): Command timeout in seconds (default: 10.0)
Methods
async initialize(): Initialize connection to ROV
async start(gui_enabled=False, **gui_config): Start the ROV manager and optionally launch GUI
async send_command(device_id, command, expect_response=False): Send a command to a device
device_id(str): Target device identifier (e.g., "arm_1", "camera_main")command(dict): Command object with action and parametersexpect_response(bool): Wait for response if True- Returns: Response dict if
expect_response=True, otherwise None
async close(): Close ROV connection
async run(gui_enabled=False, **gui_config): Run manager in blocking mode
attach_gui(gui_app): Attach GUI application instance
register_command_handler(command_type, handler): Register custom command handler
Global Functions
async start(rov_uri, gui_enabled=False, **gui_config): Convenience function to create and start a manager
async get_manager(): Get the global manager instance
Command Structure
Commands are sent with a structured format where parameters are grouped under a params key:
Your code:
await manager.send_command(
device_id="led",
command={"action": "pwm", "duty_cycle": 0.5, "enable": true}
)
What gets sent over WebSocket:
{
"device": "led",
"cmd": "pwm",
"params": {
"duty_cycle": 0.5,
"enable": true
}
}
This structured format makes it easy for the ROV backend to:
- Route commands to the correct device
- Access the command type directly
- Parse all parameters from a single
paramsobject
Running Tests
pytest tests/ -v
Examples
See the examples/ directory for more detailed usage patterns.
Architecture
rov_lib/client.py: Low-level WebSocket clientrov_lib/manager.py: High-level manager with device routingrov_lib/__init__.py: Package exports
Future Enhancements
- GUI framework integration
- Device discovery and management
- Command queuing and priority
- Connection recovery and reconnection
- Telemetry and logging
License
(To be determined)
Metadata
Release files for hydrowire 0.0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hydrowire-0.0.10.tar.gz | 14.2 kB | Without provenance | Details for hydrowire-0.0.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hydrowire-0.0.10-py3-none-any.whl | Python 3 | none | any | Details for hydrowire-0.0.10-py3-none-any.whl |
Total release size: 26.1 kB
Release files / hydrowire-0.0.10.tar.gz
| Download URL | hydrowire-0.0.10.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85d3e9e8d82e5f1a606ffabd5fffbc29e837da6627382432721281877939eb05
|
|
BLAKE2b-256 checksum How to use checksums |
b35dc2ead2a7db49eb169b121863d519cdb572464ba108be5f34c543150619d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / hydrowire-0.0.10-py3-none-any.whl
| Download URL | hydrowire-0.0.10-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6b9ed8d6648ed45d0bf74b640939fcdf569e04f0629362efc2194925be8b89d
|
|
BLAKE2b-256 checksum How to use checksums |
f8bda6cf43d398f3606eee90d8f3a934d08cdba9430ef9cdf92997a9cf21414d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for hydrowire 0.0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.