imt-ring 1.2.1__py3-none-any.whl

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 (83) hide show
  1. imt_ring-1.2.1.dist-info/METADATA +91 -0
  2. imt_ring-1.2.1.dist-info/RECORD +83 -0
  3. imt_ring-1.2.1.dist-info/WHEEL +5 -0
  4. imt_ring-1.2.1.dist-info/top_level.txt +1 -0
  5. ring/__init__.py +63 -0
  6. ring/algebra.py +100 -0
  7. ring/algorithms/__init__.py +45 -0
  8. ring/algorithms/_random.py +403 -0
  9. ring/algorithms/custom_joints/__init__.py +6 -0
  10. ring/algorithms/custom_joints/rr_imp_joint.py +69 -0
  11. ring/algorithms/custom_joints/rr_joint.py +33 -0
  12. ring/algorithms/custom_joints/suntay.py +424 -0
  13. ring/algorithms/dynamics.py +345 -0
  14. ring/algorithms/generator/__init__.py +25 -0
  15. ring/algorithms/generator/base.py +414 -0
  16. ring/algorithms/generator/batch.py +282 -0
  17. ring/algorithms/generator/motion_artifacts.py +222 -0
  18. ring/algorithms/generator/pd_control.py +182 -0
  19. ring/algorithms/generator/randomize.py +119 -0
  20. ring/algorithms/generator/transforms.py +410 -0
  21. ring/algorithms/generator/types.py +36 -0
  22. ring/algorithms/jcalc.py +840 -0
  23. ring/algorithms/kinematics.py +202 -0
  24. ring/algorithms/sensors.py +582 -0
  25. ring/base.py +1046 -0
  26. ring/io/__init__.py +9 -0
  27. ring/io/examples/branched.xml +24 -0
  28. ring/io/examples/exclude/knee_trans_dof.xml +26 -0
  29. ring/io/examples/exclude/standard_sys.xml +106 -0
  30. ring/io/examples/exclude/standard_sys_rr_imp.xml +106 -0
  31. ring/io/examples/inv_pendulum.xml +14 -0
  32. ring/io/examples/knee_flexible_imus.xml +22 -0
  33. ring/io/examples/spherical_stiff.xml +11 -0
  34. ring/io/examples/symmetric.xml +12 -0
  35. ring/io/examples/test_all_1.xml +39 -0
  36. ring/io/examples/test_all_2.xml +39 -0
  37. ring/io/examples/test_ang0_pos0.xml +9 -0
  38. ring/io/examples/test_control.xml +16 -0
  39. ring/io/examples/test_double_pendulum.xml +14 -0
  40. ring/io/examples/test_free.xml +11 -0
  41. ring/io/examples/test_kinematics.xml +23 -0
  42. ring/io/examples/test_morph_system/four_seg_seg1.xml +26 -0
  43. ring/io/examples/test_morph_system/four_seg_seg3.xml +26 -0
  44. ring/io/examples/test_randomize_position.xml +26 -0
  45. ring/io/examples/test_sensors.xml +13 -0
  46. ring/io/examples/test_three_seg_seg2.xml +23 -0
  47. ring/io/examples.py +42 -0
  48. ring/io/test_examples.py +6 -0
  49. ring/io/xml/__init__.py +6 -0
  50. ring/io/xml/abstract.py +300 -0
  51. ring/io/xml/from_xml.py +299 -0
  52. ring/io/xml/test_from_xml.py +56 -0
  53. ring/io/xml/test_to_xml.py +31 -0
  54. ring/io/xml/to_xml.py +94 -0
  55. ring/maths.py +397 -0
  56. ring/ml/__init__.py +33 -0
  57. ring/ml/base.py +292 -0
  58. ring/ml/callbacks.py +434 -0
  59. ring/ml/ml_utils.py +272 -0
  60. ring/ml/optimizer.py +149 -0
  61. ring/ml/params/0x13e3518065c21cd8.pickle +0 -0
  62. ring/ml/ringnet.py +279 -0
  63. ring/ml/train.py +318 -0
  64. ring/ml/training_loop.py +131 -0
  65. ring/rendering/__init__.py +2 -0
  66. ring/rendering/base_render.py +271 -0
  67. ring/rendering/mujoco_render.py +222 -0
  68. ring/rendering/vispy_render.py +340 -0
  69. ring/rendering/vispy_visuals.py +290 -0
  70. ring/sim2real/__init__.py +7 -0
  71. ring/sim2real/sim2real.py +288 -0
  72. ring/spatial.py +126 -0
  73. ring/sys_composer/__init__.py +5 -0
  74. ring/sys_composer/delete_sys.py +114 -0
  75. ring/sys_composer/inject_sys.py +110 -0
  76. ring/sys_composer/morph_sys.py +361 -0
  77. ring/utils/__init__.py +21 -0
  78. ring/utils/batchsize.py +51 -0
  79. ring/utils/colab.py +48 -0
  80. ring/utils/hdf5.py +198 -0
  81. ring/utils/normalizer.py +56 -0
  82. ring/utils/path.py +44 -0
  83. ring/utils/utils.py +161 -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,83 @@
1
+ ring/__init__.py,sha256=iNvbAZi7Qfa69IbL1z4lB7zHL8WusV5fBrKah2la-Gc,1566
2
+ ring/algebra.py,sha256=F0GwbP8LQP5qGVkoMUYJmkp9Hn2nKAVIkCVYDEjNjGU,3128
3
+ ring/base.py,sha256=lG1SAVi6VpJT20Xvdhv_NrObMb4008leEqPEaQ0anR8,33566
4
+ ring/maths.py,sha256=jJr_kr78-XDce8B4tXQ2Li-jBntVQhaS8csxglCsj8A,12193
5
+ ring/spatial.py,sha256=nmZ-UhRanhyM34bez8uCS4wMwaKqLkuEbgKGP5XNH60,2351
6
+ ring/algorithms/__init__.py,sha256=t3YXcgqMJxadUjFiILVD0HlQRPLdrQyc8aKiB36w0vE,1701
7
+ ring/algorithms/_random.py,sha256=6EG0GHYe6tCq0qUt4Jes8W1EaqqaLa0sSZhnwBbEjCE,13340
8
+ ring/algorithms/dynamics.py,sha256=nqq5I0RYSbHNlGiLMlohz08IfL9Njsrid4upDnwkGbI,10629
9
+ ring/algorithms/jcalc.py,sha256=6bO-_zFbHGDG5oq0t-HZvOSiYSWmZz_k6Z6VlNmSThA,25270
10
+ ring/algorithms/kinematics.py,sha256=DOboHI517Vx0pRJUFZtZPmK_qFaiKiQe-37B-M0aC-c,7422
11
+ ring/algorithms/sensors.py,sha256=Y3Wo9qj3BWKoIHB0V04QwyD-Z5m4BrAjfBX8Pn6y9Lg,18005
12
+ ring/algorithms/custom_joints/__init__.py,sha256=33WBnaBJMtq3vVcpMm7zmyeMrLY9PyV_8-wk5oSF65g,227
13
+ ring/algorithms/custom_joints/rr_imp_joint.py,sha256=a3JT0w7pB94kZ95eBR8ZO853eSeyjFoiXmhYlaXoHDE,2392
14
+ ring/algorithms/custom_joints/rr_joint.py,sha256=jnRtjtOCALMaq2_0bcu2d7qgfQ6etXpoh43MioRaDmY,1000
15
+ ring/algorithms/custom_joints/suntay.py,sha256=dhkuXGhQ-NLVrd5rRXotrJhNfUYd-C8T02GkIB7w5hA,13139
16
+ ring/algorithms/generator/__init__.py,sha256=p4ucl0zQtp5NwNoXIRjmTzGGRu2WOAWFfNmYRPwQles,912
17
+ ring/algorithms/generator/base.py,sha256=QDmzMAgtaK5M9WDl39qjXYfBa99d83vCPWEkYYmsplk,14952
18
+ ring/algorithms/generator/batch.py,sha256=MZurZmQDH1vncoNbCspVNGNlfP0R87J6_HC7MMIqQ6A,8478
19
+ ring/algorithms/generator/motion_artifacts.py,sha256=-VUcTMd1UW2oTKM8pnPvPjr988T6SXMyMU3JdKfnHpk,7995
20
+ ring/algorithms/generator/pd_control.py,sha256=3pOaYig26vmp8gippDfy2KNJRZO3kr0rGd_PBIuEROM,5759
21
+ ring/algorithms/generator/randomize.py,sha256=G_vBIo0OwQkXL2u0djwbaoaeb02C4LQCTNNloOYIU2M,3699
22
+ ring/algorithms/generator/transforms.py,sha256=3oQtqRFcnJBtuf1_ihsYej3uwNKBlRucaJDxcdEisTs,12748
23
+ ring/algorithms/generator/types.py,sha256=CAhvDK5qiHnrGtkCVccB07doiz_D6lHJ35B7sW0pyZA,1110
24
+ ring/io/__init__.py,sha256=1gEJdyDCbldbbm8QeZbLmhzSKmaQ-UqTmQgu4DBH2Z4,328
25
+ ring/io/examples.py,sha256=KLf2iCagvRfjs9MCnQsLUlfGBjrQKrD-Qv8U0TtX6Ek,1114
26
+ ring/io/test_examples.py,sha256=htpnSgLG9Fi9_qwSL4F1yLi9sN7ZUrF8dDmiqU3B510,117
27
+ ring/io/examples/branched.xml,sha256=k2w5Klqe6lY9O5OHuEIvCmsX3ZTYc_QuoaC7ZnR0oyA,723
28
+ ring/io/examples/inv_pendulum.xml,sha256=Mm_ILpYzrk1oNUmzXZTaWk-wQ6nR_YKc8p_13KhzpSQ,524
29
+ ring/io/examples/knee_flexible_imus.xml,sha256=2Dp3yfeoEW_Sj1NYcSDhxL9ROmZlThs7isU_3m4x0HE,1162
30
+ ring/io/examples/spherical_stiff.xml,sha256=L50pfHBHsecEaP7t2ifGMQHzDVXUVsnhKa8TFvrHkEc,392
31
+ ring/io/examples/symmetric.xml,sha256=9azy15NffPTWGIWFCN4-S9H-IbQ4Y3V-SBvaII_K8V8,414
32
+ ring/io/examples/test_all_1.xml,sha256=h6csBUuRPISDTzPMQgu2dO2kNGe19Q2I1sFWTTWtf7U,1395
33
+ ring/io/examples/test_all_2.xml,sha256=GMoOqpG6TQCh0a7qAzizPMDXY6v39Z-F2Tq_6i6mDVI,1394
34
+ ring/io/examples/test_ang0_pos0.xml,sha256=yxSMRH4h9xC2im3x9w0gvrBc2NIRNKWOL3ITW8Njbxk,258
35
+ ring/io/examples/test_control.xml,sha256=BOEC5Px0ktilqY2PavC1vItR8AEt6AzbiVarg7mY7o4,663
36
+ ring/io/examples/test_double_pendulum.xml,sha256=l0chPfpnGbQoQ4txAF2DxM_hI5_w1xmoMEV81oZNdLg,555
37
+ ring/io/examples/test_free.xml,sha256=wZXGm3-9XWzeEjsfiDi-jxJMSgPcN9olJiHyykpvL-o,312
38
+ ring/io/examples/test_kinematics.xml,sha256=0fRf0M0e8y8UKKrVkqlaWNNXqi4pPYriqd-x0vgyiLs,694
39
+ ring/io/examples/test_randomize_position.xml,sha256=h6Yo5tT8QJBOJEwhE0cpppF-rvbOd0bHgmTt90NjzZU,1329
40
+ ring/io/examples/test_sensors.xml,sha256=urI_19gzwpDyWjtnse1Iy7CWCB0ezbsDP7FMLFlNw_4,494
41
+ ring/io/examples/test_three_seg_seg2.xml,sha256=g85tx4V6PahkSbYXKWqk5vqurLos15WB6tBm1dQ_V_o,1022
42
+ ring/io/examples/exclude/knee_trans_dof.xml,sha256=4Cuv6c7Yqa4T-RirRbrJKTT_41vRTuDlLPRLE_NopjU,1379
43
+ ring/io/examples/exclude/standard_sys.xml,sha256=zTn_TVOBVmp0rq-g3aOOpjxHt6lTvPOKlHdvvqEGm-Y,8967
44
+ ring/io/examples/exclude/standard_sys_rr_imp.xml,sha256=6aR_eA8RGfAMi36xojn5KyXdSSwAnc9sEotB0ukaPQM,9015
45
+ ring/io/examples/test_morph_system/four_seg_seg1.xml,sha256=XJvGtEnvedejs_OmCVfQULWJNK8MLDQQ3raqPNRCJbA,1283
46
+ ring/io/examples/test_morph_system/four_seg_seg3.xml,sha256=HktN7_a_Ly3YflWit5W-WncxApWGMORAGnRXyMEqnoA,1265
47
+ ring/io/xml/__init__.py,sha256=-3k6ffvFyc4zm0oTyVz3ez-o3Lb9bPp2sjwSub_K1AA,242
48
+ ring/io/xml/abstract.py,sha256=ojsXgz15J4pI1FThUIZbB_Iw1wmR9cOHt5Thmcbih4I,9721
49
+ ring/io/xml/from_xml.py,sha256=8b44sPVWgoY8JGJZLpJ8M_eLfcfu3IsMtBzSytPTPmw,9234
50
+ ring/io/xml/test_from_xml.py,sha256=bckVrVVmEhCwujd_OF9FGYnX3zU3BgztpqGxxmd0htM,1562
51
+ ring/io/xml/test_to_xml.py,sha256=NGn4VSiFdwhYN5YTBduWMiY9B5dwtxZhCQAR_PXeqKU,946
52
+ ring/io/xml/to_xml.py,sha256=fohb-jWMf2cxVdT5dmknsGyrNMseICSbKEz_urbaWbQ,3407
53
+ ring/ml/__init__.py,sha256=669ueX_IMTmhAE-4xCjjp90mTlj28u8voq5_5KE0ZY0,944
54
+ ring/ml/base.py,sha256=5TpJtdfmlAv2j_f8yDW1U_wY4jZ2lA74pNR524JQTts,8905
55
+ ring/ml/callbacks.py,sha256=qdMp572UTfwf4pUEfziur1kZ5yWBEAblaxDOjpEMfnE,13108
56
+ ring/ml/ml_utils.py,sha256=hQEmeZoahdJyFrz0NZXYi1Yijl7GvPBdqwzZBzlUIUM,7638
57
+ ring/ml/optimizer.py,sha256=OP70P70YcX-2Z-cuoMluFk-L5Vhh_MmqiHdM9OZqyhI,4703
58
+ ring/ml/ringnet.py,sha256=OWRDu2COmptzbpJWlRLbPIn_ioKZCAd_iu-eiY_aPjk,8521
59
+ ring/ml/train.py,sha256=ftt2MOSSNGCdL7ZoAXcbIgeHW1Wkpgp6XYyLIBUIClI,10872
60
+ ring/ml/training_loop.py,sha256=CEokvPQuuk_WCd-J60ZDodJYcPVvyxLfgXDr_DnbzRI,3359
61
+ ring/ml/params/0x13e3518065c21cd8.pickle,sha256=Zh2k1zK-TNxJl5F7nyTeQ9001qqRE_dfvaq1HWV287A,9355838
62
+ ring/rendering/__init__.py,sha256=Zf7qOdzK3t2hljIrs5P4zFhzHljLSMRyDDZO2YlZk4k,75
63
+ ring/rendering/base_render.py,sha256=c3NTRE0VjnWmcHqCalvfQhCwiPyoMRr_2eiU04Y-mzU,8764
64
+ ring/rendering/mujoco_render.py,sha256=aluzQJp3jrDdPfAyNmQuXIHRfgfBTCCZQqxKOx_0D2s,7770
65
+ ring/rendering/vispy_render.py,sha256=QmRyA7Hqk3uS1SKjcncwc4_vd1m4yWryW2X0i4jRvCw,10260
66
+ ring/rendering/vispy_visuals.py,sha256=ooBZqppnebeL0ANe6V6zUgnNTtDcdkOsa4vZuM4sx-I,7873
67
+ ring/sim2real/__init__.py,sha256=gCLYg8IoMdzUagzhCFcfjZ5GavtIU772L7HR0G5hUtM,251
68
+ ring/sim2real/sim2real.py,sha256=B4nqBBnjGXhM-7PfTyxEq44ZidGNghqaq--qdFILX5A,9675
69
+ ring/sys_composer/__init__.py,sha256=5J_JJJIHfTPcpxh0v4FqiOs81V1REPUd7pgiw2nAN5E,193
70
+ ring/sys_composer/delete_sys.py,sha256=cIM9KbyLfg7B9121g7yjzuFbjeNu9cil1dPavAYEgzk,3408
71
+ ring/sys_composer/inject_sys.py,sha256=Mj-q-mUjXKwkg-ol6IQAjf9IJfk7pGhez0_WoTKTgm0,3503
72
+ ring/sys_composer/morph_sys.py,sha256=2GpPtS5hT0eZMptdGpt30Hc97OykJNE67lEVRf7sHrc,12700
73
+ ring/utils/__init__.py,sha256=6BWUMmbQ4E-Qwd-SNfRlpbzJ0UJ1DpEclstrgbLdDvk,773
74
+ ring/utils/batchsize.py,sha256=mPFGD7AedFMycHtyIuZtNWCaAvKLLWSWaB7X6u54xvM,1358
75
+ ring/utils/colab.py,sha256=ZLHwP0jNQUsmZJU4l68a5djULPi6T-jYNNHevjIoMn8,1631
76
+ ring/utils/hdf5.py,sha256=BzXwVypZmEZeHVgeGZ78YYdi10NEQtnPhdrb8dQAXo0,5856
77
+ ring/utils/normalizer.py,sha256=67L2BU1MRsMT4pD41ta3JJMppLN0ozFmnwrmXDtnqrQ,1698
78
+ ring/utils/path.py,sha256=hAfSlqRi-ew536RnjDDM7IKapdMJc-EvhrR0Y-BCFWc,1265
79
+ ring/utils/utils.py,sha256=AzOzR95oOyfdtJhjt5iIb35u611NlTb1Ds4QDKrGMOM,4967
80
+ imt_ring-1.2.1.dist-info/METADATA,sha256=ql3agJfHytG7YejDfuifrhleUAwEUQnSuWTz3FJf13U,3104
81
+ imt_ring-1.2.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
82
+ imt_ring-1.2.1.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
83
+ imt_ring-1.2.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.43.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ ring
ring/__init__.py ADDED
@@ -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()
ring/algebra.py ADDED
@@ -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