IMU Module for Python
This is the repository for imu sensor codes for the lower-limb exosuit.
To maximize data rates of multiple connected IMUs, Python free-threading build is required for free threading. Free threading is always disabled when running on versions prior to 3.13, and non free-threading builds.
Install
To install the library, run:
uv pip install imu-python
OR
uv pip install git+https://github.com/TUM-Aries-Lab/imu-module.git@<specific-tag>
Development
- Install uv
git clone git@github.com:TUM-Aries-Lab/imu-module.gitmake initto create the virtual environment and install dependenciesmake formatto format the code and check for errorsmake testto run the test suitemake cleanto delete the temporary files and directories
Publishing
It's super easy to publish your own packages on PyPI. To build and publish this package, run:
- Update the version number in pyproject.toml and imu_module/init.py
- Commit your changes and add a git tag "<new.version.number>"
- Push the tag
git push --tag
The package can then be found at: https://pypi.org/project/imu-python
Module Usage
"""Basic module usage example."""
import time
from loguru import logger
from imu_python.definitions import IMUUpdateTime
from imu_python.factory import IMUFactory
def main() -> None:
"""Run a simple demonstration."""
sensor_managers = IMUFactory.detect_and_create()
for manager in sensor_managers:
manager.start()
try:
while True:
for manager in sensor_managers:
logger.info(manager.get_data())
time.sleep(IMUUpdateTime.freq_hz)
#Note: this read frequency is independent of IMUs actual hardware frequency
except KeyboardInterrupt:
for manager in sensor_managers:
manager.stop()
if __name__ == "__main__":
main()
Adding a new IMU/Changing the config of an existing IMU
To use an IMU that is not defined in the built-in list of the module (defined IMUs are BNO055, BNO08X, and LSM6DSOX+LIS3MDL), follow these steps to register it to the program:
- Add the Adafruit library and driver for the IMU to your project dependencies.
- Define IMU Config / change the config using
replace(See wiki page for more detail.) Store the new configs inyour_project.imu_configs.py. - Register the model in
pyproject.toml:
[project.entry-points."imu_module.devices"]
NEW_IMU = "your_project.imu_configs:NEW_IMU"
where NEW_IMU is the IMUConfig name and your_project.imu_configs is the file where the IMUConfig is defined.
or override an existing built-in device:
[project.entry-points."imu_module.device_overrides"]
BNO055 = "your_project.imu_configs:BNO055_CUSTOM"
- Save edits. With UV, changes in the
pyproject.tomlare synchronized automatically uponuv run. With pip, poetry and conda, a manual module reinstallation may be necessary.
Program Usage
To run the main pipeline for all connected sensors with optional flag -r to record data:
uv run python -m imu_python
To plot a recorded data file, replace filepath with a path to data file:
uv run python src/imu_python/data_handler/data_plotter.py -f "filepath"
To calibrate all connected sensors:
make calibrate
Structure
├── src
│ └── imu_python
│ ├── calibration
│ │ ├── calibration.py
│ │ ├── ellipsoid_fitting.py
│ │ ├── gain_calculator.py
│ │ └── mag_calibration.py
│ ├── data_handler
│ │ ├── data_plotter.py
│ │ ├── data_reader.py
│ │ └── data_writer.py
│ ├── __init__.py
│ ├── __main__.py
│ ├── base_classes.py
│ ├── builtin_devices.py
│ ├── definitions.py
│ ├── devices.py
│ ├── factory.py
│ ├── i2c_bus.py
│ ├── orientation_filters.py
│ ├── registry.py
│ ├── sensor_manager.py
│ ├── utils.py
│ └── wrapper.py
├── tests
│ ├── calibration
│ │ ├── calibration_test.py
│ │ └── gain_calculator_test.py
│ ├── data_handler
│ │ ├── reader_test.py
│ │ └── writer_test.py
│ ├── __init__.py
│ ├── base_classes_test.py
│ ├── conftest.py
│ ├── devices_test.py
│ ├── factory_test.py
│ ├── i2c_bus_test.py
│ ├── orientation_filter_test.py
│ ├── sensor_manager_test.py
│ ├── utils_test.py
│ └── wrapper_test.py
├── .dockerignore
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
├── pyproject.toml
├── repo_tree.py
└── uv.lock
Metadata
Release files for imu-python 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| imu_python-0.1.2.tar.gz | 32.7 kB | With provenance | Details for imu_python-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| imu_python-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for imu_python-0.1.2-py3-none-any.whl |
Total release size: 72.0 kB
Release files / imu_python-0.1.2.tar.gz
| Download URL | imu_python-0.1.2.tar.gz |
|---|---|
| Size | 32.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c25a7eeb71527927dbf549fce35aa16facf22a07a1a48b05512224099d6e9455
|
|
BLAKE2b-256 checksum How to use checksums |
bed0788112fffcce7d570a5c8e264073a2239aae1f20582282e91cac6efab322
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / imu_python-0.1.2-py3-none-any.whl
| Download URL | imu_python-0.1.2-py3-none-any.whl |
|---|---|
| Size | 39.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5b8e173701a001eff1bf3bacc10280a5ed04fef455026f94cb9d95ed70ac874
|
|
BLAKE2b-256 checksum How to use checksums |
044c1f033b89e05b864719ec46301852b0cb775fe8143cf7284517f95a2c6c37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logSecurity for imu-python 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for imu_python-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.