Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Road to RubyKaigi: Play Hard(ware)

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

Road to RubyKaigi: Play Hard(ware)

Road to RubyKaigi: Play Hard(ware)
2026.04.22. RubyKaigi 2026 LT

Avatar for makicamel

makicamel

April 22, 2026

More Decks by makicamel

Other Decks in Programming

Transcript

  1. About Me @makicamel / Maki Kawahara Loves Ruby , beer

    and sake Co-Organizer of PicoPicoRuby Creator of "Road to RubyKaigi"
  2. Road to RubyKaigi A Ruby game by Rubyists, for Rubyists

    A side-scrolling action game played in the terminal Defeat bugs, escape deadlines, and make it to RubyKaigi
  3. Acceleration What is acceleration? The rate of change of velocity

    e.g. A car starting to move: positive acceleration A car cruising at constant speed: acceleration is 0
  4. Acceleration Acceleration Expresses changes in motion as numbers Lets us

    extract features and read movement     3-axis accelerometer module KXR94-2050   https://akizukidenshi.com/catalog/g/g105153/
  5. Walk Detection: Time Acceleration change over a time window "Moving"

    means changing over time Observe variation within the window
  6. Walk Detection: Motion Intensity Amount of acceleration change in a

    time window = motion intensity How scattered the acceleration is
  7. Walk Detection: Motion Intensity Condense acceleration change over a time

    window into a single number Represents motion intensity Still / walking become distinguishable Waveform information is lost Periodicity, rhythm of the wave Acceptable for this case If motion intensity exceeds a threshold, the player is "walking"
  8. Walk Detection: Per-Axis Motion Intensity Mean mean = samples.sum /

    samples.size Deviation from the mean for each sample dev(n) = sample[n] - mean Squared deviation dev(n)² Mean of squared deviations (dev(1)² + dev(2)² + ... dev(n)²) / samples.size
  9. Walk Detection: Per-Axis Motion Intensity Mean mean = samples.sum /

    samples.size Deviation from the mean for each sample dev(n) = sample[n] - mean Squared deviation dev(n)² Mean of squared deviations (dev(1)² + dev(2)² + ... dev(n)²) / samples.size
  10. Walk Detection: Per-Axis Motion Intensity Mean mean = samples.sum /

    samples.size Deviation from the mean for each sample dev(n) = sample[n] - mean Squared deviation dev(n)² Mean of squared deviations (dev(1)² + dev(2)² + ... dev(n)²) / samples.size
  11. Walk Detection: Per-Axis Motion Intensity Mean mean = samples.sum /

    samples.size Deviation from the mean for each sample dev(n) = sample[n] - mean Squared deviation dev(n)² Mean of squared deviations (dev(1)² + dev(2)² + ... dev(n)²) / samples.size
  12. Walk Detection: Per-Axis Motion Intensity Sum the per-axis motion intensities

    def motion_intensity Math.sqrt(var(0) + var(1) + var(2)) end Motion intensity over the window
  13. Walk Detection: Per-Axis Motion Intensity Walking starts when motion intensity

    exceeds the threshold class SignalInterpreter def walk_started? @window.motion_intensity > Config.start_threshold end