When deciding if the robot should preform one more step the minimum value is achieved be looking if taking another step would decrease the distance to the endpoint.