directions function

Calculate direction changes per five seconds in sliding windows