calculate speed and slope on a rolling basis