Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sample scenarios #2017

Merged
merged 4 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "00a445fb-7293-4be6-adbc-e30c949b6cf7" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id

ego_mission = [
t.Mission(
t.Route(
begin=("road-206498749-206498861", 0, 28.3),
end=("road-206498749-206498861", 0, 52.3),
),
entry_tactic=t.TrapEntryTactic(
start_time=0.1, wait_to_hijack_limit_s=0, default_entry_speed=0
),
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet


scenario_id = "0a53dd99-2946-4b4d-ab66-c4d6fef97be2" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id

ego_mission = [
t.Mission(
t.Route(
begin=("road-353638670-353638219-353638558", 1, 6.7),
end=("road-353637909-353637861-353637941-353637727", 1, 4.2),
),
entry_tactic=t.IdEntryTactic(start_time=0.1, actor_id="history-vehicle-5717"),
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet


scenario_id = "0a576bf1-66ae-495a-9c87-236f3fc2aa01" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id

ego_mission = [
t.Mission(
t.Route(
begin=("road-431632924-431632618", 0, 0),
end=("road-431673448-431673312-431673462", 1, 17.0),
)
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "00aae286-362a-4240-aa89-50871a4bd924" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id
ego_mission = [
t.Mission(
t.Route(
begin=("road-423412446-423411525-423411465-423412854", 1, 0),
end=("road-423412446-423411525-423411465-423412854", 2, 20.5),
)
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "00b15e74-04a8-4bd4-9a78-eb24f0c0a980" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]
actor = t.SocialAgentActor(
name="Agent_007",
agent_locator="zoo.policies:chase-via-points-agent-v0",
)

ego_mission = [
t.Mission(
route=t.Route(begin=("road-240118388", 0, 1.3), end=("road-240118351", 0, 1.0))
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
# bubbles=[
# t.Bubble(
# actor=actor,
# zone=t.PositionalZone(pos=(0, 0), size=(50, 50)),
# follow_offset=(0, 0),
# margin=0,
# follow_actor_id="Agent_0",
# ),
# ],
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "0a60b442-56b0-46c3-be45-cf166a182b67" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id
ego_mission = [
t.Mission(
t.Route(
begin=("road-390747694", 0, 1.1),
end=("road-390753337-390753391-390752985", 1, 22.5),
)
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "0a764a82-b44e-481e-97e7-05e1f1f925f6" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id
ego_mission = [
t.Mission(
t.Route(
begin=("road-395015353-395015556", 0, 0.4),
end=("road-394994351", 0, 8.1),
)
)
]

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from pathlib import Path

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

# scenario_path is a directory with the following structure:
# /path/to/dataset/{scenario_id}
# ├── log_map_archive_{scenario_id}.json
# └── scenario_{scenario_id}.parquet

scenario_id = "0bf054e3-7698-4b86-9c98-626df2dee9f4" # e.g. "0000b6ab-e100-4f6b-aee8-b520b57c0530"
scenario_path = None # e.g. Path("/home/user/argoverse/train/") / scenario_id

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]
ego_mission = [
t.Mission(
route=t.Route(
begin=("road-331937899", 0, 10.1),
end=("road-331938057-331937870-331937776", 1, 13.4),
)
)
]

gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from pathlib import Path

from smarts.sstudio import gen_scenario
from smarts.sstudio import types as t
from smarts.core.colors import Colors


scenario_id = "ff239c9d-e4ff-4acc-bad5-bd55648c212e"
scenario_path = None

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

ego_mission = [t.EndlessMission(begin=("road-202833190-202832889-202833142", 2, "max"))]

leader_id = "history-vehicle-46408$"
# runtime = 11
gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
scenario_metadata=t.ScenarioMetadata(leader_id, Colors.Blue),
),
output_dir=Path(__file__).parent,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from pathlib import Path

from smarts.sstudio import gen_scenario
from smarts.sstudio import types as t
from smarts.core.colors import Colors


scenario_id = "ff239c9d-e4ff-4acc-bad5-bd55648c212e"
scenario_path = None

traffic_histories = [
t.TrafficHistoryDataset(
name=f"argoverse_{scenario_id}",
source_type="Argoverse",
input_path=scenario_path,
)
]

ego_mission = [t.EndlessMission(begin=("road-202833190-202832889-202833142", 0, "max"))]

leader_id = "history-vehicle-46408$"
# runtime = 11
gen_scenario(
t.Scenario(
ego_missions=ego_mission,
map_spec=t.MapSpec(source=f"{scenario_path}", lanepoint_spacing=1.0),
traffic_histories=traffic_histories,
scenario_metadata=t.ScenarioMetadata(leader_id, Colors.Blue),
),
output_dir=Path(__file__).parent,
)
Loading