Motor range auto calibration

Set the motor heading in one direction and monitor the encoder - when it stops changing kill the power
and set one endpoint.
Repeat for the other direction.

Avoid using too much drive if the motor is powerful enough to do mechanical damage.

If the motor controller can set a maximum current you can use this to reduce max torque during this
homing phase.