Autonomous robot–obstacle avoidance and collision detection