Pelorus - High Efficient Lidar Inertial Odometry
Project description
Pelorus Python Bindings
Python bindings for Pelorus - a LiDAR-Inertial Odometry system.
Installation
From source (requires Rust toolchain)
cd pelorus_py
pip install maturin
maturin develop --release
Or build a wheel:
maturin build --release
pip install target/wheels/pelorus-*.whl
Usage
Basic API
import pelorus
import numpy as np
# Create Pelorus instance
lio = pelorus.Handle() # Uses embedded default config
# Or with custom config:
# lio = pelorus.Handle("path/to/config.rl")
#
# If you want to control PointCloud2 parsing (like `pelorus_create_with_options` in C):
# - device_specific_pointcloud2=True (default)
# - device_specific_pointcloud2=False (generic parsing path)
# lio = pelorus.Handle("path/to/config.rl", device_specific_pointcloud2=False)
# Add IMU data
lio.add_imu(
timestamp_sec=1000,
timestamp_nanosec=0,
orientation=[1.0, 0.0, 0.0, 0.0], # w, x, y, z
orientation_covariance=[0.01] + [0.0]*8,
angular_velocity=[0.0, 0.0, 0.0],
angular_velocity_covariance=[0.001] + [0.0]*8,
linear_acceleration=[0.0, 0.0, 9.81],
linear_acceleration_covariance=[0.01] + [0.0]*8,
)
# Add point cloud (recommended):
# - If you already have ROS2 messages, pass them directly:
# lio.add_pointcloud2_ros(cloud_msg)
#
# - For non-ROS point sources, use numpy/list inputs:
# - Nx3: [x,y,z] (no per-point timing)
# - Nx4: [x,y,z,t] where t is uint32 nanosecond offset
# - Nx5: [x,y,z,intensity,t]
# For numpy/list inputs, you must also provide the scan header timestamp:
# lio.add_pointcloud(points_np, timestamp_sec=..., timestamp_nanosec=...)
# Try to receive odometry (non-blocking)
odom = lio.try_recv()
if odom:
print(f"Position: {odom['position']}")
print(f"Orientation: {odom['orientation']}")
print(f"Linear velocity: {odom['linear_velocity']}")
print(f"Points: {len(odom['points'])}")
# Or block until odometry is available
odom = lio.recv()
# Or receive odometry asynchronously via callback (like pelorus_c)
def on_odom(odom: dict) -> None:
print("Odom:", odom["timestamp_sec"], odom["timestamp_nanosec"], odom["position"])
lio.set_callback(on_odom)
# ... feed IMU / pointclouds ...
lio.clear_callback() # equivalent to lio.set_callback(None)
Using with MCAP Bagfiles
See examples/bagfile_example.py for a complete example using real sensor data from an MCAP bagfile.
python -m pip install mcap mcap-ros2-support
API Reference
Handle
Main interface to the Pelorus system.
Constructor
-
Handle(config_path: str | None = None, device_specific_pointcloud2: bool = True): Create a new Pelorus instancedevice_specific_pointcloud2=Falseselects the generic parsing path for PointCloud2 inputs.
Methods
add_imu(...): Add an IMU measurementadd_odom(...): Add an odometry measurementadd_pointcloud(cloud_dict): Add a point cloud (PointCloud2 format)add_pointcloud(cloud_np, timestamp_sec=..., timestamp_nanosec=...): Add a point cloud from numpyadd_pointcloud2_ros(cloud_msg): Add a ROS2sensor_msgs/msg/PointCloud2message directlytry_recv(): Try to receive odometry (non-blocking), returnsNoneif no datarecv(): Receive odometry (blocks until available)set_callback(callback): Deliver odometry via callback from a background thread; disablestry_recv()/recv()queuing while enabledclear_callback(): Disable callback delivery (equivalent toset_callback(None))version(): Get library version (static method)
Timestamp semantics
Pelorus uses two timestamp levels:
-
IMU/Odom timestamps (
timestamp_sec+timestamp_nanosec)- Absolute timestamps (typically epoch / ROS time) used for synchronization.
-
LiDAR timestamps
- Scan header timestamp: absolute (sec/nanosec)
- Per-point
tfield (if provided):uint32nanoseconds offset, non-negative and forward in time relative to the scan header time.
The effective point time is:
point_time_abs = header_time_abs + (t * 1e-9)
Odometry outputs include timestamp_sec/timestamp_nanosec (and timestamp as float for convenience).
Development
# Install development dependencies
pip install maturin pytest black ruff
# Build and test
maturin develop
pytest
# Format code
black .
ruff check .
License
Dual-licensed under MIT or Apache-2.0, consistent with the Pelorus project.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pelorus-0.0.2-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67daaa912ec13774107a974cbf917de27e10beb9768065cb44c26d143dea2244
|
|
| MD5 |
9ad628fb52dfe7e64bd18910e2cb86ca
|
|
| BLAKE2b-256 |
2e76adfb2cadbd3885879d2a06d9e0a19d610eec5664b1f443adedaa3d94ca4f
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ee09767b0b9b8f3de98fb6a010fbe37dbe392bec0b382bc0388e5ab442f527
|
|
| MD5 |
b2af3a202eaea466c3ccdeef335b12f2
|
|
| BLAKE2b-256 |
0a1c7b689d44437130bba8193cd6d40e06012e4243054895ecbc3798d2073d7c
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb413e2ee4c1155520f918b91da41f9833b519c5b0e07b5db4c8a5a55822583e
|
|
| MD5 |
f46dc5bc04b435ce837490aa49d0143d
|
|
| BLAKE2b-256 |
007a089815fc1ec5eb588c8b0a6d348218e3b03f749dcc3c3fef2f9d5564c44e
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95def89c45e70b9ae2d6b7d9223fef17a3a115fe2d667b945353dd322b532dd5
|
|
| MD5 |
6c59997c31a682989c0913d094d74578
|
|
| BLAKE2b-256 |
ad776137a6415d10a1218cd51c4a9128d03291e26803f3b31a2e2ea227a141f0
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
447128a6e4020c3d26e2665066a1b943f3c7549bfe4003c65fcc9ac3995fb961
|
|
| MD5 |
c28f00fc455d0d20a80d6a83ac87cdff
|
|
| BLAKE2b-256 |
b7fae5eaa4df90b9c12e2cbc33ed7ed03c667fa46db303fb6c2818df1197f094
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef8eb29d620d99a6186ec1ed61e474cfed3bb87e30f04cb3751dfdb10ad9021
|
|
| MD5 |
6f2ad619289a9f9f12a58aa4014e66f0
|
|
| BLAKE2b-256 |
09d1e8a41e766b22ab7994d63924688fc971746675263e4fb0ae6ad53e84d3cc
|
File details
Details for the file pelorus-0.0.2-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: pelorus-0.0.2-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92be91c5ab49485a2853b4bf4d2875a0cea3a0ac6980b1c0994e3aa67c168600
|
|
| MD5 |
835eb5db6f07221ce40921448f488afc
|
|
| BLAKE2b-256 |
cc201abbfd2bf2fddf2a40952fd545eb7fa8205e9b9da845c72e33d1fcdea5af
|