
This Lego Wall Follower — based on the Constructopedia RoverBot — is equipped with a turret, enabling the rotation of its sensor (in the right direction) when a wall is detected. Video clip after the jump.
The trick here is to direct sensor beam 45-degrees away to also detect walls in front of vehicle. A simple program that maintains constant distance between wall and sensor creates a wall-following behaviour.