add sliding window average for sonar