Spaces:
Runtime error
Runtime error
Chunk 5: emit 6-channel foot_contacts in envelope (toe-end copies toe-base)
Browse files
server.py
CHANGED
|
@@ -10,7 +10,11 @@ and returns a JSON envelope:
|
|
| 10 |
"fps": 30,
|
| 11 |
"rootTranslation": [[x,y,z], ...], # [N, 3]
|
| 12 |
"jointRotMats": [[[[...]]]], # [N, 30, 3, 3]
|
| 13 |
-
"footContacts": [[lh, lt, rh, rt]], # [N,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
"summary": str
|
| 15 |
}
|
| 16 |
|
|
@@ -185,10 +189,17 @@ def kimodo_motion(
|
|
| 185 |
foot_contacts_out = None
|
| 186 |
if "foot_contacts" in output:
|
| 187 |
fc = output["foot_contacts"]
|
| 188 |
-
# Drop the leading sample dim if present
|
| 189 |
if fc.ndim == 3:
|
| 190 |
fc = fc[0]
|
| 191 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
|
| 193 |
progress(1.0, desc="Done")
|
| 194 |
return {
|
|
@@ -357,9 +368,17 @@ def kimodo_motion_seq(
|
|
| 357 |
foot_contacts_out = None
|
| 358 |
if "foot_contacts" in output:
|
| 359 |
fc = output["foot_contacts"]
|
|
|
|
| 360 |
if fc.ndim == 3:
|
| 361 |
fc = fc[0]
|
| 362 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
|
| 364 |
progress(1.0, desc="Done")
|
| 365 |
return {
|
|
|
|
| 10 |
"fps": 30,
|
| 11 |
"rootTranslation": [[x,y,z], ...], # [N, 3]
|
| 12 |
"jointRotMats": [[[[...]]]], # [N, 30, 3, 3]
|
| 13 |
+
"footContacts": [[lh, lt, lte, rh, rt, rte]], # [N, 6] (optional;
|
| 14 |
+
# SOMA-77 layout — toe-end copies
|
| 15 |
+
# toe-base contact, see
|
| 16 |
+
# kimodo.skeleton.definitions
|
| 17 |
+
# .output_to_SOMASkeleton77)
|
| 18 |
"summary": str
|
| 19 |
}
|
| 20 |
|
|
|
|
| 189 |
foot_contacts_out = None
|
| 190 |
if "foot_contacts" in output:
|
| 191 |
fc = output["foot_contacts"]
|
| 192 |
+
# Drop the leading sample dim if present -> [T, 4]
|
| 193 |
if fc.ndim == 3:
|
| 194 |
fc = fc[0]
|
| 195 |
+
fc = np.asarray(fc, dtype=np.float32)
|
| 196 |
+
# 4 -> 6 channel expand for SOMA-77 (mirrors
|
| 197 |
+
# kimodo.skeleton.definitions.output_to_SOMASkeleton77):
|
| 198 |
+
# [L_heel, L_toe, L_toe_end(=L_toe), R_heel, R_toe, R_toe_end(=R_toe)]
|
| 199 |
+
fc6 = np.concatenate(
|
| 200 |
+
[fc[..., :2], fc[..., 1:2], fc[..., 2:4], fc[..., 3:4]], axis=-1
|
| 201 |
+
)
|
| 202 |
+
foot_contacts_out = fc6.tolist()
|
| 203 |
|
| 204 |
progress(1.0, desc="Done")
|
| 205 |
return {
|
|
|
|
| 368 |
foot_contacts_out = None
|
| 369 |
if "foot_contacts" in output:
|
| 370 |
fc = output["foot_contacts"]
|
| 371 |
+
# Drop the leading sample dim if present -> [T, 4]
|
| 372 |
if fc.ndim == 3:
|
| 373 |
fc = fc[0]
|
| 374 |
+
fc = np.asarray(fc, dtype=np.float32)
|
| 375 |
+
# 4 -> 6 channel expand for SOMA-77 (mirrors
|
| 376 |
+
# kimodo.skeleton.definitions.output_to_SOMASkeleton77):
|
| 377 |
+
# [L_heel, L_toe, L_toe_end(=L_toe), R_heel, R_toe, R_toe_end(=R_toe)]
|
| 378 |
+
fc6 = np.concatenate(
|
| 379 |
+
[fc[..., :2], fc[..., 1:2], fc[..., 2:4], fc[..., 3:4]], axis=-1
|
| 380 |
+
)
|
| 381 |
+
foot_contacts_out = fc6.tolist()
|
| 382 |
|
| 383 |
progress(1.0, desc="Done")
|
| 384 |
return {
|