Skip to content

How it works

A phone’s GPS gives one fix per second, and a 60-foot run lasts two. With the GPS alone, times come out half a second off. The accelerometer measures a hundred times per second, but it drifts and doesn’t know which way is “forward”. TorkeKit combines both and keeps the best of each.

InputSensorsAccelerometer at 100 Hz and GPS at 1 Hz or more, on the same clock.
Step 1AxisCalibrationRemoves gravity and learns which way is forward.
Step 2SpeedFilterKalman: integrates acceleration and corrects it with the GPS.
Step 3RunAnalyzerFinds the launch and reads the marks.

The phone can sit any way: upright, flat, tilted toward the driver. AxisCalibration uses the gravity vector to keep only the horizontal part of the acceleration. Then it waits for the first strong push (the launch) and takes that direction as “forward”.

That’s why you don’t need to ask the user to place the phone in a special way. Only that it stays fixed.

SpeedFilter is a two-state Kalman filter: the speed and the accelerometer’s bias (the small constant error every sensor has, which grows if the mount is tilted).

  • A hundred times per second, it predicts the speed by adding up the acceleration.
  • Every time a GPS fix arrives, it corrects the speed and learns the bias, weighing each source by how much it trusts it (the accuracy the GPS reports).

The result is a speed curve as smooth as the accelerometer’s and without drift, like the GPS’s.

RunAnalyzer looks for the launch: one second still, then sustained acceleration. From there it builds the speed and distance curve over time (trace) and reads each mark:

  • Distances (60 ft, 1/8, 1/4): the moment the distance crosses the mark, minus the one-foot rollout.
  • Speeds (0–100): the moment the speed crosses the value.
  • Trap speed: the speed when passing the mark, like the track’s radar.
  • Rigid mount. If the phone shakes or moves, the accelerometer measures the mount, not the car. RunQuality detects it (looseMount, phoneMoved).
  • Open sky. The GPS needs to see satellites. Under a roof or between buildings its accuracy drops (inaccurateGPS).
  • A faster GPS helps. Some Android phones give 5 or 10 fixes per second; snapshot.gpsRate says how many each phone gives. See Accuracy.