from smarts.sstudio import types as t
from smarts.sstudio import gen_scenario

NUM_TRAFFIC_FLOWS = 60

traffic = t.Traffic(flows=[
    t.Flow(
        route=t.RandomRoute(),
        rate=60 * 5,
        actors={
            t.TrafficActor(
                name="car",
                vehicle_type=random.choice([
                    "passenger", "bus", "coach", "truck"
                ]),
                speed=t.Distribution(1, 0.3),
                max_speed=10,
            ):
            1
        },
    ) for _ in range(NUM_TRAFFIC_FLOWS)
])

lane_actor_list = [
    t.SocialAgentActor(
        name=f"keep-lane-agent-{idx}",
        agent_locator="zoo.policies:keep-lane-agent-v0",
        policy_kwargs={'speed': random.choice([5.5, 6, 6.5, 7, 7.5, 8, 9])})
    for idx in range(10)
]
Exemple #2
0
from pathlib import Path
from smarts.sstudio import gen_scenario
import smarts.sstudio.types as t

missions = [
    t.Mission(t.Route(begin=("gneE17", 0, 10), end=("gneE5", 0, 100))),
    t.Mission(t.Route(begin=("gneE22", 0, 10), end=("gneE5", 1, 100))),
    t.Mission(t.Route(begin=("gneE17", 0, 25), end=("gneE5", 0, 100))),
    t.Mission(t.Route(begin=("gneE22", 0, 25), end=("gneE5", 1, 100))),
]

impatient_car = t.TrafficActor(
    name="car",
    speed=t.Distribution(sigma=0.2, mean=1.0),
    lane_changing_model=t.LaneChangingModel(impatience=1, cooperative=0.25),
    junction_model=t.JunctionModel(drive_after_red_time=1.5,
                                   drive_after_yellow_time=1.0,
                                   impatience=1.0),
)

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

traffic = {
    "1":
    t.Traffic(flows=[
Exemple #3
0
from smarts.sstudio import types as t
from smarts.sstudio import gen_scenario

trajectory_boid_agent = t.BoidAgentActor(
    name="trajectory-boid",
    agent_locator="scenarios.straight.agent_prefabs:trajectory-boid-agent-v0",
)

pose_boid_agent = t.BoidAgentActor(
    name="pose-boid",
    agent_locator="scenarios.straight.agent_prefabs:pose-boid-agent-v0",
)

act1 = t.TrafficActor(name="car",
                      speed=t.Distribution(mean=1.0, sigma=0.1),
                      min_gap=t.Distribution(mean=2.5, sigma=0))
act2 = t.TrafficActor(name="car",
                      speed=t.Distribution(mean=1.0, sigma=0.3),
                      min_gap=t.Distribution(mean=2.5, sigma=0.2))

traffic = t.Traffic(flows=[
    t.Flow(
        route=t.Route(
            begin=("west", lane_idx, "random"),
            end=("east", lane_idx, "max"),
        ),
        # route=t.RandomRoute(),
        # rate=50,
        end=2 * 60 * 60,
        rate=600,