iPhone IMU
Real, running code, on the current Spine transport. Listens for UDP packets from an iPhone sensor-streaming app and publishes a [4][4]float64 rotation-only delta transform. Part of the live iphone_imu → Kinematic Engine → CrackHead pipeline (an alternative input source to Keyboard, publishing the same topic).
What it actually does
A UDP listener (IphoneWorker, bound to a hardcoded 172.20.10.3:<port>) receives JSON packets shaped like:
type IphoneOutput struct {
Seq int64
Roll, Pitch, Yaw float64 // motion
QuatX, QuatY, QuatZ, QuatW float64
Rot11..Rot33 float64 // rotation matrix, row-major
GravityX/Y/Z, AccelX/Y/Z,
GyroX/Y/Z, MagX/Y/Z float64
Latitude, Longitude float64
}
— accelerometer, gyroscope, magnetometer, gravity vector, quaternion, rotation matrix, GPS, all provided directly by the phone's sensor-fusion, not computed here.
Each loop iteration computes CreateDelta: the Euler-angle difference (yaw/roll/pitch) between the current and previous reading, with deltas under ~1° zeroed out as a noise floor, converted to a rotation matrix by direct trigonometric formula (not a library) and written into a [4][4]float64 with zero translation — only the rotation block is populated, result[3][3] = 1, everything else in the translation column is 0. The result is published as the delta transform; there's no accumulated absolute pose, no drift correction beyond that per-step noise gate, and no analytical Kalman filtering — this is what Purifier is meant to eventually replace.
Connects via spine.CreateNode(*namespace, *key, context.Background(), logger) and spine.NewPublisher[[4][4]float64], same as the other input nodes (flags: -namespace default "rime", -name default "r1-change" — the same topic Keyboard publishes, so either can drive Kinematic Engine; -key default "ppap"). A separate MemoryRecorder buffers every raw reading and dumps it to a timestamped JSON file in ./runs/ on exit — useful for offline filter tuning, independent of whether Spine itself is even reachable.
See also
- Input Overview — how this compares to the other two input nodes
- Keyboard — publishes the same
[4][4]float64shape, computed differently - Purifier — the planned filter this node's crude noise gate is a placeholder for