Skip to main content

SpatialAI SDK

Python SDK for VisionLibra ToF depth sensors and cameras.

Physical AI starts with Spatial Intelligence + AI Agents.

pip install spatialai

Five lines to spatial intelligence:

from spatialai import Camera

cam = Camera()
result = cam.detect_people()
print(result)
# {'people': 1, 'nearest_m': 1.42, 'positions': [...], 'source': 'simulator'}

Status — v0.2 (alpha)

Feature Status
Simulator (all four products, depth frames included) ✅ works everywhere
Spatial Mini / DM0301 over I²C (VL53L4CD-compatible) ✅ Raspberry Pi & Linux SBCs, via pip install spatialai[dm0301]
load_model() + presence-core, occupancy-home-v1 ✅ free, shipped with the SDK
Spatial Home / Vision / Robot real backends 🚧 in development — simulator only for now
Remaining marketplace models, agents, fleet 🚧 in development — load_model() raises with waitlist info

Models

Two production models ship free with the SDK today:

from spatialai import Camera

cam = Camera("spatial-home", simulate=True)
cam.load_model("occupancy-home-v1")    # room occupancy from depth CV
cam.load_model("presence-core")        # presence/approach with debouncing

for frame in cam.stream(hz=10, duration=5):
    occ = frame.models["occupancy"]
    print(f"people={occ['people']} pets={occ['pets']} occupied={occ['occupied']}")

occupancy-home-v1 is classic depth computer vision — background estimation, foreground clustering, person/pet size classification — so it needs no GPU and runs on a Raspberry Pi. Announced models that haven't shipped (people-tracking-v3, forklift-safety, …) raise ModelNotAvailableYet with waitlist instructions instead of failing silently.

Simulator — works on any machine

Every device can run in simulator mode, which generates realistic distance and people-detection streams. It is the default whenever no hardware is detected, so the quickstart above always runs.

from spatialai import Camera

cam = Camera("spatial-vision", simulate=True)
for frame in cam.stream(hz=10, duration=3):
    print(f"people={frame.people} nearest={frame.nearest_m:.2f}m")

Try it from the terminal:

spatialai demo                  # live simulated distance readout
spatialai demo --device spatial-vision
spatialai scan                  # look for real hardware on I2C

Real hardware — Spatial Mini (DM0301)

The DM0301 1D ToF sensor is pin-to-pin compatible with the ST VL53L4CD, so the SDK drives it through the proven Adafruit driver stack.

Wiring (Raspberry Pi): VIN→3V3, GND→GND, SDA→GPIO2, SCL→GPIO3 (I²C address 0x29).

sudo raspi-config          # enable I2C
pip install "spatialai[dm0301]"
from spatialai import Sensor

lock = Sensor("spatial-mini")      # auto-detects the sensor on I2C
print(lock.distance_m())           # 0.734

for reading in lock.stream(hz=20):
    if reading.distance_m < 0.5:
        print("presence!", reading)

Camera("spatial-mini").detect_people() also works on real hardware: it maps near-field presence onto the people-detection schema (0 or 1 person).

API overview

  • Camera(device_id=None, simulate=None) — unified entry point. .detect_people(), .stream(hz, duration), .distance_m(), .info()
  • Sensor(device_id) — alias of Camera tuned for 1D sensors.
  • spatialai.devices() — catalog of supported products.
  • Exceptions: DeviceNotFound, HardwareNotSupportedYet.

Roadmap

Depth-frame backends for Spatial Home (DMOS5030A serial), Spatial Vision (DMOM2508CL) and Spatial Robot (DMAS2M001), on-device people tracking models, and the agent/fleet APIs. Follow along at visionlibra.adamaohappy.workers.dev/developer.html.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spatialai-0.2.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

spatialai-0.2.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spatialai-0.2.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for spatialai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d9f9e7785f29cd66f2b8a77ffd3081a577dd90121f6232de95f1d7b055d2c3eb
MD5 0ed2fae3de20eb88e4f2ae1e30d9abdf
BLAKE2b-256 1eb8930562ee61b64ca447f3fb878d88963517db358d4cf018f2ec44fa644f08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spatialai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.15

File hashes

Hashes for spatialai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 570425d6645f8f4b05b9e0364c768306bebaaeb64119dd384cffe1aaab5fd7da
MD5 73ce3cb131403e984465c61d721f4354
BLAKE2b-256 a380684b9b701a04fb6cce52ab5ee3661d3f2352ef54d9415780249ed4ebcddf

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