Taking automatic action to avoid collision