Metadata-Version: 2.4
Name: uam-05lp
Version: 0.2.0
Summary: Python communication library for the Hokuyo UAM-05LP safety laser scanner (UAM protocol)
Project-URL: Homepage, https://git.kristou.com/kristou/safety_library_lp_python/wiki
Project-URL: Documentation, https://git.kristou.com/kristou/safety_library_lp_python/wiki
Project-URL: Repository, https://git.kristou.com/kristou/safety_library_lp_python
Project-URL: Changelog, https://git.kristou.com/kristou/safety_library_lp_python/src/branch/main/CHANGELOG.md
Author-email: Mehrez Kristou <kristou@hokuyo-aut.jp>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: hokuyo,laser-scanner,lidar,safety,uam-05lp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System :: Hardware :: Hardware Drivers
Classifier: Typing :: Typed
Requires-Python: >=3.10
Provides-Extra: dev
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.4; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.0; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
Provides-Extra: serial
Requires-Dist: pyserial>=3.5; extra == 'serial'
Description-Content-Type: text/markdown

# uam-05lp

Python communication library for the Hokuyo UAM-05LP safety laser scanner (UAM protocol).

## Installation

```bash
pip install uam-05lp
```

For serial/USB connections:

```bash
pip install uam-05lp[serial]
```

## Quick Start

```python
from uam_05lp import UAM05LP

with UAM05LP("192.168.0.10") as sensor:
    scan = sensor.get_distance()
    print(f"Got {len(scan.distances)} distance points")
```

## Examples

### Get distance measurement

The sensor returns 1081 distance points covering a 270° field of view
(step 0 = −135°, step 540 = 0° front-center, step 1080 = +135°).
Distances are in millimeters.

```python
from uam_05lp import UAM05LP

with UAM05LP("192.168.0.10") as sensor:
    scan = sensor.get_distance()

    # Access individual distances (mm)
    front = scan.distances[540]       # Front-center
    left  = scan.distances[1080]      # +135°
    right = scan.distances[0]         # -135°
    print(f"Front: {front} mm, Left: {left} mm, Right: {right} mm")

    # Safety status
    print(f"Area: {scan.safety.area_number}")
    print(f"Error: {scan.safety.error_detected}")
    print(f"OSSD1: {scan.safety.ossd1}, OSSD2: {scan.safety.ossd2}")

    # Find the closest point
    min_dist = min(d for d in scan.distances if d < 0xFFFC)
    min_step = scan.distances.index(min_dist)
    angle = (min_step - 540) * 0.25  # Convert step to degrees
    print(f"Closest point: {min_dist} mm at {angle}°")

    # Check for errors and warnings
    if scan.safety.error_detected:
        print(f"ERROR: Sensor error code {scan.safety.error_code}")
    if scan.safety.optical_window_contamination:
        print("WARNING: Optical window is dirty, clean the sensor!")
```

### Continuous scanning

```python
from uam_05lp import UAM05LP

with UAM05LP("192.168.0.10") as sensor:
    with sensor.iter_distance() as stream:
        for scan in stream:
            print(scan.distances[540])  # Front-center distance
```

### Serial/USB connection

```python
from uam_05lp import UAM05LP, SerialTransport

transport = SerialTransport("/dev/ttyACM0")  # or "COM3" on Windows
with UAM05LP(transport=transport) as sensor:
    scan = sensor.get_distance()
    print(f"Got {len(scan.distances)} points")
```

## Requirements

- Python 3.10+
- No dependencies for Ethernet (TCP) connections
- `pyserial` for USB/Serial connections (install with `[serial]` extra)

## Documentation

Full documentation is available at: https://git.kristou.com/kristou/safety_library_lp_python/wiki

## License

BSD-3-Clause
