imt-ring 1.6.27__py3-none-any.whl → 1.6.29__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {imt_ring-1.6.27.dist-info → imt_ring-1.6.29.dist-info}/METADATA +5 -1
- {imt_ring-1.6.27.dist-info → imt_ring-1.6.29.dist-info}/RECORD +10 -10
- ring/__init__.py +4 -1
- ring/algorithms/generator/base.py +10 -1
- ring/base.py +4 -3
- ring/io/xml/to_xml.py +4 -3
- ring/maths.py +13 -0
- ring/rendering/mujoco_render.py +9 -2
- {imt_ring-1.6.27.dist-info → imt_ring-1.6.29.dist-info}/WHEEL +0 -0
- {imt_ring-1.6.27.dist-info → imt_ring-1.6.29.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: imt-ring
|
3
|
-
Version: 1.6.
|
3
|
+
Version: 1.6.29
|
4
4
|
Summary: RING: Recurrent Inertial Graph-based Estimator
|
5
5
|
Author-email: Simon Bachhuber <simon.bachhuber@fau.de>
|
6
6
|
Project-URL: Homepage, https://github.com/SimiPixel/ring
|
@@ -38,6 +38,10 @@ Requires-Dist: nbmake; extra == "dev"
|
|
38
38
|
# Recurrent Inertial Graph-based Estimator (RING)
|
39
39
|
<img src="https://raw.githubusercontent.com/simon-bachhuber/ring/main/docs/img/coverage_badge.svg" height="20" />
|
40
40
|
|
41
|
+
> **ℹ️ Tip:**
|
42
|
+
>
|
43
|
+
> Check out my new plug-and-play interface for inertial motion tracking (RING included) [here](https://github.com/simon-bachhuber/imt.git).
|
44
|
+
|
41
45
|
## Installation
|
42
46
|
|
43
47
|
Supports `Python=3.10/3.11/3.12` (tested).
|
@@ -1,7 +1,7 @@
|
|
1
|
-
ring/__init__.py,sha256=
|
1
|
+
ring/__init__.py,sha256=H1Rd2uXVkux4Z792XyHIkQ8OpDSZBiPqFwyAFDWDU3E,5260
|
2
2
|
ring/algebra.py,sha256=F0GwbP8LQP5qGVkoMUYJmkp9Hn2nKAVIkCVYDEjNjGU,3128
|
3
|
-
ring/base.py,sha256=
|
4
|
-
ring/maths.py,sha256=
|
3
|
+
ring/base.py,sha256=_TgFrggsZfam0VPxvD4J5xp977vgiLnKTlDIJVzik5M,35362
|
4
|
+
ring/maths.py,sha256=R22SNQutkf9v7Hp9klo0wvJVIyBQz0O8_5oJaDQcFis,12652
|
5
5
|
ring/spatial.py,sha256=nmZ-UhRanhyM34bez8uCS4wMwaKqLkuEbgKGP5XNH60,2351
|
6
6
|
ring/algorithms/__init__.py,sha256=IiK9EN5Xgs3dB075-A-H-Yad0Z7vzvKIJF2g6X_-C_8,1224
|
7
7
|
ring/algorithms/_random.py,sha256=UMyv-VPZLcErrKqs0XB83QJjs8GrmoNsv-zRSxGXvnI,14490
|
@@ -15,7 +15,7 @@ ring/algorithms/custom_joints/rr_joint.py,sha256=jnRtjtOCALMaq2_0bcu2d7qgfQ6etXp
|
|
15
15
|
ring/algorithms/custom_joints/rsaddle_joint.py,sha256=QoMo6NXdYgA9JygSzBvr0eCdd3qKhUgCrGPNO2Qdxko,1200
|
16
16
|
ring/algorithms/custom_joints/suntay.py,sha256=tOEGM304XciHO4pmvxr4faA4xXVO4N2HlPdFmXKbcrw,16726
|
17
17
|
ring/algorithms/generator/__init__.py,sha256=bF-CW3x2x-o6KWESKy-DuxzZPh3UNSjJb_MaAcSHGsQ,277
|
18
|
-
ring/algorithms/generator/base.py,sha256=
|
18
|
+
ring/algorithms/generator/base.py,sha256=rrhHg6lFPDJs72kXvzF15v1vzkaUTKtCnpcmWZONYA8,16847
|
19
19
|
ring/algorithms/generator/batch.py,sha256=9yFxVv11hij-fJXGPxA3zEh1bE2_jrZk0R7kyGaiM5c,2551
|
20
20
|
ring/algorithms/generator/finalize_fns.py,sha256=nY2RKiLbHriTkdec94lc4UGSZKd0v547MDNn4dr8I3E,10398
|
21
21
|
ring/algorithms/generator/motion_artifacts.py,sha256=2VJbldVDbI3PSyboshIbtYvSAKzBBwGV7cQfYjqvluM,9167
|
@@ -50,7 +50,7 @@ ring/io/xml/abstract.py,sha256=8Q2ebnUYLmuS9HJAQwDVrDTrRfD5z4G5RAB7MW8Oa60,9742
|
|
50
50
|
ring/io/xml/from_xml.py,sha256=E7JQl_scL5U4LK6mqLMr5qaiZCc6J1fInxD7uwgNCJY,9356
|
51
51
|
ring/io/xml/test_from_xml.py,sha256=bckVrVVmEhCwujd_OF9FGYnX3zU3BgztpqGxxmd0htM,1562
|
52
52
|
ring/io/xml/test_to_xml.py,sha256=NGn4VSiFdwhYN5YTBduWMiY9B5dwtxZhCQAR_PXeqKU,946
|
53
|
-
ring/io/xml/to_xml.py,sha256=
|
53
|
+
ring/io/xml/to_xml.py,sha256=Wo4iySLw9nM-iVW42AGvMRqjtU2qRc2FD_Zlc7w1IrE,3438
|
54
54
|
ring/ml/__init__.py,sha256=nbh48gaswWeY4S4vT1sply_3ROj2DQ7agjoLR4Ho3T8,1517
|
55
55
|
ring/ml/base.py,sha256=lfwEZLBDglOSRWChUHoH1kezefhttPV9TMEpNIqsMNw,9972
|
56
56
|
ring/ml/callbacks.py,sha256=W19QF6_uvaNCjs8ObsjNXD7mv9gFgJBixdRSbB_BynE,13301
|
@@ -64,7 +64,7 @@ ring/ml/params/0x13e3518065c21cd8.pickle,sha256=Zh2k1zK-TNxJl5F7nyTeQ9001qqRE_df
|
|
64
64
|
ring/ml/params/0x1d76628065a71e0f.pickle,sha256=YTNVuvfw-nCRD9BH1PZYcR9uCFpNWDhw8Lc50eDn_EE,9351038
|
65
65
|
ring/rendering/__init__.py,sha256=Zf7qOdzK3t2hljIrs5P4zFhzHljLSMRyDDZO2YlZk4k,75
|
66
66
|
ring/rendering/base_render.py,sha256=Mv9SRLEmuoPVhi46UIjb6xCkKmbWCwIyENGx7nu9REM,9617
|
67
|
-
ring/rendering/mujoco_render.py,sha256=
|
67
|
+
ring/rendering/mujoco_render.py,sha256=bSj1_7YL8wZV6cp9oD2CvbkZRSuxVhmPBA2JECxrnUE,8426
|
68
68
|
ring/rendering/vispy_render.py,sha256=QmRyA7Hqk3uS1SKjcncwc4_vd1m4yWryW2X0i4jRvCw,10260
|
69
69
|
ring/rendering/vispy_visuals.py,sha256=ooBZqppnebeL0ANe6V6zUgnNTtDcdkOsa4vZuM4sx-I,7873
|
70
70
|
ring/sim2real/__init__.py,sha256=gCLYg8IoMdzUagzhCFcfjZ5GavtIU772L7HR0G5hUtM,251
|
@@ -86,7 +86,7 @@ ring/utils/randomize_sys.py,sha256=G_vBIo0OwQkXL2u0djwbaoaeb02C4LQCTNNloOYIU2M,3
|
|
86
86
|
ring/utils/utils.py,sha256=tJaWXLGOTwkxJQj2l23dX97wO3aZYhM2qd7eNuMRs84,6907
|
87
87
|
ring/utils/register_gym_envs/__init__.py,sha256=PtPIRBQJ16339xZ9G9VpvqrvcGbQ_Pk_SUz4tQPa9nQ,94
|
88
88
|
ring/utils/register_gym_envs/saddle.py,sha256=tA5CyW_akSXyDm0xJ83CtOrUMVElH0f9vZtEDDJQalI,4422
|
89
|
-
imt_ring-1.6.
|
90
|
-
imt_ring-1.6.
|
91
|
-
imt_ring-1.6.
|
92
|
-
imt_ring-1.6.
|
89
|
+
imt_ring-1.6.29.dist-info/METADATA,sha256=2LQEbqA9aoAoMTJbVgd7MAWtdnHYWYv43M1-BhdW84o,4251
|
90
|
+
imt_ring-1.6.29.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
91
|
+
imt_ring-1.6.29.dist-info/top_level.txt,sha256=EiT790-lAyi8iwTzJArH3f2k77rwhDn00q-4PlmvDQo,5
|
92
|
+
imt_ring-1.6.29.dist-info/RECORD,,
|
ring/__init__.py
CHANGED
@@ -98,7 +98,10 @@ def RING(lam: list[int] | None, Ts: float | None, **kwargs) -> ml.AbstractFilter
|
|
98
98
|
add_Ts = True
|
99
99
|
|
100
100
|
ringnet = ml.RING(
|
101
|
-
params=params,
|
101
|
+
params=params,
|
102
|
+
lam=None if lam is None else tuple(lam),
|
103
|
+
jit=config.pop("jit", False),
|
104
|
+
name="RING",
|
102
105
|
)
|
103
106
|
ringnet = ml.base.ScaleX_FilterWrapper(ringnet)
|
104
107
|
if config["use_lpf"]:
|
@@ -55,6 +55,11 @@ class RCMG:
|
|
55
55
|
) -> None:
|
56
56
|
"Random Chain Motion Generator"
|
57
57
|
|
58
|
+
# add some default values
|
59
|
+
randomize_hz_kwargs_defaults = dict(add_dt=True)
|
60
|
+
randomize_hz_kwargs_defaults.update(randomize_hz_kwargs)
|
61
|
+
randomize_hz_kwargs = randomize_hz_kwargs_defaults
|
62
|
+
|
58
63
|
sys, config = utils.to_list(sys), utils.to_list(config)
|
59
64
|
sys_ml = sys[0] if sys_ml is None else sys_ml
|
60
65
|
|
@@ -409,7 +414,11 @@ def _build_mconfig_batched_generator(
|
|
409
414
|
@jax.vmap
|
410
415
|
def _vmapped_context(key, q, sys):
|
411
416
|
x, _ = jax.vmap(kinematics.forward_kinematics_transforms, (None, 0))(sys, q)
|
412
|
-
X =
|
417
|
+
X = (
|
418
|
+
{"dt": jnp.array(sys.dt)}
|
419
|
+
if (randomize_hz and randomize_hz_kwargs["add_dt"])
|
420
|
+
else {}
|
421
|
+
)
|
413
422
|
Xy, extras = (X, {}), (key, q, x, sys)
|
414
423
|
return _finalize_fn(Xy, extras)
|
415
424
|
|
ring/base.py
CHANGED
@@ -558,6 +558,7 @@ class System(_Base):
|
|
558
558
|
new_stif: Optional[jax.Array] = None,
|
559
559
|
new_zero: Optional[jax.Array] = None,
|
560
560
|
seed: int = 1,
|
561
|
+
warn: bool = True,
|
561
562
|
):
|
562
563
|
"By default damping, stiffness are set to zero."
|
563
564
|
from ring.algorithms import get_joint_model
|
@@ -587,7 +588,7 @@ class System(_Base):
|
|
587
588
|
|
588
589
|
jm = get_joint_model(new_joint_type)
|
589
590
|
if jm.init_joint_params is not None:
|
590
|
-
sys = sys.from_str(sys.to_str(), seed=seed)
|
591
|
+
sys = sys.from_str(sys.to_str(warn=warn), seed=seed)
|
591
592
|
|
592
593
|
return sys
|
593
594
|
|
@@ -786,8 +787,8 @@ class System(_Base):
|
|
786
787
|
def from_str(xml: str, seed: int = 1):
|
787
788
|
return ring.io.load_sys_from_str(xml, seed)
|
788
789
|
|
789
|
-
def to_str(self) -> str:
|
790
|
-
return ring.io.save_sys_to_str(self)
|
790
|
+
def to_str(self, warn: bool = True) -> str:
|
791
|
+
return ring.io.save_sys_to_str(self, warn=warn)
|
791
792
|
|
792
793
|
def to_xml(self, path: str) -> None:
|
793
794
|
ring.io.save_sys_to_xml(self, path)
|
ring/io/xml/to_xml.py
CHANGED
@@ -5,18 +5,19 @@ from xml.etree.ElementTree import SubElement
|
|
5
5
|
from xml.etree.ElementTree import tostring
|
6
6
|
|
7
7
|
import jax.numpy as jnp
|
8
|
-
from ring import base
|
9
8
|
from tree_utils import batch_concat
|
10
9
|
|
10
|
+
from ring import base
|
11
|
+
|
11
12
|
from . import abstract
|
12
13
|
from .abstract import _to_str
|
13
14
|
|
14
15
|
|
15
|
-
def save_sys_to_str(sys: base.System) -> str:
|
16
|
+
def save_sys_to_str(sys: base.System, warn: bool = True) -> str:
|
16
17
|
for joint_type in sys.links.joint_params:
|
17
18
|
for i, link_name in enumerate(sys.link_names):
|
18
19
|
joint_params_flat = batch_concat((sys.links[i]).joint_params[joint_type], 0)
|
19
|
-
if not jnp.all(joint_params_flat == 0.0):
|
20
|
+
if warn and (not jnp.all(joint_params_flat == 0.0)):
|
20
21
|
warnings.warn(
|
21
22
|
"The system has `sys.links.joint_params` unequal to the 'default'"
|
22
23
|
f" value (of zeros). In particular the link `{link_name}` has for"
|
ring/maths.py
CHANGED
@@ -90,6 +90,19 @@ def angle_error(q, qhat):
|
|
90
90
|
return jnp.abs(quat_angle(quat_mul(quat_inv(q), qhat)))
|
91
91
|
|
92
92
|
|
93
|
+
def inclination_loss(q, qhat):
|
94
|
+
"""Absolute inclination angle in radians. `q`'s are from body-to-eps.
|
95
|
+
This function fullfills
|
96
|
+
inclination_loss(q1, q2)
|
97
|
+
== inclination_loss(qmt.addHeading(q1, H), q2)
|
98
|
+
== inclination_loss(q1, qmt.addHeading(q2, H))`
|
99
|
+
for any q1, q2, H
|
100
|
+
"""
|
101
|
+
q_rel = quat_mul(q, quat_inv(qhat))
|
102
|
+
q_rel_incl = quat_project(q_rel, [0, 0, 1.0])[1]
|
103
|
+
return jnp.abs(quat_angle(q_rel_incl))
|
104
|
+
|
105
|
+
|
93
106
|
def unit_quats_like(array):
|
94
107
|
"Array of *unit* quaternions of identical shape."
|
95
108
|
if array.shape[-1] != 4:
|
ring/rendering/mujoco_render.py
CHANGED
@@ -8,7 +8,10 @@ from ring import maths
|
|
8
8
|
|
9
9
|
_skybox = """<texture name="skybox" type="skybox" builtin="gradient" rgb1=".4 .6 .8" rgb2="0 0 0" width="800" height="800" mark="random" markrgb="1 1 1"/>""" # noqa: E501
|
10
10
|
_skybox_white = """<texture name="skybox" type="skybox" builtin="gradient" rgb1="1 1 1" rgb2="1 1 1" width="800" height="800" mark="random" markrgb="1 1 1"/>""" # noqa: E501
|
11
|
-
|
11
|
+
|
12
|
+
|
13
|
+
def _floor(floor_z: float) -> str:
|
14
|
+
return f"""<geom name="floor" pos="0 0 {floor_z}" size="0 0 1" type="plane" material="matplane" mass="0"/>""" # noqa: E501
|
12
15
|
|
13
16
|
|
14
17
|
def _build_model_of_geoms(
|
@@ -16,6 +19,7 @@ def _build_model_of_geoms(
|
|
16
19
|
cameras: dict[int, Sequence[str]],
|
17
20
|
lights: dict[int, Sequence[str]],
|
18
21
|
floor: bool,
|
22
|
+
floor_z: float,
|
19
23
|
stars: bool,
|
20
24
|
debug: bool,
|
21
25
|
) -> mujoco.MjModel:
|
@@ -94,7 +98,7 @@ def _build_model_of_geoms(
|
|
94
98
|
<camera pos="0 -1 1" name="target" mode="targetbodycom" target="{targetbody}"/>
|
95
99
|
<camera pos="0 -3 3" name="targetfar" mode="targetbodycom" target="{targetbody}"/>
|
96
100
|
<camera pos="0 -5 5" name="targetFar" mode="targetbodycom" target="{targetbody}"/>
|
97
|
-
{_floor if floor else ''}
|
101
|
+
{_floor(floor_z) if floor else ''}
|
98
102
|
{inside_worldbody_cameras}
|
99
103
|
{inside_worldbody_lights}
|
100
104
|
{inside_worldbody}
|
@@ -171,6 +175,7 @@ class MujocoScene:
|
|
171
175
|
add_lights: dict[int, str | Sequence[str]] = _default_lights,
|
172
176
|
show_stars: bool = True,
|
173
177
|
show_floor: bool = True,
|
178
|
+
floor_z: float = -0.84,
|
174
179
|
debug: bool = False,
|
175
180
|
) -> None:
|
176
181
|
self.debug = debug
|
@@ -185,6 +190,7 @@ class MujocoScene:
|
|
185
190
|
self.add_cameras, self.add_lights = to_list(add_cameras), to_list(add_lights)
|
186
191
|
self.show_stars = show_stars
|
187
192
|
self.show_floor = show_floor
|
193
|
+
self.floor_z = floor_z
|
188
194
|
|
189
195
|
def init(self, geoms: list[base.Geometry]):
|
190
196
|
self._parent_ids = list(set([geom.link_idx for geom in geoms]))
|
@@ -193,6 +199,7 @@ class MujocoScene:
|
|
193
199
|
self.add_cameras,
|
194
200
|
self.add_lights,
|
195
201
|
floor=self.show_floor,
|
202
|
+
floor_z=self.floor_z,
|
196
203
|
stars=self.show_stars,
|
197
204
|
debug=self.debug,
|
198
205
|
)
|
File without changes
|
File without changes
|