Enpose API — Python

Pythonic wrapper over the enpose_api C ABI using cffi in ABI (dlopen) mode: it loads the prebuilt shared library at run time, so no C compiler or build step is needed.

It covers the full client workflow:

API reference

Python binding for the Enpose 6-DoF tracking API.

A thin, Pythonic wrapper over the enpose_api C ABI using cffi in ABI (dlopen) mode: it loads the prebuilt shared library at run time, so no C compiler or build step is needed — only the library and cffi (pip install cffi).

It mirrors the other bindings and covers the full client workflow:

Locating the shared library: by default the loader searches a lib/ directory alongside the unpacked SDK and then the system loader path (LD_LIBRARY_PATH etc.). Set ENPOSE_API_LIB to an explicit path to override.

exception enpose_api.Error[source]

Bases: RuntimeError

Raised when a call into the Enpose library fails.

class enpose_api.DeviceInfo(ip, serial, compatible)[source]

Bases: object

One device discovered on the local network.

Parameters:
ip: str

Device IPv4 address.

serial: int

Factory serial number.

compatible: bool

True if the device’s protocol version matches this binding.

class enpose_api.MarkerPose(timestamp, marker_id, x, y, z, rotation, position_rmse, rotation_rmse, sensors, observed_emitters)[source]

Bases: object

Pose of one tracked marker in world coordinates.

Units: x/y/z and position_rmse are in meters; rotation_rmse is in radians.

The world frame is right-handed, and where its origin and axes lie is decided by the device’s extrinsics calibration. By default it is the reference sensor’s optical frame – origin at that sensor, +X to its right, +Y down and +Z into the scene, so a marker in front of the device has a positive z. Calibrating against a measured origin puts the frame there instead, and measuring a ground plane makes that plane z = 0 with +Z pointing up out of it. Treat the axes as a property of the calibration rather than a fixed convention: recalibrating a device can move the frame.

Parameters:
timestamp: int

Microseconds since the device started.

marker_id: int

Marker identifier.

x: float

World-space X position in meters (of the first model emitter).

y: float

World-space Y position in meters.

z: float

World-space Z position in meters.

rotation: tuple

Row-major 3x3 rotation (9 values), model frame to world.

position_rmse: float

RMS position error in meters (the same units as x/y/z).

rotation_rmse: float

RMS rotation error (radians, axis-angle magnitude).

sensors: int

Number of sensors that contributed to this pose.

observed_emitters: int

Number of marker emitters (LEDs) that contributed to this pose.

The standard marker carries four. A lower count means some were occluded or could not be decoded, so the pose was fitted from a reduced set of points and is correspondingly biased; 0 means the pose was carried purely by prediction. Filter on this value to reject poses computed from a partial view.

class enpose_api.PoseStream(target, create_thread=True)[source]

Bases: object

A live pose stream from one device.

Closes itself when used as a context manager or garbage-collected; call close() to release it eagerly.

Parameters:

create_thread (bool)

receive(block=False)[source]

Return poses received from the stream.

When block is false (the default), returns the poses that have arrived since the previous call (empty if none) without waiting. When block is true, waits for at least one pose update, up to a 3-second timeout — so the result is still empty if none arrives in that window. Raises Error on an unrecoverable failure.

Parameters:

block (bool)

Return type:

list

close()[source]

Disconnect and release the stream. Idempotent.

Return type:

None

enpose_api.discover()[source]

Discover Enpose devices on the local network.

Returns a list of DeviceInfo (empty if none are found). Raises Error on an I/O failure.

Return type:

list