Obstacle detection and ranging