Obstacles Avoidance Based on Switching Potential Functions