feat(viz): skeleton joints to SC via pose/skel

Add /pose/skel OSC route emitting nose, shoulders, hips,
knees and ankles (18 floats) from _emit_person. Add
\poseSkel OSCdef in data_feeds.scd storing the 9 joint
positions per pid; cleanup on \poseLeave.
This commit is contained in:
L'électron rare
2026-06-27 18:59:49 +02:00
parent 46d912e526
commit 6b6be7bff2
2 changed files with 21 additions and 0 deletions
+11
View File
@@ -194,6 +194,17 @@ class PoseSoundBridge:
try: self._avbody.send_message("/pose/limb_span", [pid, float(span)])
except OSError: pass
if len(body) >= 29:
def _xy(i):
kp = body[i]
return [float(getattr(kp, "x", 0.0)), float(getattr(kp, "y", 0.0))]
skel = [pid]
for idx in (0, 11, 12, 23, 24, 25, 26, 27, 28): # nose, sh L/R, hip L/R, knee L/R, ank L/R
skel += _xy(idx)
cli.send_message("/pose/skel", skel)
try: self._avbody.send_message("/pose/skel", skel)
except OSError: pass
# ------------------------------------------------------------------
def send_face(self, persons_face: Sequence[Sequence[Any]],
persons_face_ids: Sequence[int], t_now: float,
+10
View File
@@ -496,6 +496,7 @@ OSCdef(\poseLeave, { |msg|
~poseKin.removeAt(pid);
~poseCenter.removeAt(pid);
~poseWrist !? { ~poseWrist.removeAt(pid) };
~poseSkel !? { ~poseSkel.removeAt(pid) };
}, '/pose/leave');
OSCdef(\poseHands, { |msg|
@@ -521,6 +522,15 @@ OSCdef(\poseWrist, { |msg|
~poseWrist[pid] = e;
}, '/pose/wrist');
~poseSkel = ~poseSkel ? Dictionary.new;
OSCdef(\poseSkel, { |msg|
var pid = msg[1].asInteger;
var p = { |i| (x: msg[2 + (i*2)], y: msg[3 + (i*2)]) };
~poseSkel[pid] = (
nose: p.(0), shL: p.(1), shR: p.(2), hipL: p.(3), hipR: p.(4),
kneeL: p.(5), kneeR: p.(6), ankL: p.(7), ankR: p.(8));
}, '/pose/skel');
~poseCenter = ~poseCenter ? Dictionary.new;
OSCdef(\poseCenter, { |msg|
var pid = msg[1].asInteger;