The iRobot company explains that its Roomba series works with a series of sophisticated sensors. There are not only indicators for spacial awareness and direction, but also infrared sensors to know when to engage different levels of cleaning intensities. Nowadays there's also Wi-Fi and Bluetooth functionality if you want more precise control than relying on the autopilot.