Real-time obstacle avoidance