Roomba script question

Hi I am trying to make a roomba and if it hits a wall it has to back up and turn. How could I do it?

I am using LinearVelocity and AllignOrientation constraints.

Use a touched event to detect when it hits something, then just make it go the opposite direction for a set amount of time