Metadata-Version: 2.4
Name: hakoniwa-pdu
Version: 0.9.0
Summary: Hakoniwa PDU communication library for Python
Author-email: Takashi Mori <tmori@hakoniwa-lab.net>
License: MIT License
        
        Copyright (c) 2025 Hakoniwa Lab, LLC
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/hakoniwalab
Project-URL: Repository, https://github.com/hakoniwalab/hakoniwa-pdu-python
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: websockets>=11.0
Dynamic: license-file

# hakoniwa-pdu-python

This is a Python PDU communication library for the Hakoniwa simulator.  
It allows easy sending/receiving of PDU binary data and conversion to/from JSON over WebSocket.

---

## 📦 Installation

```bash
pip install hakoniwa-pdu
```

Check the installed version:

```bash
pip show hakoniwa-pdu
```

---

## 🔧 Environment Variables

You can specify the directory containing `.offset` files used for PDU conversion:

```bash
export HAKO_BINARY_PATH=/your/path/to/offset
```

If not set, the default path will be:

```
/usr/local/lib/hakoniwa/hako_binary/offset
```

---

## 🚀 Example Usage

### Read a PDU from drone using test script

The following sample script receives the `pos` PDU from the drone and converts it into JSON.

`tests/sample.py`:

```python
# (your existing sample.py content goes here)
```

### Run example

```bash
python tests/sample.py \
  --config ./config/pdudef/webavatar.json \
  --uri ws://localhost:8765
```

---

## 📁 Package Structure

```
hakoniwa_pdu/
├── pdu_manager.py                  # Manages PDU lifecycle
├── impl/
│   ├── websocket_communication_service.py  # WebSocket implementation
│   ├── pdu_convertor.py            # Binary ⇔ JSON conversion
│   ├── hako_binary/
│   │   └── *.py (Handles offsets and binary layout)
├── resources/
│   └── offset/                     # Offset definition files
```

---

## 🔗 Links

* 📘 GitHub: [https://github.com/hakoniwalab/hakoniwa-pdu-python](https://github.com/hakoniwalab/hakoniwa-pdu-python)
* 🌐 Hakoniwa Lab: [https://hakoniwa-lab.net](https://hakoniwa-lab.net)

---

## 📚 Documentation

For detailed API usage, refer to the full API reference:

➡️ [API Reference (api-doc.md)](./api-doc.md)

---

## 📜 License

MIT License - see [LICENSE](./LICENSE) for details.

