Search code examples
javaandroidalgorithmaccelerometergraph-algorithm

simple Graph Data Analysis, detect peaks, Detect Rowing Stroke


I have problem with determinate when new stroke is done at Sport Academic Rowing.

  • I need simple algorithm which to detect moment, which characteristic are one global valley, then big rising which end with peak( look at picture 1 - catch phase, immediately after vertical dotted line

  • The algorithm needs to be “adaptive”, because when you are rowing hard, the highest point is much higher than when you are paddling and reverse.

  • Input: float acceleration Data is from accelerometer, so because of that data come continuously. I can find timestamp too.

  • Target: That is cyclic graph, so i want to find how much cycles(strokes) are made per minute, for that i need to detect each one. (period between each two vertical dotted lines - - -)

Rowing boat acceleration vs time graph:
rowing boat acceleration vs time graph

Thank you


Solution

  • Looking at the data, a simple algorithm could be to divide acceleration into three distinct regions:

    • less than -9 m/s^2
    • between -9 m/s^2 and 0 m/s^2
    • greater than 0 m/s^2

    Then you construct a state machine with two states to detect each stroke. The first state is triggered when the acceleration is less than -9 m/s^2, and the second state is triggered when the acceleration is greater than 0 m/s^2. When the acceleration is in between, it doesn't change the state.

    With your data, at 89.5s, it enters state 1, then enters state 2 at 89.8s, then state 1 again at 91.1s, etc.