The magnetic encoder is used to calculate motor (and robot) velocity. The velocity is estimated based on the time between encoder ticks.