Detecting obstacles in real time