Added code to calculate wheel direction and speed.