Commit Graph
3 Commits
Author SHA1 Message Date
kinect-botandsisyphus-dev-ai 148b3fcdef fix(tracker): normalize joint reach by live shoulder width (body-size scale)
the users own fix idea: scale based on tracked body size. The shims
arm-reach gain (3.2/2.6) is a fixed multiplier tuned against one reference
reach magnitude - a players actual size/distance from camera changes the
raw reach the gain amplifies, so a fixed gain over- or under-stretches
limbs/cursor depending on who is in frame and how far away.

Added _body_scale(): derives a scale factor each frame from the live
shoulder width (MediaPipes world landmarks, already metric) against
TARGET_SHOULDER_WIDTH_METERS=0.40 (core/calibration.hs own T-pose target),
applied around the SHOULDER_CENTER pivot so scaling resizes the skeleton
around its own centre rather than shifting it on screen. Wired into both
map_pose_to_kinect_joints and SkeletonMapper.map via a shared _raw_joint_xyz
helper, so calibration and the live publish path stay consistent. 98/98
tests passing.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-30 13:37:12 -05:00
kinect-botandsisyphus-dev-ai a90b2af6e9 fix(tracker): port core/mapping's hand averaging + Holt smoothing exactly
"i don't know what calibration you're talking about because i never had to
callibrate on the windows version" and "i'm having the problem from earlier
[...] difficult to move the cursor down" - both pointed at the same thing:
calibration was a workaround for a real pipeline discrepancy, not the fix.
On Windows the user only ever used the hardcoded default gains (3.2/2.6, no
calibration run) and it worked; if the Linux tracker needs calibration to
reach the same place with the same defaults, the two pipelines aren't
actually equivalent. Went back to core/mapping.cpp (the C++ module
joint_mapping.py's own docstring already claims to mirror "exactly") and
found two real, concrete divergences from that claim:

1. HAND joint averaging. core/mapping.cpp's hand_landmark() averages four
   points (wrist + index/pinky knuckles + thumb, each 0.25 weight) - the
   individual finger landmarks are MediaPipe's noisiest output, so this is a
   deliberate accuracy/jitter fix (~35% less jitter, lands on the palm
   centre matching real Kinect). joint_mapping.py's _kinect_joint_landmarks
   only averaged index+pinky (2 points, no wrist, no thumb) - a different
   hand position every frame than the Windows tracker computes for the same
   physical hand. Ported hand_landmark() exactly (same weights, same
   visibility-gated fallback to the wrist alone).

2. No smoothing at all. tracker-native/src/frame_pipeline.cpp runs every
   published joint through core/mapping's SkeletonMapper, which owns one
   Holt (double-exponential) smoothing filter per joint with jitter-radius
   damping, prediction, and a max-deviation clamp - applied to literally
   every frame of the main publish loop, not just during calibration. The
   Python tracker published a fresh, completely unsmoothed position every
   frame - a real behavioral gap (jitter/prediction/damping characteristics
   the Windows cursor feel was built around), not cosmetic.

Ported both into tracker/joint_mapping.py: HoltSmoothingFilter (the exact
filter math) and SkeletonMapper (owns one filter per joint, holds the last
smoothed position when a joint's visibility drops below VIS_TRACKED instead
of publishing a fresh low-confidence one - matching
core/mapping.cpp::SkeletonMapper::map exactly). FrameContractPublisher now
owns one SkeletonMapper instance persisting across publish() calls (matching
frame_pipeline.cpp owning one SkeletonMapper for the tracker session),
replacing the stateless per-frame map_pose_to_kinect_joints() call (still
kept, now only used by calibration.py and as the first-frame reference).

Verified against the C++ test suite's own fixtures, not just "looks
similar": tests/test_joint_mapping_py.py ports
test_mapping.cpp::HoltFilterMatchesPrecomputedGoldenSequence's exact raw/
expected values (1e-7 precision match) and
::OccludedJointIsInferredAndHoldsLastSmoothedPosition. Full suite: 98/98
passing (tests/test_tracker.py's existing fixed-pose comparison test still
matches exactly, since a fresh filter's first update is a pure passthrough -
no smoothing history yet - proven by a dedicated new test).

This does not touch the cursor arm-gain calibration added earlier - that
remains available but optional, same as it always was on Windows.

Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-30 13:14:14 -05:00
kinect-bot 0af22f1783 feat(calibration,contract,tracker): T-pose calibration + seqlock fix + articulated-depth wiring (wave 8a; todos 11,20,21 done)
ci / Python tracker (pytest) (push) Canceled after 0s
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
2026-11-25 05:47:19 -05:00