Collision Detection Robot

You have the basics down. Translating that into code is pretty simple.

Handling the case where the left turn does not result in an obstacle free path is the tricky part.