Skip to content

feat(console): log what the gyro loses and its scale - #32

Closed
broslife wants to merge 6 commits into
mainfrom
feat/gyro
Closed

broslife wants to merge 6 commits into
mainfrom
feat/gyro

Conversation

@broslife

@broslife broslife commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Streaming to Relink (native gyro, host pad joyconpair), left/right aimed less than up/down; on a PC with the Joy-Cons wired directly it felt right.

The first commit turned the yaw about the player's vertical. On the console the aim then sank while turning back to the left: Relink already does that conversion itself (host/hos_motion.h: an up vector from a complementary filter, yaw = gyro · up, pitch pulled toward gravity's tilt). The rewritten yaw put the same turn on two axes, which tipped Relink's up and switched off its pitch pull past 15° of roll. The second commit sends the pad's own gyro again.

Because Relink pulls pitch toward gravity and nothing anchors yaw, a gyro scale under 1 would show only as weak left/right. hid names no unit for the gyro (pad_map::motion assumes turns per second, unverified).

What

Every 10 s a moving pad logs, per wire axis (x right, y up out of the face, z toward the player):

  • the turn, the net turn read off the pad, and what the host was given minus that: what the sending loses;
  • the mean gravity and |g|: how the pad was held;
  • the share of the window calm (under 10 °/s) and near 1 g (within 8%);
  • a gravity check: between two steady poses (both limits, 40 ms), the turn gravity sees across itself against the gyro's turn across gravity. Per axis gravity saw turn about (10° or more in the window), the gyro's response to it: x→(1.00, 0.00, 0.00) when hid's unit and axes are right. A turn about gravity itself is unseen, so upright the left/right axis has no check; up/down and the wheel do.

Console

  • Build 4df9f6c (player space), Relink in handheld: the sending loses at most 0.5° of yaw per 10 s window while turning 200–450°; the aim sank turning left, hence the revert.
  • Build d40e7d6, Relink in handheld: loss under 0.1° per window; the x-only scale check found no pose (limits too tight for a held console). Large pitch totals beside small yaw ones while turning left/right, unexplained: the turn upright reads on z, which that build did not log.
  • Build 700e534: pending, a guided run (upright left/right, up/down, wheel; then flat).

Test

  • Motion tests for the sums and the gravity check (a true gyro responds one to one on x and y, a weak and crossed one shows both, a swing is no pose).
  • cargo fmt --check, cargo test -p pf-nx-app, workspace clippy -D warnings in the host image.

broslife and others added 2 commits November 20, 2026 18:38
Held upright, as the console is in handheld, a turn to the side reads
mostly on the pad's roll axis, so games that aim with yaw alone moved
the camera far less side to side than up and down.

The yaw sent is now the turn about the vertical the accelerometer finds
(player space, with the Gyro Wiki's 1.41 relaxation). Pitch, roll and
gravity stay the pad's own. Every 10 s a moving pad logs the angle it
read against the angle the host was given, so drift on the way can be
measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Relink, the game this was tried with, already turns the gyro about the
player's vertical itself. The yaw this title rewrote put the same turn
on two axes, so the game's estimate of up tipped and the aim sank
while turning back to the left.

The gyro goes out as the pad reads it again. The 10 s summary now also
pairs the gyro's pitch between two steady poses with the tilt gravity
measures between them: their ratio is the gyro's scale, which hid
names no unit for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broslife broslife changed the title feat(console): turn the gyro's yaw about the player's vertical feat(console): log what the gyro loses and its scale Nov 20, 2026
broslife and others added 4 commits November 20, 2026 20:21
The scale check found no pose in a handheld run: its steady limits
(5 deg/s, 3% of 1 g) were tighter than a held console, and it only
looked at tilts about x.

The 10 s summary now gives each wire axis's turn, net and loss, the
mean gravity, how much of the window was calm and near 1 g, and,
between steady poses (10 deg/s, 8%), the gyro's response to each axis
gravity saw turn about: (1, 0, 0) for x when hid's unit and axes are
right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Handheld, the title now also starts hid's seven-six-axis sensor and runs it
through the same 10 s summary and gravity check as pad 0, under the name
"console"; it is never sent. Every 5 s the log prints its ten raw floats next
to the pad's accel and gyro, since hid.h names none of them. The summary reads
them as yuzu does: accel, gyro, then a quaternion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Handheld, the six-axis sensor hid gives the app is the attached right
Joy-Con, at the console's edge: in dea5632's run it read gravity at
0.91-0.97 g and turned 10-20% over gravity's own turn, where the
console's sensor read 1.02 g and turned true. Pad 0 now sends the
console's sensor while handheld and logs the Joy-Con beside it as
"joy-con 0". Detached pads are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@broslife

Copy link
Copy Markdown
Collaborator Author

Superseded by #33, which carries only the handheld sensor switch; the diagnostic logging here stays out of main.

@broslife broslife closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant