Esempio n. 1
0
 def _get_waypoint(self, location: Location, project_to_road: bool,
                   lane_type):
     try:
         waypoint = self._map.get_waypoint(location.as_carla_location(),
                                           project_to_road=project_to_road,
                                           lane_type=lane_type)
     except RuntimeError as err:
         self._logger.error('get_waypoint call failed: {}'.format(err))
         waypoint = None
     return waypoint
Esempio n. 2
0
def test_as_carla_location():
    """ Test the as_carla_location instance method of Location """
    location = Location(x=1, y=2, z=3)
    carla_location = location.as_carla_location()
    assert isinstance(carla_location, carla.Location), "Returned instance is "
    "not of the type carla.Location"
    assert np.isclose(carla_location.x, location.x), "Returned instance x "
    "value is not the same as the one in location."
    assert np.isclose(carla_location.y, location.y), "Returned instance y "
    "value is not the same as the one in location."
    assert np.isclose(carla_location.z, location.z), "Returned instance z "
    "value is not the same as the one in location."