toolbox: publish actions.py
Browse files- toolbox/actions.py +10 -3
toolbox/actions.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
| 1 |
"""Derive action targets from the handheld sensor poses.
|
| 2 |
|
| 3 |
React is a handheld dataset — there is no robot command. Actions are derived
|
| 4 |
-
from the OptiTrack 6-DoF sensor poses
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
"""
|
| 6 |
from __future__ import annotations
|
| 7 |
|
|
@@ -22,8 +29,8 @@ def delta_pose_action(poses):
|
|
| 22 |
"""Frame-to-frame delta: translation diff + relative rotation (quat).
|
| 23 |
|
| 24 |
Returns (T, 7): [dx,dy,dz, dqx,dqy,dqz,dqw], last row zero-translation +
|
| 25 |
-
identity rotation. Quaternions
|
| 26 |
-
|
| 27 |
"""
|
| 28 |
p = np.asarray(poses, np.float64)
|
| 29 |
T = p.shape[0]
|
|
|
|
| 1 |
"""Derive action targets from the handheld sensor poses.
|
| 2 |
|
| 3 |
React is a handheld dataset — there is no robot command. Actions are derived
|
| 4 |
+
from the OptiTrack 6-DoF sensor poses stored per frame as
|
| 5 |
+
[x, y, z, qx, qy, qz, qw] — position in METRES, quaternion SCALAR-LAST, the
|
| 6 |
+
`scipy.spatial.transform.Rotation.from_quat` convention. An earlier version of
|
| 7 |
+
this docstring said "wxyz"; the code was always scalar-last, so the text was
|
| 8 |
+
the error, but a reader who trusted it would have swapped w into x.
|
| 9 |
+
|
| 10 |
+
Rotation deltas here are WORLD-FRAME: dq = q[i+1] * q[i]^-1, integrated as
|
| 11 |
+
q[i+1] = dq * q[i]. Round-trip verified to 6e-9 m and 1.4e-5 deg.
|
| 12 |
"""
|
| 13 |
from __future__ import annotations
|
| 14 |
|
|
|
|
| 29 |
"""Frame-to-frame delta: translation diff + relative rotation (quat).
|
| 30 |
|
| 31 |
Returns (T, 7): [dx,dy,dz, dqx,dqy,dqz,dqw], last row zero-translation +
|
| 32 |
+
identity rotation. Quaternions are SCALAR-LAST throughout, and the rotation
|
| 33 |
+
delta is world-frame: dq = q[i+1] * q[i]^-1.
|
| 34 |
"""
|
| 35 |
p = np.asarray(poses, np.float64)
|
| 36 |
T = p.shape[0]
|