Detecting track has finished

lukik:
The robot may fall if it keeps a hold of the wall.

I have been assuming that you would apply a little practical ingenuity.

Furthermore, as for the 1st option what type of optical sensor?

Likewise. have you looked through supplier catalogues.

Sonar is another option.

...R