Spaces:
Running
Running
Shubham-Rasal Claude Sonnet 4.6 commited on
Commit ·
073a3e5
1
Parent(s): 654b826
Fix row-count mismatch in extract_episode for PhAIL signals
Browse filesrobot_state.q and robot_commands.pose have different sampling rates,
producing arrays with incompatible row counts. Truncate both to
min(rows) before computing tracking effort.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -42,9 +42,11 @@ def extract_episode(states, actions):
|
|
| 42 |
actions = np.array(actions, dtype=float)
|
| 43 |
dq = np.diff(states, axis=0)
|
| 44 |
speed = np.linalg.norm(dq, axis=1) * FS
|
| 45 |
-
# align
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
raw_z = states[:, 1]
|
| 49 |
z = (raw_z - raw_z.min()) / (raw_z.max() - raw_z.min() + 1e-9)
|
| 50 |
return speed, effort, z
|
|
|
|
| 42 |
actions = np.array(actions, dtype=float)
|
| 43 |
dq = np.diff(states, axis=0)
|
| 44 |
speed = np.linalg.norm(dq, axis=1) * FS
|
| 45 |
+
# align both rows and dims before subtracting
|
| 46 |
+
min_rows = min(len(states), len(actions))
|
| 47 |
+
min_dim = min(states.shape[1], actions.shape[1])
|
| 48 |
+
effort = np.linalg.norm(
|
| 49 |
+
actions[:min_rows, :min_dim] - states[:min_rows, :min_dim], axis=1)
|
| 50 |
raw_z = states[:, 1]
|
| 51 |
z = (raw_z - raw_z.min()) / (raw_z.max() - raw_z.min() + 1e-9)
|
| 52 |
return speed, effort, z
|