motion sensor velocity calculation