示例#1
0
def make_target_env_with_baseline(
        observation_scaling=1.0,  # 10.0
        ego_starting_distance=150.0):
    return factored_gym.FactoredGym(
        road.RoadProcess(ego_starting_distance=ego_starting_distance),
        road.RoadObserver(observation_scaling),
        road.RoadTerminator(time_limit=3 * 60), road.RoadGoalRewarder(), [])
示例#2
0
 def __init__(self, env_config):
     observation_scaling = 1.0  # 10.0
     ego_starting_distance = 600.0
     super().__init__(
         road.RoadProcess(ego_starting_distance=ego_starting_distance),
         road.RoadObserver(observation_scaling),
         road.RoadTerminator(time_limit=3 * 60), road.RoadRewarder(), [])
示例#3
0
 def __init__(self, env_config):
     observation_scaling = 1.0  # 10.0
     ego_starting_distance = 5.0
     super().__init__(
         road.RoadProcess(ego_starting_distance=ego_starting_distance),
         road.RoadObserver(observation_scaling),
         road.RoadTerminator(time_limit=5 * 60), road.RoadGoalRewarder(),
         [factored_gym.ActionCenterer([.001, 5], [0, 0])])
示例#4
0
    def __init__(self, env_config=None):
        observation_scaling = 1.0  # 10.0
        ego_starting_distance = 30.0

        # scenario_file = "/home/pgraf/work/cavs/CarlaProjects/carla-collect-2_28_20/./docs/scenarios/town01/scenario_009.json"   #13=has intersection, 9=turn, no intersection
        # process = RoadProcessOnCarlaMap(scenario_file, ego_starting_distance=ego_starting_distance, traffic_density=0.00, target_inset=15)  #0.02
        # process =road.RoadProcess(ego_starting_distance=ego_starting_distance),

        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_k_road_roadmaker/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_000b.json"

        # Learned to drive this with lidar (even w/out vehicle state in obs)
        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town01_all.json"
        route_num = 7

        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town04_merge.json"
        #        route_num = 0
        process = KRoadProcessOnCarlaMap(
            scenario_file,
            traffic_density=0.00,
            target_inset=70,
            ego_starting_distance=ego_starting_distance,
            fixed_route_num=route_num)
        # process = KRoadCarlaTwinRoadProcess(scenario_file, mode=KCModes.K0, traffic_density=0.00, target_inset=0,
        #     ego_starting_distance=ego_starting_distance, fixed_route_num = route_num)

        # speed_mean=12,

        super().__init__(
            process,
            #            road.RoadObserver(observation_scaling),
            RoadOccupancyGridObserver(observation_scaling,
                                      grid_length=9,
                                      grid_width=5),
            #            RoadOccupancyGridObserver(observation_scaling, grid_length = 18, grid_width = 10),  #, frames_to_observe=1),
            road.RoadTerminator(time_limit=60),  # (time_limit=3 * 60),
            road.RoadRewarder(),
            # road.RoadOccupancyGridRewarder()
        )
示例#5
0
    def __init__(self, env_config=None):
        observation_scaling = 1.0  # 10.0
        ego_starting_distance = 2000.0

        print("env_config", env_config)

        if "use_factored_obs" in env_config and env_config['use_factored_obs']:
            obs_config = env_config['obs_config']
            observer = FactoredRoadObserver(obs_config)
        else:
            observer = road.RoadObserver(observation_scaling)
        #            RoadOccupancyGridObserver(observation_scaling, grid_length = 9, grid_width = 5),
        #            RoadOccupancyGridObserver(observation_scaling, grid_length = 18, grid_width = 10),  #, frames_to_observe=1),

        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town04_jct.json"
        scenario = "cross_intersection"
        with_carla = False
        if "scenario" in env_config:
            scenario = env_config['scenario']
        if "with_carla" in env_config:
            with_carla = env_config['with_carla']

        if scenario == "curvy_road":
            bot_routes = None
            ego_routes = [2]
            traffic_density = 0
            target_inset = 20
            ego_starting_distance = 65.0

        elif scenario == "avoid_bots":
            bot_routes = [1]
            ego_routes = [1]
            traffic_density = 3
            target_inset = 5
            ego_starting_distance = 2000.0
        elif scenario == "cross_intersection":
            bot_routes = [1]
            ego_routes = [0]
            traffic_density = 12
            target_inset = 5
            ego_starting_distance = 2000.0

        # scenario_file = "/home/pgraf/work/cavs/CarlaProjects/carla-collect-2_28_20/./docs/scenarios/town01/scenario_009.json"   #13=has intersection, 9=turn, no intersection
        # process = RoadProcessOnCarlaMap(scenario_file, ego_starting_distance=ego_starting_distance, traffic_density=0.00, target_inset=15)  #0.02
        # process =road.RoadProcess(ego_starting_distance=ego_starting_distance),

        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_k_road_roadmaker/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_000b.json"

        # Learned to drive this with lidar (even w/out vehicle state in obs)
        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town01_all-nobndry.json"
        #        route_num = 7

        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town04_merge.json"
        #        scenario_file = "/home/pgraf/work/cavs/CarlaProjects/cavs-environments_roadmaker-clean/cavs_environments/vehicle/k_road/scenario/road/example/multi_route_scenario_town04_local.json"
        route_num = 1  ## only draw this route even though there are more "paths"
        #        route_num = None   ## draws all routes, ego goes on 0, no control over which that is
        if not with_carla:
            process = KRoadProcessOnCarlaMap(
                scenario_file,
                traffic_density=traffic_density,
                speed_mean=8,
                target_inset=target_inset,
                ego_starting_distance=ego_starting_distance,
                ego_routes=ego_routes,
                bot_routes=bot_routes)
        else:
            process = KRoadCarlaTwinRoadProcess(
                scenario_file,
                mode=KCModes.KC,
                traffic_density=traffic_density,
                speed_mean=8,
                target_inset=target_inset,
                ego_starting_distance=ego_starting_distance,
                ego_routes=ego_routes,
                bot_routes=bot_routes)
        #            process = KRoadCarlaTwinRoadProcess(scenario_file, mode=KCModes.K0, traffic_density=0.00, target_inset=0,
        #                    ego_starting_distance=ego_starting_distance, fixed_route_num = route_num)

        # speed_mean=12,
        # target_inset = 70

        super().__init__(
            process,
            observer,
            road.RoadTerminator(time_limit=60),  # (time_limit=3 * 60),
            road.RoadRewarder(),
            # road.RoadOccupancyGridRewarder()
        )