예제 #1
0
파일: scenario.py 프로젝트: zbzhu99/SMARTS
social_agent1 = SocialAgentActor(
    name="zoo-car1",
    agent_locator="scenarios.zoo_intersection.agent_prefabs:zoo-agent2-v0",
    initial_speed=20,
)
social_agent2 = SocialAgentActor(
    name="zoo-car2",
    agent_locator="scenarios.zoo_intersection.agent_prefabs:zoo-agent2-v0",
    initial_speed=20,
)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent2,
    name=f"s-agent-{social_agent2.name}",
    missions=[Mission(RandomRoute())],
)

gen_social_agent_missions(
    scenario,
    social_agent_actor=social_agent1,
    name=f"s-agent-{social_agent1.name}",
    missions=[
        EndlessMission(begin=("edge-south-SN", 0, 30)),
        Mission(
            Route(begin=("edge-west-WE", 0, 10), end=("edge-east-WE", 0, 10))),
    ],
)

# Agent Missions
gen_missions(
예제 #2
0
)

patient_car = TrafficActor(
    name="car",
    speed=Distribution(sigma=0.2, mean=0.5),
    lane_changing_model=LaneChangingModel(impatience=0, cooperative=0.5),
    junction_model=JunctionModel(drive_after_yellow_time=1.0, impatience=0.5),
)

car_type = patient_car
car_name = "patient_car"

traffic = Traffic(
    flows=[
        Flow(
            route=RandomRoute(),
            begin=0,
            end=1
            * 60
            * 60,  # make sure end time is larger than the time of one episode
            rate=30,
            actors={car_type: 1},
        )
        for i in range(sv_num)
    ]
)

print(f"generate flow with {sv_num} social {car_name} vehicles in {scenario_path} ")

gen_traffic(
    scenario_path,
예제 #3
0
    Flow,
    Route,
    RandomRoute,
    TrafficActor,
    Mission,
)

scenario = os.path.dirname(os.path.realpath(__file__))

agent_missions = [
    Mission(Route(begin=("left_in", 1, 20), end=("right_out", (0,), 40))),
    Mission(Route(begin=("left_in", 1, 40), end=("off_ramp", (0,), 40))),
    Mission(Route(begin=("left_in", 0, 20), end=("off_ramp", (0,), 40))),
    Mission(Route(begin=("left_in", 0, 50), end=("right_out", (0,), 40))),
]

gen_missions(scenario, agent_missions, overwrite=True)

gen_traffic(
    scenario,
    Traffic(
        flows=[
            Flow(
                route=RandomRoute(), rate=3600, actors={TrafficActor(name="car"): 1.0},
            )
        ]
    ),
    name="random",
    overwrite=True,
)