imt-ring 1.2.1__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.
Files changed (109) hide show
  1. imt-ring-1.2.1/PKG-INFO +91 -0
  2. imt-ring-1.2.1/pyproject.toml +64 -0
  3. imt-ring-1.2.1/readme.md +53 -0
  4. imt-ring-1.2.1/setup.cfg +20 -0
  5. imt-ring-1.2.1/src/imt_ring.egg-info/PKG-INFO +91 -0
  6. imt-ring-1.2.1/src/imt_ring.egg-info/SOURCES.txt +108 -0
  7. imt-ring-1.2.1/src/imt_ring.egg-info/dependency_links.txt +1 -0
  8. imt-ring-1.2.1/src/imt_ring.egg-info/requires.txt +26 -0
  9. imt-ring-1.2.1/src/imt_ring.egg-info/top_level.txt +1 -0
  10. imt-ring-1.2.1/src/ring/__init__.py +63 -0
  11. imt-ring-1.2.1/src/ring/algebra.py +100 -0
  12. imt-ring-1.2.1/src/ring/algorithms/__init__.py +45 -0
  13. imt-ring-1.2.1/src/ring/algorithms/_random.py +403 -0
  14. imt-ring-1.2.1/src/ring/algorithms/custom_joints/__init__.py +6 -0
  15. imt-ring-1.2.1/src/ring/algorithms/custom_joints/rr_imp_joint.py +69 -0
  16. imt-ring-1.2.1/src/ring/algorithms/custom_joints/rr_joint.py +33 -0
  17. imt-ring-1.2.1/src/ring/algorithms/custom_joints/suntay.py +424 -0
  18. imt-ring-1.2.1/src/ring/algorithms/dynamics.py +345 -0
  19. imt-ring-1.2.1/src/ring/algorithms/generator/__init__.py +25 -0
  20. imt-ring-1.2.1/src/ring/algorithms/generator/base.py +414 -0
  21. imt-ring-1.2.1/src/ring/algorithms/generator/batch.py +282 -0
  22. imt-ring-1.2.1/src/ring/algorithms/generator/motion_artifacts.py +222 -0
  23. imt-ring-1.2.1/src/ring/algorithms/generator/pd_control.py +182 -0
  24. imt-ring-1.2.1/src/ring/algorithms/generator/randomize.py +119 -0
  25. imt-ring-1.2.1/src/ring/algorithms/generator/transforms.py +410 -0
  26. imt-ring-1.2.1/src/ring/algorithms/generator/types.py +36 -0
  27. imt-ring-1.2.1/src/ring/algorithms/jcalc.py +840 -0
  28. imt-ring-1.2.1/src/ring/algorithms/kinematics.py +202 -0
  29. imt-ring-1.2.1/src/ring/algorithms/sensors.py +582 -0
  30. imt-ring-1.2.1/src/ring/base.py +1046 -0
  31. imt-ring-1.2.1/src/ring/io/__init__.py +9 -0
  32. imt-ring-1.2.1/src/ring/io/examples/branched.xml +24 -0
  33. imt-ring-1.2.1/src/ring/io/examples/exclude/knee_trans_dof.xml +26 -0
  34. imt-ring-1.2.1/src/ring/io/examples/exclude/standard_sys.xml +106 -0
  35. imt-ring-1.2.1/src/ring/io/examples/exclude/standard_sys_rr_imp.xml +106 -0
  36. imt-ring-1.2.1/src/ring/io/examples/inv_pendulum.xml +14 -0
  37. imt-ring-1.2.1/src/ring/io/examples/knee_flexible_imus.xml +22 -0
  38. imt-ring-1.2.1/src/ring/io/examples/spherical_stiff.xml +11 -0
  39. imt-ring-1.2.1/src/ring/io/examples/symmetric.xml +12 -0
  40. imt-ring-1.2.1/src/ring/io/examples/test_all_1.xml +39 -0
  41. imt-ring-1.2.1/src/ring/io/examples/test_all_2.xml +39 -0
  42. imt-ring-1.2.1/src/ring/io/examples/test_ang0_pos0.xml +9 -0
  43. imt-ring-1.2.1/src/ring/io/examples/test_control.xml +16 -0
  44. imt-ring-1.2.1/src/ring/io/examples/test_double_pendulum.xml +14 -0
  45. imt-ring-1.2.1/src/ring/io/examples/test_free.xml +11 -0
  46. imt-ring-1.2.1/src/ring/io/examples/test_kinematics.xml +23 -0
  47. imt-ring-1.2.1/src/ring/io/examples/test_morph_system/four_seg_seg1.xml +26 -0
  48. imt-ring-1.2.1/src/ring/io/examples/test_morph_system/four_seg_seg3.xml +26 -0
  49. imt-ring-1.2.1/src/ring/io/examples/test_randomize_position.xml +26 -0
  50. imt-ring-1.2.1/src/ring/io/examples/test_sensors.xml +13 -0
  51. imt-ring-1.2.1/src/ring/io/examples/test_three_seg_seg2.xml +23 -0
  52. imt-ring-1.2.1/src/ring/io/examples.py +42 -0
  53. imt-ring-1.2.1/src/ring/io/test_examples.py +6 -0
  54. imt-ring-1.2.1/src/ring/io/xml/__init__.py +6 -0
  55. imt-ring-1.2.1/src/ring/io/xml/abstract.py +300 -0
  56. imt-ring-1.2.1/src/ring/io/xml/from_xml.py +299 -0
  57. imt-ring-1.2.1/src/ring/io/xml/test_from_xml.py +56 -0
  58. imt-ring-1.2.1/src/ring/io/xml/test_to_xml.py +31 -0
  59. imt-ring-1.2.1/src/ring/io/xml/to_xml.py +94 -0
  60. imt-ring-1.2.1/src/ring/maths.py +397 -0
  61. imt-ring-1.2.1/src/ring/ml/__init__.py +33 -0
  62. imt-ring-1.2.1/src/ring/ml/base.py +292 -0
  63. imt-ring-1.2.1/src/ring/ml/callbacks.py +434 -0
  64. imt-ring-1.2.1/src/ring/ml/ml_utils.py +272 -0
  65. imt-ring-1.2.1/src/ring/ml/optimizer.py +149 -0
  66. imt-ring-1.2.1/src/ring/ml/params/0x13e3518065c21cd8.pickle +0 -0
  67. imt-ring-1.2.1/src/ring/ml/ringnet.py +279 -0
  68. imt-ring-1.2.1/src/ring/ml/train.py +318 -0
  69. imt-ring-1.2.1/src/ring/ml/training_loop.py +131 -0
  70. imt-ring-1.2.1/src/ring/rendering/__init__.py +2 -0
  71. imt-ring-1.2.1/src/ring/rendering/base_render.py +271 -0
  72. imt-ring-1.2.1/src/ring/rendering/mujoco_render.py +222 -0
  73. imt-ring-1.2.1/src/ring/rendering/vispy_render.py +340 -0
  74. imt-ring-1.2.1/src/ring/rendering/vispy_visuals.py +290 -0
  75. imt-ring-1.2.1/src/ring/sim2real/__init__.py +7 -0
  76. imt-ring-1.2.1/src/ring/sim2real/sim2real.py +288 -0
  77. imt-ring-1.2.1/src/ring/spatial.py +126 -0
  78. imt-ring-1.2.1/src/ring/sys_composer/__init__.py +5 -0
  79. imt-ring-1.2.1/src/ring/sys_composer/delete_sys.py +114 -0
  80. imt-ring-1.2.1/src/ring/sys_composer/inject_sys.py +110 -0
  81. imt-ring-1.2.1/src/ring/sys_composer/morph_sys.py +361 -0
  82. imt-ring-1.2.1/src/ring/utils/__init__.py +21 -0
  83. imt-ring-1.2.1/src/ring/utils/batchsize.py +51 -0
  84. imt-ring-1.2.1/src/ring/utils/colab.py +48 -0
  85. imt-ring-1.2.1/src/ring/utils/hdf5.py +198 -0
  86. imt-ring-1.2.1/src/ring/utils/normalizer.py +56 -0
  87. imt-ring-1.2.1/src/ring/utils/path.py +44 -0
  88. imt-ring-1.2.1/src/ring/utils/utils.py +161 -0
  89. imt-ring-1.2.1/tests/test_algebra.py +313 -0
  90. imt-ring-1.2.1/tests/test_base.py +111 -0
  91. imt-ring-1.2.1/tests/test_custom_joints.py +106 -0
  92. imt-ring-1.2.1/tests/test_dynamics.py +48 -0
  93. imt-ring-1.2.1/tests/test_generator.py +169 -0
  94. imt-ring-1.2.1/tests/test_jcalc.py +61 -0
  95. imt-ring-1.2.1/tests/test_jit.py +38 -0
  96. imt-ring-1.2.1/tests/test_kinematics.py +190 -0
  97. imt-ring-1.2.1/tests/test_maths.py +85 -0
  98. imt-ring-1.2.1/tests/test_ml_utils.py +157 -0
  99. imt-ring-1.2.1/tests/test_motion_artifacts.py +71 -0
  100. imt-ring-1.2.1/tests/test_pd_control.py +115 -0
  101. imt-ring-1.2.1/tests/test_random.py +84 -0
  102. imt-ring-1.2.1/tests/test_randomize.py +173 -0
  103. imt-ring-1.2.1/tests/test_rcmg.py +102 -0
  104. imt-ring-1.2.1/tests/test_render.py +49 -0
  105. imt-ring-1.2.1/tests/test_sensors.py +137 -0
  106. imt-ring-1.2.1/tests/test_sim2real.py +154 -0
  107. imt-ring-1.2.1/tests/test_sys_composer.py +224 -0
  108. imt-ring-1.2.1/tests/test_train.py +68 -0
  109. imt-ring-1.2.1/tests/test_utils.py +33 -0
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.1
2
+ Name: imt-ring
3
+ Version: 1.2.1
4
+ Summary: RING: Recurrent Inertial Graph-based Estimator
5
+ Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
+ Project-URL: Homepage, https://github.com/SimiPixel/ring
7
+ Project-URL: Issues, https://github.com/SimiPixel/ring/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: jaxlib
14
+ Requires-Dist: jax
15
+ Requires-Dist: jaxopt
16
+ Requires-Dist: numpy
17
+ Requires-Dist: flax
18
+ Requires-Dist: tqdm
19
+ Requires-Dist: wget
20
+ Requires-Dist: h5py
21
+ Requires-Dist: imt-tree-utils
22
+ Requires-Dist: wandb
23
+ Requires-Dist: optax
24
+ Requires-Dist: dm-haiku
25
+ Requires-Dist: joblib
26
+ Requires-Dist: pyyaml
27
+ Requires-Dist: qmt
28
+ Requires-Dist: scipy
29
+ Provides-Extra: dev
30
+ Requires-Dist: mkdocs; extra == "dev"
31
+ Requires-Dist: mkdocs-material; extra == "dev"
32
+ Requires-Dist: mkdocstrings; extra == "dev"
33
+ Requires-Dist: mkdocstrings-python; extra == "dev"
34
+ Requires-Dist: mknotebooks; extra == "dev"
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: pytest-xdist; extra == "dev"
37
+ Requires-Dist: nbmake; extra == "dev"
38
+
39
+ <p align="center">
40
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/icon.svg" height="200" />
41
+ </p>
42
+
43
+ # Recurrent Inertial Graph-based Estimator (RING)
44
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/coverage_badge.svg" height="20" />
45
+
46
+ ## Installation
47
+
48
+ Supports `Python=3.10/3.11/3.12` (tested).
49
+
50
+ Install with `pip` using
51
+
52
+ `pip install imt-ring`
53
+
54
+ Typically, this will install `jax` as cpu-only version. Afterwards, gpu-enabled version can be installed with
55
+ ```bash
56
+ pip install --upgrade "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
57
+ ```
58
+
59
+ ## Documentation
60
+
61
+ Available [here](https://simipixel.github.io/ring/).
62
+
63
+ ### Known fixes
64
+
65
+ #### Offscreen rendering with Mujoco
66
+
67
+ > mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called
68
+
69
+ Solution:
70
+
71
+ ```python
72
+ import os
73
+ os.environ["MUJOCO_GL"] = "egl"
74
+ ```
75
+
76
+ ## Publications
77
+
78
+ The following publications utilize this software library, and refer to it as the *Random Chain Motion Generator (RCMG)* (more specifically the function `ring.RCMG`):
79
+
80
+ - [*RNN-based Observability Analysis for Magnetometer-Free Sparse Inertial Motion Tracking*](https://ieeexplore.ieee.org/document/9841375)
81
+ - [*Plug-and-Play Sparse Inertial Motion Tracking With Sim-to-Real Transfer*](https://ieeexplore.ieee.org/document/10225275)
82
+ - [*RNN-based State and Parameter Estimation for Sparse Magnetometer-free Inertial Motion Tracking*](https://www.journals.infinite-science.de/index.php/automed/article/view/745)
83
+
84
+ ### Other useful ressources
85
+
86
+ Particularly useful is the following publication from *Roy Featherstone*
87
+ - [*A Beginner’s Guide to 6-D Vectors (Part 2)*](https://ieeexplore.ieee.org/document/5663690)
88
+
89
+ ## Contact
90
+
91
+ Simon Bachhuber (simon.bachhuber@fau.de)
@@ -0,0 +1,64 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "imt-ring"
7
+ version = "1.2.1"
8
+ authors = [
9
+ { name="Simon Bachhuber", email="simon.bachhuber@fau.de" },
10
+ ]
11
+ description = "RING: Recurrent Inertial Graph-based Estimator"
12
+ readme = "readme.md"
13
+ requires-python = ">=3.10"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ dependencies = [
20
+ "jaxlib",
21
+ "jax",
22
+ "jaxopt",
23
+ "numpy",
24
+ "flax",
25
+ "tqdm",
26
+ "wget",
27
+ "h5py",
28
+ "imt-tree-utils",
29
+ "wandb",
30
+ "optax",
31
+ "dm-haiku",
32
+ "joblib",
33
+ "pyyaml",
34
+ "qmt",
35
+ "scipy",
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ dev = [
40
+ "mkdocs",
41
+ "mkdocs-material",
42
+ "mkdocstrings",
43
+ "mkdocstrings-python",
44
+ "mknotebooks",
45
+ "pytest",
46
+ # for parallel test execution; $ pytest -n auto
47
+ "pytest-xdist",
48
+ # for testing of notebooks; $ pytest --nbmake **/*ipynb
49
+ "nbmake",
50
+ ]
51
+
52
+ [project.urls]
53
+ Homepage = "https://github.com/SimiPixel/ring"
54
+ Issues = "https://github.com/SimiPixel/ring/issues"
55
+
56
+ [tool.setuptools]
57
+ package-dir = {"" = "src"}
58
+
59
+ [tool.setuptools.packages.find]
60
+ where = ["src"]
61
+
62
+ [tool.setuptools.package-data]
63
+ "ring.io.examples" = ["**/*.xml"]
64
+ "ring.ml.params" = ["**/*.pickle"]
@@ -0,0 +1,53 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/icon.svg" height="200" />
3
+ </p>
4
+
5
+ # Recurrent Inertial Graph-based Estimator (RING)
6
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/coverage_badge.svg" height="20" />
7
+
8
+ ## Installation
9
+
10
+ Supports `Python=3.10/3.11/3.12` (tested).
11
+
12
+ Install with `pip` using
13
+
14
+ `pip install imt-ring`
15
+
16
+ Typically, this will install `jax` as cpu-only version. Afterwards, gpu-enabled version can be installed with
17
+ ```bash
18
+ pip install --upgrade "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
19
+ ```
20
+
21
+ ## Documentation
22
+
23
+ Available [here](https://simipixel.github.io/ring/).
24
+
25
+ ### Known fixes
26
+
27
+ #### Offscreen rendering with Mujoco
28
+
29
+ > mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called
30
+
31
+ Solution:
32
+
33
+ ```python
34
+ import os
35
+ os.environ["MUJOCO_GL"] = "egl"
36
+ ```
37
+
38
+ ## Publications
39
+
40
+ The following publications utilize this software library, and refer to it as the *Random Chain Motion Generator (RCMG)* (more specifically the function `ring.RCMG`):
41
+
42
+ - [*RNN-based Observability Analysis for Magnetometer-Free Sparse Inertial Motion Tracking*](https://ieeexplore.ieee.org/document/9841375)
43
+ - [*Plug-and-Play Sparse Inertial Motion Tracking With Sim-to-Real Transfer*](https://ieeexplore.ieee.org/document/10225275)
44
+ - [*RNN-based State and Parameter Estimation for Sparse Magnetometer-free Inertial Motion Tracking*](https://www.journals.infinite-science.de/index.php/automed/article/view/745)
45
+
46
+ ### Other useful ressources
47
+
48
+ Particularly useful is the following publication from *Roy Featherstone*
49
+ - [*A Beginner’s Guide to 6-D Vectors (Part 2)*](https://ieeexplore.ieee.org/document/5663690)
50
+
51
+ ## Contact
52
+
53
+ Simon Bachhuber (simon.bachhuber@fau.de)
@@ -0,0 +1,20 @@
1
+ [isort]
2
+ profile = google
3
+
4
+ [flake8]
5
+ max-line-length = 88
6
+ per-file-ignores =
7
+ __init__.py:F401
8
+ extend-ignore =
9
+ E731,
10
+ E203,
11
+ C901
12
+
13
+ [tool:pytest]
14
+ markers =
15
+ render: skip tests that use mujoco/vispy, because of Github Actions.
16
+
17
+ [egg_info]
18
+ tag_build =
19
+ tag_date = 0
20
+
@@ -0,0 +1,91 @@
1
+ Metadata-Version: 2.1
2
+ Name: imt-ring
3
+ Version: 1.2.1
4
+ Summary: RING: Recurrent Inertial Graph-based Estimator
5
+ Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
6
+ Project-URL: Homepage, https://github.com/SimiPixel/ring
7
+ Project-URL: Issues, https://github.com/SimiPixel/ring/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: jaxlib
14
+ Requires-Dist: jax
15
+ Requires-Dist: jaxopt
16
+ Requires-Dist: numpy
17
+ Requires-Dist: flax
18
+ Requires-Dist: tqdm
19
+ Requires-Dist: wget
20
+ Requires-Dist: h5py
21
+ Requires-Dist: imt-tree-utils
22
+ Requires-Dist: wandb
23
+ Requires-Dist: optax
24
+ Requires-Dist: dm-haiku
25
+ Requires-Dist: joblib
26
+ Requires-Dist: pyyaml
27
+ Requires-Dist: qmt
28
+ Requires-Dist: scipy
29
+ Provides-Extra: dev
30
+ Requires-Dist: mkdocs; extra == "dev"
31
+ Requires-Dist: mkdocs-material; extra == "dev"
32
+ Requires-Dist: mkdocstrings; extra == "dev"
33
+ Requires-Dist: mkdocstrings-python; extra == "dev"
34
+ Requires-Dist: mknotebooks; extra == "dev"
35
+ Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: pytest-xdist; extra == "dev"
37
+ Requires-Dist: nbmake; extra == "dev"
38
+
39
+ <p align="center">
40
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/icon.svg" height="200" />
41
+ </p>
42
+
43
+ # Recurrent Inertial Graph-based Estimator (RING)
44
+ <img src="https://raw.githubusercontent.com/SimiPixel/ring/main/docs/img/coverage_badge.svg" height="20" />
45
+
46
+ ## Installation
47
+
48
+ Supports `Python=3.10/3.11/3.12` (tested).
49
+
50
+ Install with `pip` using
51
+
52
+ `pip install imt-ring`
53
+
54
+ Typically, this will install `jax` as cpu-only version. Afterwards, gpu-enabled version can be installed with
55
+ ```bash
56
+ pip install --upgrade "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
57
+ ```
58
+
59
+ ## Documentation
60
+
61
+ Available [here](https://simipixel.github.io/ring/).
62
+
63
+ ### Known fixes
64
+
65
+ #### Offscreen rendering with Mujoco
66
+
67
+ > mujoco.FatalError: an OpenGL platform library has not been loaded into this process, this most likely means that a valid OpenGL context has not been created before mjr_makeContext was called
68
+
69
+ Solution:
70
+
71
+ ```python
72
+ import os
73
+ os.environ["MUJOCO_GL"] = "egl"
74
+ ```
75
+
76
+ ## Publications
77
+
78
+ The following publications utilize this software library, and refer to it as the *Random Chain Motion Generator (RCMG)* (more specifically the function `ring.RCMG`):
79
+
80
+ - [*RNN-based Observability Analysis for Magnetometer-Free Sparse Inertial Motion Tracking*](https://ieeexplore.ieee.org/document/9841375)
81
+ - [*Plug-and-Play Sparse Inertial Motion Tracking With Sim-to-Real Transfer*](https://ieeexplore.ieee.org/document/10225275)
82
+ - [*RNN-based State and Parameter Estimation for Sparse Magnetometer-free Inertial Motion Tracking*](https://www.journals.infinite-science.de/index.php/automed/article/view/745)
83
+
84
+ ### Other useful ressources
85
+
86
+ Particularly useful is the following publication from *Roy Featherstone*
87
+ - [*A Beginner’s Guide to 6-D Vectors (Part 2)*](https://ieeexplore.ieee.org/document/5663690)
88
+
89
+ ## Contact
90
+
91
+ Simon Bachhuber (simon.bachhuber@fau.de)
@@ -0,0 +1,108 @@
1
+ pyproject.toml
2
+ readme.md
3
+ setup.cfg
4
+ src/imt_ring.egg-info/PKG-INFO
5
+ src/imt_ring.egg-info/SOURCES.txt
6
+ src/imt_ring.egg-info/dependency_links.txt
7
+ src/imt_ring.egg-info/requires.txt
8
+ src/imt_ring.egg-info/top_level.txt
9
+ src/ring/__init__.py
10
+ src/ring/algebra.py
11
+ src/ring/base.py
12
+ src/ring/maths.py
13
+ src/ring/spatial.py
14
+ src/ring/algorithms/__init__.py
15
+ src/ring/algorithms/_random.py
16
+ src/ring/algorithms/dynamics.py
17
+ src/ring/algorithms/jcalc.py
18
+ src/ring/algorithms/kinematics.py
19
+ src/ring/algorithms/sensors.py
20
+ src/ring/algorithms/custom_joints/__init__.py
21
+ src/ring/algorithms/custom_joints/rr_imp_joint.py
22
+ src/ring/algorithms/custom_joints/rr_joint.py
23
+ src/ring/algorithms/custom_joints/suntay.py
24
+ src/ring/algorithms/generator/__init__.py
25
+ src/ring/algorithms/generator/base.py
26
+ src/ring/algorithms/generator/batch.py
27
+ src/ring/algorithms/generator/motion_artifacts.py
28
+ src/ring/algorithms/generator/pd_control.py
29
+ src/ring/algorithms/generator/randomize.py
30
+ src/ring/algorithms/generator/transforms.py
31
+ src/ring/algorithms/generator/types.py
32
+ src/ring/io/__init__.py
33
+ src/ring/io/examples.py
34
+ src/ring/io/test_examples.py
35
+ src/ring/io/examples/branched.xml
36
+ src/ring/io/examples/inv_pendulum.xml
37
+ src/ring/io/examples/knee_flexible_imus.xml
38
+ src/ring/io/examples/spherical_stiff.xml
39
+ src/ring/io/examples/symmetric.xml
40
+ src/ring/io/examples/test_all_1.xml
41
+ src/ring/io/examples/test_all_2.xml
42
+ src/ring/io/examples/test_ang0_pos0.xml
43
+ src/ring/io/examples/test_control.xml
44
+ src/ring/io/examples/test_double_pendulum.xml
45
+ src/ring/io/examples/test_free.xml
46
+ src/ring/io/examples/test_kinematics.xml
47
+ src/ring/io/examples/test_randomize_position.xml
48
+ src/ring/io/examples/test_sensors.xml
49
+ src/ring/io/examples/test_three_seg_seg2.xml
50
+ src/ring/io/examples/exclude/knee_trans_dof.xml
51
+ src/ring/io/examples/exclude/standard_sys.xml
52
+ src/ring/io/examples/exclude/standard_sys_rr_imp.xml
53
+ src/ring/io/examples/test_morph_system/four_seg_seg1.xml
54
+ src/ring/io/examples/test_morph_system/four_seg_seg3.xml
55
+ src/ring/io/xml/__init__.py
56
+ src/ring/io/xml/abstract.py
57
+ src/ring/io/xml/from_xml.py
58
+ src/ring/io/xml/test_from_xml.py
59
+ src/ring/io/xml/test_to_xml.py
60
+ src/ring/io/xml/to_xml.py
61
+ src/ring/ml/__init__.py
62
+ src/ring/ml/base.py
63
+ src/ring/ml/callbacks.py
64
+ src/ring/ml/ml_utils.py
65
+ src/ring/ml/optimizer.py
66
+ src/ring/ml/ringnet.py
67
+ src/ring/ml/train.py
68
+ src/ring/ml/training_loop.py
69
+ src/ring/ml/params/0x13e3518065c21cd8.pickle
70
+ src/ring/rendering/__init__.py
71
+ src/ring/rendering/base_render.py
72
+ src/ring/rendering/mujoco_render.py
73
+ src/ring/rendering/vispy_render.py
74
+ src/ring/rendering/vispy_visuals.py
75
+ src/ring/sim2real/__init__.py
76
+ src/ring/sim2real/sim2real.py
77
+ src/ring/sys_composer/__init__.py
78
+ src/ring/sys_composer/delete_sys.py
79
+ src/ring/sys_composer/inject_sys.py
80
+ src/ring/sys_composer/morph_sys.py
81
+ src/ring/utils/__init__.py
82
+ src/ring/utils/batchsize.py
83
+ src/ring/utils/colab.py
84
+ src/ring/utils/hdf5.py
85
+ src/ring/utils/normalizer.py
86
+ src/ring/utils/path.py
87
+ src/ring/utils/utils.py
88
+ tests/test_algebra.py
89
+ tests/test_base.py
90
+ tests/test_custom_joints.py
91
+ tests/test_dynamics.py
92
+ tests/test_generator.py
93
+ tests/test_jcalc.py
94
+ tests/test_jit.py
95
+ tests/test_kinematics.py
96
+ tests/test_maths.py
97
+ tests/test_ml_utils.py
98
+ tests/test_motion_artifacts.py
99
+ tests/test_pd_control.py
100
+ tests/test_random.py
101
+ tests/test_randomize.py
102
+ tests/test_rcmg.py
103
+ tests/test_render.py
104
+ tests/test_sensors.py
105
+ tests/test_sim2real.py
106
+ tests/test_sys_composer.py
107
+ tests/test_train.py
108
+ tests/test_utils.py
@@ -0,0 +1,26 @@
1
+ jaxlib
2
+ jax
3
+ jaxopt
4
+ numpy
5
+ flax
6
+ tqdm
7
+ wget
8
+ h5py
9
+ imt-tree-utils
10
+ wandb
11
+ optax
12
+ dm-haiku
13
+ joblib
14
+ pyyaml
15
+ qmt
16
+ scipy
17
+
18
+ [dev]
19
+ mkdocs
20
+ mkdocs-material
21
+ mkdocstrings
22
+ mkdocstrings-python
23
+ mknotebooks
24
+ pytest
25
+ pytest-xdist
26
+ nbmake
@@ -0,0 +1,63 @@
1
+ from . import algebra
2
+ from . import algorithms
3
+ from . import base
4
+ from . import io
5
+ from . import maths
6
+ from . import ml
7
+ from . import rendering
8
+ from . import sim2real
9
+ from . import spatial
10
+ from . import sys_composer
11
+ from . import utils
12
+ from .algorithms import join_motionconfigs
13
+ from .algorithms import JointModel
14
+ from .algorithms import MotionConfig
15
+ from .algorithms import RCMG
16
+ from .algorithms import register_new_joint_type
17
+ from .algorithms import step
18
+ from .base import State
19
+ from .base import System
20
+ from .base import Transform
21
+ from .ml import RING
22
+
23
+ _TRAIN_TIMING_START = None
24
+ _UNIQUE_ID = None
25
+
26
+
27
+ def setup(
28
+ rr_joint_kwargs: None | dict = dict(),
29
+ rr_imp_joint_kwargs: None | dict = dict(),
30
+ suntay_joint_kwargs: None | dict = None,
31
+ train_timing_start: None | float = None,
32
+ unique_id: None | str = None,
33
+ ):
34
+ import time
35
+
36
+ from ring.algorithms import custom_joints
37
+
38
+ global _TRAIN_TIMING_START
39
+ global _UNIQUE_ID
40
+
41
+ if rr_joint_kwargs is not None:
42
+ custom_joints.register_rr_joint(**rr_joint_kwargs)
43
+
44
+ if rr_imp_joint_kwargs is not None:
45
+ custom_joints.register_rr_imp_joint(**rr_imp_joint_kwargs)
46
+
47
+ if suntay_joint_kwargs is not None:
48
+ custom_joints.register_suntay(**suntay_joint_kwargs)
49
+
50
+ if _TRAIN_TIMING_START is None:
51
+ _TRAIN_TIMING_START = time.time()
52
+
53
+ if train_timing_start is not None:
54
+ _TRAIN_TIMING_START = train_timing_start
55
+
56
+ if _UNIQUE_ID is None:
57
+ _UNIQUE_ID = hex(hash(time.time()))
58
+
59
+ if unique_id is not None:
60
+ _UNIQUE_ID = unique_id
61
+
62
+
63
+ setup()
@@ -0,0 +1,100 @@
1
+ import jax.numpy as jnp
2
+ from ring import base
3
+ from ring import maths
4
+ from ring import spatial
5
+
6
+
7
+ def inertia_mul_motion(it: base.Inertia, m: base.Motion) -> base.Force:
8
+ ang = it.it_3x3 @ m.ang + jnp.cross(it.h, m.vel)
9
+ vel = it.mass * m.vel - jnp.cross(it.h, m.ang)
10
+ return base.Force(ang, vel)
11
+
12
+
13
+ def motion_dot(m: base.Motion, f: base.Force) -> base.Scalar:
14
+ return m.ang @ f.ang + m.vel @ f.vel
15
+
16
+
17
+ def motion_cross(m1: base.Motion, m2: base.Motion) -> base.Motion:
18
+ ang = jnp.cross(m1.ang, m2.ang)
19
+ vel = jnp.cross(m1.ang, m2.vel) + jnp.cross(m1.vel, m2.ang)
20
+ return base.Motion(ang, vel)
21
+
22
+
23
+ def motion_cross_star(m: base.Motion, f: base.Force) -> base.Force:
24
+ ang = jnp.cross(m.ang, f.ang) + jnp.cross(m.vel, f.vel)
25
+ vel = jnp.cross(m.ang, f.vel)
26
+ return base.Force(ang, vel)
27
+
28
+
29
+ def transform_mul(t2: base.Transform, t1: base.Transform) -> base.Transform:
30
+ """Chains two transformations `t1` and `t2`.
31
+ t1: Plücker A -> Plücker B,
32
+ t2: Plücker B -> Plücker C
33
+ =>
34
+ Returns: Plücker A -> Plücker C
35
+ """
36
+ pos = t1.pos + maths.rotate(t2.pos, maths.quat_inv(t1.rot))
37
+ rot = maths.quat_mul(t2.rot, t1.rot)
38
+ return base.Transform(pos, rot)
39
+
40
+
41
+ def transform_inv(t: base.Transform) -> base.Transform:
42
+ "Inverts the transform. A -> B becomes B -> A"
43
+ pos = maths.rotate(-t.pos, t.rot)
44
+ rot = maths.quat_inv(t.rot)
45
+ return base.Transform(pos, rot)
46
+
47
+
48
+ def transform_move_into_frame(
49
+ t: base.Transform, new_frame: base.Transform
50
+ ) -> base.Transform:
51
+ """Express transform `t`: A -> B, in frame C using `new_frame`: A -> C.
52
+
53
+ Suppose you are given a transform `t` that maps from A -> B.
54
+ Then, you think of this operation as something abstract.
55
+ Then, you want to do this operation that maps from A -> B but
56
+ apply it in frame C. The connection between A -> C is given by `new_frame`.
57
+ """
58
+ q_C_to_A = new_frame.rot
59
+ rot = maths.rotate_quat(t.rot, q_C_to_A)
60
+ pos = maths.rotate(t.pos, q_C_to_A)
61
+ return base.Transform(pos, rot)
62
+
63
+
64
+ def transform_motion(t: base.Transform, m: base.Motion) -> base.Motion:
65
+ """Transforms motion vector `m`.
66
+ t: Plücker A -> Plücker B,
67
+ m: Plücker A
68
+ =>
69
+ Returns: m in Plücker B
70
+ """
71
+ ang = maths.rotate(m.ang, t.rot)
72
+ vel = maths.rotate(-jnp.cross(t.pos, m.ang) + m.vel, t.rot)
73
+ return base.Motion(ang, vel)
74
+
75
+
76
+ def transform_force(t: base.Transform, f: base.Force) -> base.Force:
77
+ """Transforms force vector `f`.
78
+ t: Plücker A -> Plücker B,
79
+ f: Plücker A
80
+ =>
81
+ Returns: f in Plücker B
82
+ """
83
+ ang = maths.rotate(f.ang - jnp.cross(t.pos, f.vel), t.rot)
84
+ vel = maths.rotate(f.vel, t.rot)
85
+ return base.Force(ang, vel)
86
+
87
+
88
+ def transform_inertia(t: base.Transform, it: base.Inertia) -> base.Inertia:
89
+ "Transforms inertia matrix `it`"
90
+ r = t.pos
91
+ I_ = it.it_3x3
92
+ rcross = spatial.cross(r)
93
+
94
+ hmr = it.h - it.mass * t.pos
95
+ new_h = maths.rotate(hmr, t.rot)
96
+ new_it_3x3 = maths.rotate_matrix(
97
+ I_ + rcross @ spatial.cross(it.h) + spatial.cross(hmr) @ rcross,
98
+ t.rot,
99
+ )
100
+ return base.Inertia(new_it_3x3, new_h, it.mass)
@@ -0,0 +1,45 @@
1
+ from . import _random
2
+ from . import dynamics
3
+ from . import generator
4
+ from . import jcalc
5
+ from . import kinematics
6
+ from . import sensors
7
+ from ._random import random_angle_over_time
8
+ from ._random import random_position_over_time
9
+ from .dynamics import compute_mass_matrix
10
+ from .dynamics import forward_dynamics
11
+ from .dynamics import inverse_dynamics
12
+ from .dynamics import step
13
+ from .generator import batch_generators_eager
14
+ from .generator import batch_generators_eager_to_list
15
+ from .generator import batch_generators_lazy
16
+ from .generator import batched_generator_from_list
17
+ from .generator import batched_generator_from_paths
18
+ from .generator import FINALIZE_FN
19
+ from .generator import Generator
20
+ from .generator import GeneratorPipe
21
+ from .generator import GeneratorTrafo
22
+ from .generator import GeneratorTrafoExpandFlatten
23
+ from .generator import GeneratorTrafoRandomizePositions
24
+ from .generator import GeneratorTrafoRemoveInputExtras
25
+ from .generator import GeneratorTrafoRemoveOutputExtras
26
+ from .generator import RCMG
27
+ from .generator import SETUP_FN
28
+ from .jcalc import get_joint_model
29
+ from .jcalc import jcalc_motion
30
+ from .jcalc import jcalc_tau
31
+ from .jcalc import jcalc_transform
32
+ from .jcalc import join_motionconfigs
33
+ from .jcalc import JointModel
34
+ from .jcalc import MotionConfig
35
+ from .jcalc import register_new_joint_type
36
+ from .kinematics import forward_kinematics
37
+ from .kinematics import forward_kinematics_transforms
38
+ from .kinematics import inverse_kinematics
39
+ from .kinematics import inverse_kinematics_endeffector
40
+ from .sensors import accelerometer
41
+ from .sensors import add_noise_bias
42
+ from .sensors import gyroscope
43
+ from .sensors import imu
44
+ from .sensors import joint_axes
45
+ from .sensors import rel_pose