Skip to main content

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

Project description

uam-05lp

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

Installation

pip install uam-05lp

For serial/USB connections:

pip install uam-05lp[serial]

Quick Start

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.

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

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

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

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

uam_05lp-0.2.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uam_05lp-0.2.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file uam_05lp-0.2.0.tar.gz.

File metadata

  • Download URL: uam_05lp-0.2.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for uam_05lp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3face604508bc5b024d5259b1909c675caae6e27d9f55033401bd786d43bb7d7
MD5 52f327909eeb3dc6fb85d0ede0d2b0f5
BLAKE2b-256 b1f2247a9a8a3f0aeab0d17456aad421eb2f7adaad469c746b3d2feb805d839e

See more details on using hashes here.

File details

Details for the file uam_05lp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uam_05lp-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for uam_05lp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c2fc8bf1084f400be534b69820ae1e1b156dba55d3de370025965de3738dbf7
MD5 ee169f660d2162e383f265662a09b622
BLAKE2b-256 ddcc6c18e1a8b3b4d7cff6474d77d65d64a53b3c3e5ea2bf8c9e9a8d3b4d50e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page