Beispiel #1
0
 def parse_speed_limit_signs(self, speed_limits):
     # Each speed limit sign has an id, position, and speed.
     speed_limit_signs_list = []
     for speed_limit_dict in speed_limits.values():
         speed_limit_id = speed_limit_dict['id']
         location = _gps_to_location(*speed_limit_dict['position'])
         speed_limit = speed_limit_dict['speed']
         speed_limit_signs_list.append(
             SpeedLimitSign(
                 speed_limit,
                 1.0,  # confidence
                 None,  # bounding box
                 speed_limit_id,
                 pylot.utils.Transform(location, pylot.utils.Rotation())))
     return speed_limit_signs_list
Beispiel #2
0
def get_actors(world):
    actor_list = world.get_actors()
    tl_actors = actor_list.filter('traffic.traffic_light*')
    traffic_lights = [
        TrafficLight.from_carla_actor(tl_actor) for tl_actor in tl_actors
    ]
    traffic_stop_actors = actor_list.filter('traffic.stop')
    traffic_stops = [
        StopSign.from_carla_actor(ts_actor) for ts_actor in traffic_stop_actors
    ]
    speed_limit_actors = actor_list.filter('traffic.speed_limit*')
    speed_signs = [
        SpeedLimitSign.from_carla_actor(ts_actor)
        for ts_actor in speed_limit_actors
    ]
    return (tl_actors, traffic_lights, traffic_stops, speed_signs)
Beispiel #3
0
def extract_data_in_pylot_format(actor_list):
    """Extracts actor information in pylot format from an actor list.

    Args:
        actor_list (carla.ActorList): An actor list object with all the
            simulation actors.

    Returns:
        A tuple that contains objects for all different types of actors.
    """
    # Note: the output will include the ego vehicle as well.
    vec_actors = actor_list.filter('vehicle.*')
    vehicles = [
        Obstacle.from_simulator_actor(vec_actor) for vec_actor in vec_actors
    ]

    person_actors = actor_list.filter('walker.pedestrian.*')
    people = [
        Obstacle.from_simulator_actor(ped_actor) for ped_actor in person_actors
    ]

    tl_actors = actor_list.filter('traffic.traffic_light*')
    traffic_lights = [
        TrafficLight.from_simulator_actor(tl_actor) for tl_actor in tl_actors
    ]

    speed_limit_actors = actor_list.filter('traffic.speed_limit*')
    speed_limits = [
        SpeedLimitSign.from_simulator_actor(ts_actor)
        for ts_actor in speed_limit_actors
    ]

    traffic_stop_actors = actor_list.filter('traffic.stop')
    traffic_stops = [
        StopSign.from_simulator_actor(ts_actor)
        for ts_actor in traffic_stop_actors
    ]

    return (vehicles, people, traffic_lights, speed_limits, traffic_stops)