dfjimu 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dfjimu-0.1.0/LICENSE +21 -0
- dfjimu-0.1.0/MANIFEST.in +3 -0
- dfjimu-0.1.0/PKG-INFO +91 -0
- dfjimu-0.1.0/README.md +62 -0
- dfjimu-0.1.0/pyproject.toml +46 -0
- dfjimu-0.1.0/setup.cfg +4 -0
- dfjimu-0.1.0/setup.py +56 -0
- dfjimu-0.1.0/src/dfjimu/__init__.py +15 -0
- dfjimu-0.1.0/src/dfjimu/_cython/__init__.py +0 -0
- dfjimu-0.1.0/src/dfjimu/_cython/core.c +32631 -0
- dfjimu-0.1.0/src/dfjimu/_cython/core.pyx +425 -0
- dfjimu-0.1.0/src/dfjimu/_cython/optimizer.c +15546 -0
- dfjimu-0.1.0/src/dfjimu/_cython/optimizer.pyx +343 -0
- dfjimu-0.1.0/src/dfjimu/_python/__init__.py +2 -0
- dfjimu-0.1.0/src/dfjimu/_python/core.py +111 -0
- dfjimu-0.1.0/src/dfjimu/_python/optimizer.py +154 -0
- dfjimu-0.1.0/src/dfjimu/map_acc.py +106 -0
- dfjimu-0.1.0/src/dfjimu/mekf_acc.py +74 -0
- dfjimu-0.1.0/src/dfjimu/py.typed +0 -0
- dfjimu-0.1.0/src/dfjimu/utils/__init__.py +0 -0
- dfjimu-0.1.0/src/dfjimu/utils/common.py +373 -0
- dfjimu-0.1.0/src/dfjimu.egg-info/PKG-INFO +91 -0
- dfjimu-0.1.0/src/dfjimu.egg-info/SOURCES.txt +25 -0
- dfjimu-0.1.0/src/dfjimu.egg-info/dependency_links.txt +1 -0
- dfjimu-0.1.0/src/dfjimu.egg-info/requires.txt +11 -0
- dfjimu-0.1.0/src/dfjimu.egg-info/top_level.txt +1 -0
- dfjimu-0.1.0/tests/test_smoke.py +65 -0
dfjimu-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Daniel Oliver Martin Weber
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dfjimu-0.1.0/MANIFEST.in
ADDED
dfjimu-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dfjimu
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Drift-free IMU-based joint kinematics estimation (Weygers & Kok, 2020)
|
|
5
|
+
Author: Daniel Oliver Martin Weber
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/daniel-om-weber/dfjimu
|
|
8
|
+
Project-URL: Repository, https://github.com/daniel-om-weber/dfjimu
|
|
9
|
+
Project-URL: Issues, https://github.com/daniel-om-weber/dfjimu/issues
|
|
10
|
+
Keywords: IMU,joint-kinematics,MEKF,quaternion,inertial-sensors
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Cython
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: numpy
|
|
20
|
+
Requires-Dist: scipy
|
|
21
|
+
Provides-Extra: examples
|
|
22
|
+
Requires-Dist: jupyter; extra == "examples"
|
|
23
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: cython; extra == "dev"
|
|
26
|
+
Requires-Dist: setuptools; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Drift-Free Joint Kinematics from Dual IMUs
|
|
31
|
+
|
|
32
|
+
High-performance Python/Cython implementation of the drift-free joint kinematics estimation method from [Weygers & Kok (2020), "Drift-Free Inertial Sensor-Based Joint Kinematics for Long-Term Arbitrary Movements"](https://ieeexplore.ieee.org/document/9044292/).
|
|
33
|
+
|
|
34
|
+
It includes:
|
|
35
|
+
1. **MAP-acc** (optimization-based smoothing): Gauss-Newton optimizer for high-accuracy offline joint kinematics.
|
|
36
|
+
2. **MEKF-acc** (Multiplicative Extended Kalman Filter): Online filtering.
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install dfjimu
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
A C compiler is recommended for the fast Cython backend. If unavailable, the package falls back to pure Python automatically.
|
|
45
|
+
|
|
46
|
+
## Development
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Install in editable mode
|
|
50
|
+
uv pip install -e .
|
|
51
|
+
|
|
52
|
+
# With Jupyter and matplotlib for running the example notebook
|
|
53
|
+
uv pip install -e ".[examples]"
|
|
54
|
+
|
|
55
|
+
# With dev tools (Cython, pytest)
|
|
56
|
+
uv pip install -e ".[dev]"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage Example
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from dfjimu import mekf_acc, map_acc
|
|
63
|
+
|
|
64
|
+
# MEKF-acc (online filtering)
|
|
65
|
+
q1, q2 = mekf_acc(gyr1, gyr2, acc1, acc2, r1, r2, Fs, q_init)
|
|
66
|
+
|
|
67
|
+
# MAP-acc (optimization-based smoothing)
|
|
68
|
+
q1, q2 = map_acc(gyr1, gyr2, acc1, acc2, r1, r2, Fs, q_init,
|
|
69
|
+
cov_w, cov_i, cov_lnk)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
See [`examples/demo.ipynb`](examples/demo.ipynb) for a full walkthrough with plots.
|
|
73
|
+
|
|
74
|
+
## Running Benchmarks
|
|
75
|
+
|
|
76
|
+
Evaluate accuracy and speed of the solvers on the dataset:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
uv run tests/evaluate_package.py
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Package Structure
|
|
83
|
+
|
|
84
|
+
- **`dfjimu/`**: The Python package source.
|
|
85
|
+
- `map_acc()` / `MapAcc`: MAP-acc optimizer (uses Cython).
|
|
86
|
+
- `mekf_acc()` / `MekfAcc`: MEKF-acc filter (uses Cython).
|
|
87
|
+
- `_python/`: Pure Python reference implementations for educational/debugging purposes.
|
|
88
|
+
|
|
89
|
+
## Reference
|
|
90
|
+
|
|
91
|
+
Weygers, I., & Kok, M. (2020). Drift-Free Inertial Sensor-Based Joint Kinematics for Long-Term Arbitrary Movements. *IEEE Sensors Journal*, 20(14), 7969-7979.
|
dfjimu-0.1.0/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Drift-Free Joint Kinematics from Dual IMUs
|
|
2
|
+
|
|
3
|
+
High-performance Python/Cython implementation of the drift-free joint kinematics estimation method from [Weygers & Kok (2020), "Drift-Free Inertial Sensor-Based Joint Kinematics for Long-Term Arbitrary Movements"](https://ieeexplore.ieee.org/document/9044292/).
|
|
4
|
+
|
|
5
|
+
It includes:
|
|
6
|
+
1. **MAP-acc** (optimization-based smoothing): Gauss-Newton optimizer for high-accuracy offline joint kinematics.
|
|
7
|
+
2. **MEKF-acc** (Multiplicative Extended Kalman Filter): Online filtering.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install dfjimu
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
A C compiler is recommended for the fast Cython backend. If unavailable, the package falls back to pure Python automatically.
|
|
16
|
+
|
|
17
|
+
## Development
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install in editable mode
|
|
21
|
+
uv pip install -e .
|
|
22
|
+
|
|
23
|
+
# With Jupyter and matplotlib for running the example notebook
|
|
24
|
+
uv pip install -e ".[examples]"
|
|
25
|
+
|
|
26
|
+
# With dev tools (Cython, pytest)
|
|
27
|
+
uv pip install -e ".[dev]"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage Example
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from dfjimu import mekf_acc, map_acc
|
|
34
|
+
|
|
35
|
+
# MEKF-acc (online filtering)
|
|
36
|
+
q1, q2 = mekf_acc(gyr1, gyr2, acc1, acc2, r1, r2, Fs, q_init)
|
|
37
|
+
|
|
38
|
+
# MAP-acc (optimization-based smoothing)
|
|
39
|
+
q1, q2 = map_acc(gyr1, gyr2, acc1, acc2, r1, r2, Fs, q_init,
|
|
40
|
+
cov_w, cov_i, cov_lnk)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
See [`examples/demo.ipynb`](examples/demo.ipynb) for a full walkthrough with plots.
|
|
44
|
+
|
|
45
|
+
## Running Benchmarks
|
|
46
|
+
|
|
47
|
+
Evaluate accuracy and speed of the solvers on the dataset:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
uv run tests/evaluate_package.py
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Package Structure
|
|
54
|
+
|
|
55
|
+
- **`dfjimu/`**: The Python package source.
|
|
56
|
+
- `map_acc()` / `MapAcc`: MAP-acc optimizer (uses Cython).
|
|
57
|
+
- `mekf_acc()` / `MekfAcc`: MEKF-acc filter (uses Cython).
|
|
58
|
+
- `_python/`: Pure Python reference implementations for educational/debugging purposes.
|
|
59
|
+
|
|
60
|
+
## Reference
|
|
61
|
+
|
|
62
|
+
Weygers, I., & Kok, M. (2020). Drift-Free Inertial Sensor-Based Joint Kinematics for Long-Term Arbitrary Movements. *IEEE Sensors Journal*, 20(14), 7969-7979.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "cython", "numpy"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dfjimu"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Drift-free IMU-based joint kinematics estimation (Weygers & Kok, 2020)"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{name = "Daniel Oliver Martin Weber"}]
|
|
13
|
+
keywords = ["IMU", "joint-kinematics", "MEKF", "quaternion", "inertial-sensors"]
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy",
|
|
16
|
+
"scipy",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 3 - Alpha",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Cython",
|
|
23
|
+
"Topic :: Scientific/Engineering",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/daniel-om-weber/dfjimu"
|
|
28
|
+
Repository = "https://github.com/daniel-om-weber/dfjimu"
|
|
29
|
+
Issues = "https://github.com/daniel-om-weber/dfjimu/issues"
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
examples = [
|
|
33
|
+
"jupyter",
|
|
34
|
+
"matplotlib",
|
|
35
|
+
]
|
|
36
|
+
dev = [
|
|
37
|
+
"cython",
|
|
38
|
+
"setuptools",
|
|
39
|
+
"pytest",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.package-data]
|
|
46
|
+
dfjimu = ["*.pyx", "*.pxd", "py.typed"]
|
dfjimu-0.1.0/setup.cfg
ADDED
dfjimu-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from setuptools import setup, Extension
|
|
3
|
+
from setuptools.command.build_ext import build_ext
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class OptionalBuildExt(build_ext):
|
|
7
|
+
"""build_ext that warns instead of crashing when compilation fails."""
|
|
8
|
+
|
|
9
|
+
def build_extension(self, ext):
|
|
10
|
+
try:
|
|
11
|
+
super().build_extension(ext)
|
|
12
|
+
except Exception as e:
|
|
13
|
+
print(f"WARNING: Failed to build extension {ext.name}: {e}")
|
|
14
|
+
print("The package will use pure Python fallbacks (slower).")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_extensions():
|
|
18
|
+
try:
|
|
19
|
+
import numpy as np
|
|
20
|
+
except ImportError:
|
|
21
|
+
print("WARNING: NumPy not available. "
|
|
22
|
+
"Skipping C extension compilation.")
|
|
23
|
+
return []
|
|
24
|
+
|
|
25
|
+
try:
|
|
26
|
+
from Cython.Build import cythonize
|
|
27
|
+
USE_CYTHON = True
|
|
28
|
+
except ImportError:
|
|
29
|
+
USE_CYTHON = False
|
|
30
|
+
|
|
31
|
+
ext = '.pyx' if USE_CYTHON else '.c'
|
|
32
|
+
extensions = [
|
|
33
|
+
Extension(
|
|
34
|
+
"dfjimu._cython.core",
|
|
35
|
+
[f"src/dfjimu/_cython/core{ext}"],
|
|
36
|
+
include_dirs=[np.get_include()],
|
|
37
|
+
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
|
|
38
|
+
),
|
|
39
|
+
Extension(
|
|
40
|
+
"dfjimu._cython.optimizer",
|
|
41
|
+
[f"src/dfjimu/_cython/optimizer{ext}"],
|
|
42
|
+
include_dirs=[np.get_include()],
|
|
43
|
+
define_macros=[("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")],
|
|
44
|
+
),
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
if USE_CYTHON:
|
|
48
|
+
extensions = cythonize(extensions, compiler_directives={'language_level': "3"})
|
|
49
|
+
|
|
50
|
+
return extensions
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
setup(
|
|
54
|
+
ext_modules=get_extensions(),
|
|
55
|
+
cmdclass={'build_ext': OptionalBuildExt},
|
|
56
|
+
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
2
|
+
_CYTHON_AVAILABLE = False
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from ._cython.core import run_mekf_cython
|
|
6
|
+
from ._cython.optimizer import build_system_cython, update_lin_points_cython
|
|
7
|
+
_CYTHON_AVAILABLE = True
|
|
8
|
+
except ImportError:
|
|
9
|
+
from ._python.core import run_mekf_cython
|
|
10
|
+
from ._python.optimizer import build_system_cython, update_lin_points_cython
|
|
11
|
+
|
|
12
|
+
from .mekf_acc import mekf_acc, MekfAcc
|
|
13
|
+
from .map_acc import map_acc, MapAcc
|
|
14
|
+
|
|
15
|
+
__all__ = ['mekf_acc', 'MekfAcc', 'map_acc', 'MapAcc', '_CYTHON_AVAILABLE']
|
|
File without changes
|