from pathlib import Path from smarts.sstudio import gen_scenario from smarts.sstudio import types as t traffic = t.Traffic(flows=[ t.Flow( route=t.RandomRoute(), rate=60 * 60, actors={t.TrafficActor(name="car", vehicle_type=vehicle_type): 1}, ) for vehicle_type in [ "passenger", "bus", "coach", "truck", "trailer", "passenger", "bus", "coach", "truck", "trailer", ] ]) gen_scenario( t.Scenario(traffic={"basic": traffic}, ), output_dir=Path(__file__).parent, )
import random from pathlib import Path from smarts.sstudio import gen_scenario from smarts.sstudio import types as t traffic = t.Traffic(flows=[ t.Flow( route=t.RandomRoute(), rate=60 * 60, actors={t.TrafficActor(name="car", vehicle_type=vehicle_type): 1}, ) for vehicle_type in [ "passenger", "bus", "coach", "truck", "trailer", ] ]) open_agent_actor = t.SocialAgentActor(name="open-agent", agent_locator="open_agent:open_agent-v0") laner_actor = t.SocialAgentActor( name="keep-lane-agent", agent_locator="zoo.policies:keep-lane-agent-v0", ) gen_scenario( t.Scenario( traffic={"basic": traffic},
from pathlib import Path from smarts.core import seed from smarts.sstudio import gen_scenario from smarts.sstudio import types as t seed(42) traffic = t.Traffic(flows=[ t.Flow( route=t.RandomRoute(), rate=60 * 60, actors={t.TrafficActor(name="car", vehicle_type=vehicle_type): 1}, ) for vehicle_type in [ "passenger", "bus", "coach", "truck", "trailer", ] ]) laner_actor = t.SocialAgentActor( name="keep-lane-agent", agent_locator="zoo.policies:keep-lane-agent-v0", ) gen_scenario( t.Scenario( traffic={"basic": traffic}, social_agent_missions={
import random from pathlib import Path 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])})