Detecting track has finished

Some sort of optical sensor that can detect the wall.

A microswitch with a roller that runs along the wall and the wall keeps the switch pressed.

How far will your device be from the wall?

...R