Skip to content
Snippets Groups Projects
Commit c73efdde authored by Eli Henry Dykhne's avatar Eli Henry Dykhne
Browse files

Merge branch 'shea-multiagent' into 'dev'

Multiagent ML Agents + Inserting New Agents into the scene

See merge request !4
parents 55e91f30 096b5275
No related branches found
No related tags found
2 merge requests!21Major changes. convert nuplan devkit to handle occlusions for project,!4Multiagent ML Agents + Inserting New Agents into the scene
%% Cell type:markdown id:34460db1 tags: %% Cell type:markdown id:34460db1 tags:
# Creating a new planner in nuPlan <a name="introduction"></a> # Creating a new planner in nuPlan <a name="introduction"></a>
%% Cell type:markdown id:f0189156 tags: %% Cell type:markdown id:f0189156 tags:
## Setup ## Setup
%% Cell type:code id:373ffd1c tags: %% Cell type:code id:373ffd1c tags:
``` python ``` python
# Useful imports # Useful imports
import os import os
import hydra import hydra
import nest_asyncio import nest_asyncio
from IPython.core.display import display, HTML from IPython.core.display import display, HTML
from bokeh.io import output_notebook from bokeh.io import output_notebook
``` ```
%% Output %% Output
/tmp/ipykernel_2455/4095267831.py:5: DeprecationWarning: Importing display from IPython.core.display is deprecated since IPython 7.14, please import from IPython display /tmp/ipykernel_8229/4095267831.py:5: DeprecationWarning: Importing display from IPython.core.display is deprecated since IPython 7.14, please import from IPython display
from IPython.core.display import display, HTML from IPython.core.display import display, HTML
%% Cell type:code id:13c00121 tags: %% Cell type:code id:13c00121 tags:
``` python ``` python
nest_asyncio.apply() nest_asyncio.apply()
output_notebook() output_notebook()
display(HTML("<style>.output_result { max-width:100% !important; }</style>")) display(HTML("<style>.output_result { max-width:100% !important; }</style>"))
display(HTML("<style>.container { width:100% !important; }</style>")) display(HTML("<style>.container { width:100% !important; }</style>"))
``` ```
%% Output %% Output
%% Cell type:markdown id:128b0d15 tags: %% Cell type:markdown id:128b0d15 tags:
# Simulating the planner <a name="simulation"></a> # Simulating the planner <a name="simulation"></a>
%% Cell type:code id:aff526c3 tags: %% Cell type:code id:aff526c3 tags:
``` python ``` python
%pwd %pwd
``` ```
%% Output %% Output
'/host_home/Repos/nuplan-devkit/experiments' '/home/sacardoz/nuplan-devkit/experiments'
%% Cell type:code id:c8b59d7c tags:
``` python
%env NUPLAN_DATA_ROOT=/home/ehdykhne/Repos/Datasets/nuplan/dataset
%env NUPLAN_MAPS_ROOT=/home/ehdykhne/Repos/Datasets/nuplan/dataset/maps
```
%% Output
env: NUPLAN_DATA_ROOT=/home/ehdykhne/Repos/Datasets/nuplan/dataset
env: NUPLAN_MAPS_ROOT=/home/ehdykhne/Repos/Datasets/nuplan/dataset/maps
%% Cell type:markdown id:db337ceb tags: %% Cell type:markdown id:db337ceb tags:
## Prepare the simulation config ## Prepare the simulation config
%% Cell type:code id:11b08c6d tags: %% Cell type:code id:11b08c6d tags:
``` python ``` python
from tutorials.utils.tutorial_utils import construct_simulation_hydra_paths from tutorials.utils.tutorial_utils import construct_simulation_hydra_paths
# Location of paths with all simulation configs # Location of paths with all simulation configs
BASE_CONFIG_PATH = os.path.join(os.getenv('NUPLAN_TUTORIAL_PATH', ''), '../nuplan/planning/script') BASE_CONFIG_PATH = os.path.join(os.getenv('NUPLAN_TUTORIAL_PATH', ''), '../nuplan/planning/script')
simulation_hydra_paths = construct_simulation_hydra_paths(BASE_CONFIG_PATH) simulation_hydra_paths = construct_simulation_hydra_paths(BASE_CONFIG_PATH)
# Create a temporary directory to store the simulation artifacts # Create a temporary directory to store the simulation artifacts
DATASET_PARAMS = [ DATASET_PARAMS = [
'scenario_builder=nuplan_mini', # use nuplan mini database (2.5h of 8 autolabeled logs in Las Vegas) 'scenario_builder=nuplan_mini', # use nuplan mini database (2.5h of 8 autolabeled logs in Las Vegas)
'scenario_filter=one_continuous_log', # simulate only one log 'scenario_filter=one_continuous_log', # simulate only one log
"scenario_filter.log_names=['2021.06.14.16.48.02_veh-12_04057_04438']", "scenario_filter.log_names=['2021.06.14.16.48.02_veh-12_04057_04438']",
'scenario_filter.limit_total_scenarios=1', # use 1 total scenarios 'scenario_filter.limit_total_scenarios=1', # use 1 total scenarios
] ]
ckpt_dir = '/home/ehdykhne/Repos/nuplan-devkit/experiments/pretrained_checkpoints/pdm_offset_checkpoint.ckpt' ckpt_dir = '/home/sacardoz/checkpoints/urbandriver_checkpoint.ckpt'
#'/home/sacardoz/checkpoints/urbandriver_checkpoint.ckpt' #'/home/sacardoz/checkpoints/urbandriver_checkpoint.ckpt'
#"/home/sacardoz/tutorial_vector_framework/training_simple_vector_experiment/train_default_simple_vector/2023.11.23.09.55.21/best_model/epoch.ckpt" #"/home/sacardoz/tutorial_vector_framework/training_simple_vector_experiment/train_default_simple_vector/2023.11.23.09.55.21/best_model/epoch.ckpt"
#"/home/sacardoz/training_raster_experiment/train_default_raster/2023.11.23.07.36.36/best_model/epoch.ckpt" #"/home/sacardoz/training_raster_experiment/train_default_raster/2023.11.23.07.36.36/best_model/epoch.ckpt"
# Initialize configuration management system # Initialize configuration management system
hydra.core.global_hydra.GlobalHydra.instance().clear() # reinitialize hydra if already initialized hydra.core.global_hydra.GlobalHydra.instance().clear() # reinitialize hydra if already initialized
hydra.initialize(config_path=simulation_hydra_paths.config_path) hydra.initialize(config_path=simulation_hydra_paths.config_path)
# Compose the configuration # Compose the configuration
cfg = hydra.compose(config_name=simulation_hydra_paths.config_name, overrides=[ cfg = hydra.compose(config_name=simulation_hydra_paths.config_name, overrides=[
'+simulation=closed_loop_reactive_agents', '+simulation=closed_loop_multiagent',
#'model=pgm_hybrid_model', 'model=urban_driver_open_loop_model',
'planner=pdm_hybrid_planner', 'planner=ml_planner',
f"planner.pdm_hybrid_planner.checkpoint_path={ckpt_dir}" , #f"planner.pdm_hybrid_planner.checkpoint_path={ckpt_dir}" ,
#'planner.ml_planner.model_config=${model}', 'planner.ml_planner.model_config=${model}',
#f'planner.ml_planner.checkpoint_path={ckpt_dir}', f'planner.ml_planner.checkpoint_path={ckpt_dir}',
#f'observation=idm_agents_observation', 'observation.model_config=${model}',
#'observation.model_config=${model}', f'observation.checkpoint_path={ckpt_dir}',
#f'observation.checkpoint_path={ckpt_dir}',
'worker=sequential', 'worker=sequential',
'+occlusion=true', '+occlusion=true',
'+occlusion.manager_type=wedge', #options: [range, shadow, wedge] '+occlusion.manager_type=shadow', #options: [range, shadow, wedge]
"hydra.searchpath=[pkg://tuplan_garage.planning.script.config.common, pkg://tuplan_garage.planning.script.config.simulation, pkg://nuplan.planning.script.config.common, pkg://nuplan.planning.script.experiments]", "hydra.searchpath=[pkg://nuplan_garage.planning.script.config.common, pkg://nuplan_garage.planning.script.config.simulation, pkg://nuplan.planning.script.config.common, pkg://nuplan.planning.script.experiments]",
*DATASET_PARAMS, *DATASET_PARAMS,
]) ])
``` ```
%% Cell type:markdown id:88231b74 tags: %% Cell type:markdown id:88231b74 tags:
## Launch simulation (within the notebook) ## Launch simulation (within the notebook)
%% Cell type:code id:161cc166 tags: %% Cell type:code id:161cc166 tags:
``` python ``` python
from nuplan.planning.script.run_simulation import build_simulation_runners from nuplan.planning.script.run_simulation import build_simulation_runners
from nuplan.common.actor_state.tracked_objects_types import AGENT_TYPES, STATIC_OBJECT_TYPES, TrackedObjectType from nuplan.common.actor_state.tracked_objects_types import AGENT_TYPES, STATIC_OBJECT_TYPES, TrackedObjectType
# Run the simulation loop (real-time visualization not yet supported, see next section for visualization) # Run the simulation loop (real-time visualization not yet supported, see next section for visualization)
runners, common_builder, cfg = build_simulation_runners(cfg) runners, common_builder, cfg = build_simulation_runners(cfg)
``` ```
%% Output %% Output
INFO:nuplan.planning.script.utils:Setting default NUPLAN_DATA_ROOT: /home/sacardoz/nuplan/dataset
INFO:nuplan.planning.script.utils:Setting default NUPLAN_EXP_ROOT: /home/sacardoz/nuplan/exp
Global seed set to 0 Global seed set to 0
INFO:nuplan.planning.script.builders.main_callback_builder:Building MultiMainCallback... INFO:nuplan.planning.script.builders.main_callback_builder:Building MultiMainCallback...
INFO:nuplan.planning.script.builders.main_callback_builder:Building MultiMainCallback: 4...DONE! INFO:nuplan.planning.script.builders.main_callback_builder:Building MultiMainCallback: 4...DONE!
2023-12-04 23:36:26,261 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/worker_pool_builder.py:19} Building WorkerPool... 2023-12-05 02:14:01,684 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/worker_pool_builder.py:19} Building WorkerPool...
2023-12-04 23:36:26,263 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/utils/multithreading/worker_pool.py:101} Worker: Sequential 2023-12-05 02:14:01,685 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/utils/multithreading/worker_pool.py:101} Worker: Sequential
2023-12-04 23:36:26,263 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/utils/multithreading/worker_pool.py:102} Number of nodes: 1 2023-12-05 02:14:01,685 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/utils/multithreading/worker_pool.py:102} Number of nodes: 1
Number of CPUs per node: 1 Number of CPUs per node: 1
Number of GPUs per node: 0 Number of GPUs per node: 0
Number of threads across all nodes: 1 Number of threads across all nodes: 1
2023-12-04 23:36:26,263 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/worker_pool_builder.py:27} Building WorkerPool...DONE! 2023-12-05 02:14:01,685 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/worker_pool_builder.py:27} Building WorkerPool...DONE!
2023-12-04 23:36:26,263 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:32} Building experiment folders... 2023-12-05 02:14:01,685 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:32} Building experiment folders...
2023-12-04 23:36:26,263 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:35} 2023-12-05 02:14:01,685 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:35}
Folder where all results are stored: /home/ehdykhne/Repos/Datasets/nuplan/exp/exp/simulation/closed_loop_reactive_agents/2023.12.04.23.36.25 Folder where all results are stored: /home/sacardoz/nuplan/exp/exp/simulation/closed_loop_multiagent/2023.12.05.02.14.01
2023-12-04 23:36:26,293 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:70} Building experiment folders...DONE! 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/folder_builder.py:70} Building experiment folders...DONE!
2023-12-04 23:36:26,293 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_callback_builder.py:52} Building AbstractCallback... 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_callback_builder.py:52} Building AbstractCallback...
2023-12-04 23:36:26,293 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_callback_builder.py:68} Building AbstractCallback: 0...DONE! 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_callback_builder.py:68} Building AbstractCallback: 0...DONE!
2023-12-04 23:36:26,293 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:49} Building simulations... 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:49} Building simulations...
2023-12-04 23:36:26,293 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:55} Extracting scenarios... 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:55} Extracting scenarios...
2023-12-04 23:36:26,294 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/common/utils/distributed_scenario_filter.py:83} Building Scenarios in mode DistributedMode.SINGLE_NODE 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/common/utils/distributed_scenario_filter.py:83} Building Scenarios in mode DistributedMode.SINGLE_NODE
2023-12-04 23:36:26,294 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/scenario_building_builder.py:18} Building AbstractScenarioBuilder... 2023-12-05 02:14:01,687 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/scenario_building_builder.py:18} Building AbstractScenarioBuilder...
2023-12-04 23:36:26,305 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/scenario_building_builder.py:21} Building AbstractScenarioBuilder...DONE! 2023-12-05 02:14:01,700 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/scenario_building_builder.py:21} Building AbstractScenarioBuilder...DONE!
2023-12-04 23:36:26,305 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/scenario_filter_builder.py:35} Building ScenarioFilter... 2023-12-05 02:14:01,700 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/scenario_filter_builder.py:35} Building ScenarioFilter...
2023-12-04 23:36:26,306 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/scenario_filter_builder.py:44} Building ScenarioFilter...DONE! 2023-12-05 02:14:01,701 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/scenario_filter_builder.py:44} Building ScenarioFilter...DONE!
2023-12-04 23:36:26,381 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:76} Building metric engines... 2023-12-05 02:14:01,719 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:76} Building metric engines...
2023-12-04 23:36:26,403 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:78} Building metric engines...DONE 2023-12-05 02:14:01,744 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:78} Building metric engines...DONE
2023-12-04 23:36:26,403 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:82} Building simulations from 1 scenarios... 2023-12-05 02:14:01,744 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:82} Building simulations from 1 scenarios...
2023-12-04 23:36:26,979 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:142} Building simulations...DONE! 2023-12-05 02:14:01,746 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/model_builder.py:18} Building TorchModuleWrapper...
2023-12-05 02:14:01,787 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/model_builder.py:21} Building TorchModuleWrapper...DONE!
2023-12-05 02:14:01,912 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/model_builder.py:18} Building TorchModuleWrapper...
2023-12-05 02:14:01,956 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/model_builder.py:21} Building TorchModuleWrapper...DONE!
2023-12-05 02:14:02,577 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/script/builders/simulation_builder.py:142} Building simulations...DONE!
%% Cell type:code id:223284d4 tags: %% Cell type:code id:223284d4 tags:
``` python ``` python
runner = runners[0] runner = runners[0]
``` ```
%% Cell type:code id:907ad940 tags:
``` python
from nuplan.common.actor_state.agent import Agent
from nuplan.common.actor_state.oriented_box import OrientedBox
from nuplan.common.actor_state.scene_object import SceneObjectMetadata
from nuplan.common.actor_state.state_representation import StateSE2, StateVector2D
inserted_agent = Agent(tracked_object_type=TrackedObjectType.VEHICLE,
oriented_box=OrientedBox(StateSE2(664433, 3997400, 3 * 3.14 / 2), 5, 2, 2),
velocity=StateVector2D(0,0),
metadata=SceneObjectMetadata(1623707858950113, "inserted", -2, "inserted"),
angular_velocity=0.0)
inserted_goal = StateSE2(664433, 3997000, 3 * 3.14 / 2)
```
%% Cell type:code id:90b79421 tags: %% Cell type:code id:90b79421 tags:
``` python ``` python
runner.simulation.callback.on_simulation_start(runner.simulation.setup) runner.simulation.callback.on_simulation_start(runner.simulation.setup)
# Initialize all simulations # Initialize all simulations
runner._initialize() runner._initialize()
while runner.simulation.is_simulation_running(): while runner.simulation.is_simulation_running():
if runner.simulation._time_controller.get_iteration().index == 125:
runner.simulation._observations.add_agent_to_scene(inserted_agent, inserted_goal, iteration.time_point)
# Execute specific callback # Execute specific callback
runner.simulation.callback.on_step_start(runner.simulation.setup, runner.planner) runner.simulation.callback.on_step_start(runner.simulation.setup, runner.planner)
# Perform step # Perform step
planner_input = runner._simulation.get_planner_input() planner_input = runner._simulation.get_planner_input()
# Execute specific callback # Execute specific callback
runner._simulation.callback.on_planner_start(runner.simulation.setup, runner.planner) runner._simulation.callback.on_planner_start(runner.simulation.setup, runner.planner)
# Plan path based on all planner's inputs # Plan path based on all planner's inputs
trajectory = runner.planner.compute_trajectory(planner_input) trajectory = runner.planner.compute_trajectory(planner_input)
# Propagate simulation based on planner trajectory # Propagate simulation based on planner trajectory
runner._simulation.callback.on_planner_end(runner.simulation.setup, runner.planner, trajectory) runner._simulation.callback.on_planner_end(runner.simulation.setup, runner.planner, trajectory)
iteration = runner.simulation._time_controller.get_iteration() iteration = runner.simulation._time_controller.get_iteration()
print(iteration)
runner.simulation.propagate(trajectory) runner.simulation.propagate(trajectory)
# Execute specific callback # Execute specific callback
runner.simulation.callback.on_step_end(runner.simulation.setup, runner.planner, runner.simulation.history.last()) runner.simulation.callback.on_step_end(runner.simulation.setup, runner.planner, runner.simulation.history.last())
runner.simulation.callback.on_simulation_end(runner.simulation.setup, runner.planner, runner.simulation.history) runner.simulation.callback.on_simulation_end(runner.simulation.setup, runner.planner, runner.simulation.history)
``` ```
%% Output %% Output
SimulationIteration(time_point=TimePoint(time_us=1623707846350127), index=0)
SimulationIteration(time_point=TimePoint(time_us=1623707846450055), index=1)
elapsed time: 0.028219938278198242 SimulationIteration(time_point=TimePoint(time_us=1623707846549980), index=2)
elapsed time: 0.02777719497680664 SimulationIteration(time_point=TimePoint(time_us=1623707846649908), index=3)
elapsed time: 0.02846693992614746 SimulationIteration(time_point=TimePoint(time_us=1623707846749828), index=4)
elapsed time: 0.0270230770111084 SimulationIteration(time_point=TimePoint(time_us=1623707846849751), index=5)
elapsed time: 0.027086973190307617 SimulationIteration(time_point=TimePoint(time_us=1623707846949678), index=6)
elapsed time: 0.02704000473022461 SimulationIteration(time_point=TimePoint(time_us=1623707847049600), index=7)
elapsed time: 0.02687692642211914 SimulationIteration(time_point=TimePoint(time_us=1623707847149533), index=8)
elapsed time: 0.02667236328125 SimulationIteration(time_point=TimePoint(time_us=1623707847249494), index=9)
elapsed time: 0.027269363403320312 SimulationIteration(time_point=TimePoint(time_us=1623707847349489), index=10)
elapsed time: 0.026731491088867188 SimulationIteration(time_point=TimePoint(time_us=1623707847449511), index=11)
elapsed time: 0.02642965316772461 SimulationIteration(time_point=TimePoint(time_us=1623707847549545), index=12)
elapsed time: 0.02652263641357422 SimulationIteration(time_point=TimePoint(time_us=1623707847649595), index=13)
elapsed time: 0.026285171508789062 SimulationIteration(time_point=TimePoint(time_us=1623707847749661), index=14)
elapsed time: 0.026721715927124023 SimulationIteration(time_point=TimePoint(time_us=1623707847849740), index=15)
elapsed time: 0.02680516242980957 SimulationIteration(time_point=TimePoint(time_us=1623707847949830), index=16)
elapsed time: 0.026640892028808594 SimulationIteration(time_point=TimePoint(time_us=1623707848049917), index=17)
elapsed time: 0.02759575843811035 SimulationIteration(time_point=TimePoint(time_us=1623707848149996), index=18)
elapsed time: 0.02881908416748047 SimulationIteration(time_point=TimePoint(time_us=1623707848250061), index=19)
elapsed time: 0.02743077278137207 SimulationIteration(time_point=TimePoint(time_us=1623707848350125), index=20)
elapsed time: 0.02760910987854004 SimulationIteration(time_point=TimePoint(time_us=1623707848450201), index=21)
elapsed time: 0.026903390884399414 SimulationIteration(time_point=TimePoint(time_us=1623707848550285), index=22)
elapsed time: 0.027498245239257812 SimulationIteration(time_point=TimePoint(time_us=1623707848650366), index=23)
elapsed time: 0.02749776840209961 SimulationIteration(time_point=TimePoint(time_us=1623707848750437), index=24)
elapsed time: 0.027604103088378906 SimulationIteration(time_point=TimePoint(time_us=1623707848850498), index=25)
elapsed time: 0.028120994567871094 SimulationIteration(time_point=TimePoint(time_us=1623707848950550), index=26)
elapsed time: 0.028057098388671875 SimulationIteration(time_point=TimePoint(time_us=1623707849050609), index=27)
elapsed time: 0.02862381935119629 SimulationIteration(time_point=TimePoint(time_us=1623707849150663), index=28)
elapsed time: 0.02895808219909668 SimulationIteration(time_point=TimePoint(time_us=1623707849250694), index=29)
elapsed time: 0.02965092658996582 SimulationIteration(time_point=TimePoint(time_us=1623707849350712), index=30)
elapsed time: 0.02978205680847168 SimulationIteration(time_point=TimePoint(time_us=1623707849450721), index=31)
elapsed time: 0.030011653900146484 SimulationIteration(time_point=TimePoint(time_us=1623707849550719), index=32)
elapsed time: 0.029865503311157227 SimulationIteration(time_point=TimePoint(time_us=1623707849650719), index=33)
elapsed time: 0.03024911880493164 SimulationIteration(time_point=TimePoint(time_us=1623707849750708), index=34)
elapsed time: 0.02980661392211914 SimulationIteration(time_point=TimePoint(time_us=1623707849850693), index=35)
elapsed time: 0.030503511428833008 SimulationIteration(time_point=TimePoint(time_us=1623707849950680), index=36)
elapsed time: 0.0301516056060791 SimulationIteration(time_point=TimePoint(time_us=1623707850050657), index=37)
elapsed time: 0.0298004150390625 SimulationIteration(time_point=TimePoint(time_us=1623707850150617), index=38)
elapsed time: 0.029525279998779297 SimulationIteration(time_point=TimePoint(time_us=1623707850250579), index=39)
elapsed time: 0.029907703399658203 SimulationIteration(time_point=TimePoint(time_us=1623707850350533), index=40)
elapsed time: 0.029463529586791992 SimulationIteration(time_point=TimePoint(time_us=1623707850450476), index=41)
elapsed time: 0.02914571762084961 SimulationIteration(time_point=TimePoint(time_us=1623707850550409), index=42)
elapsed time: 0.0291597843170166 SimulationIteration(time_point=TimePoint(time_us=1623707850650331), index=43)
elapsed time: 0.02936530113220215 SimulationIteration(time_point=TimePoint(time_us=1623707850750249), index=44)
elapsed time: 0.029200077056884766 SimulationIteration(time_point=TimePoint(time_us=1623707850850165), index=45)
elapsed time: 0.0286557674407959 SimulationIteration(time_point=TimePoint(time_us=1623707850950074), index=46)
elapsed time: 0.02902507781982422 SimulationIteration(time_point=TimePoint(time_us=1623707851049984), index=47)
elapsed time: 0.028758764266967773 SimulationIteration(time_point=TimePoint(time_us=1623707851149906), index=48)
elapsed time: 0.02935171127319336 SimulationIteration(time_point=TimePoint(time_us=1623707851249854), index=49)
elapsed time: 0.029259204864501953 SimulationIteration(time_point=TimePoint(time_us=1623707851349817), index=50)
elapsed time: 0.029033422470092773 SimulationIteration(time_point=TimePoint(time_us=1623707851449795), index=51)
elapsed time: 0.028880834579467773 SimulationIteration(time_point=TimePoint(time_us=1623707851549788), index=52)
elapsed time: 0.028924226760864258 SimulationIteration(time_point=TimePoint(time_us=1623707851649785), index=53)
elapsed time: 0.028826475143432617 SimulationIteration(time_point=TimePoint(time_us=1623707851749789), index=54)
elapsed time: 0.028478622436523438 SimulationIteration(time_point=TimePoint(time_us=1623707851849798), index=55)
elapsed time: 0.0288240909576416 SimulationIteration(time_point=TimePoint(time_us=1623707851949814), index=56)
elapsed time: 0.02877044677734375 SimulationIteration(time_point=TimePoint(time_us=1623707852049839), index=57)
elapsed time: 0.028140544891357422 SimulationIteration(time_point=TimePoint(time_us=1623707852149873), index=58)
elapsed time: 0.02760028839111328 SimulationIteration(time_point=TimePoint(time_us=1623707852249912), index=59)
elapsed time: 0.027898073196411133 SimulationIteration(time_point=TimePoint(time_us=1623707852349958), index=60)
elapsed time: 0.02771472930908203 SimulationIteration(time_point=TimePoint(time_us=1623707852450015), index=61)
elapsed time: 0.027673721313476562 SimulationIteration(time_point=TimePoint(time_us=1623707852550074), index=62)
elapsed time: 0.02758169174194336 SimulationIteration(time_point=TimePoint(time_us=1623707852650134), index=63)
elapsed time: 0.027628183364868164 SimulationIteration(time_point=TimePoint(time_us=1623707852750202), index=64)
elapsed time: 0.027477741241455078 SimulationIteration(time_point=TimePoint(time_us=1623707852850274), index=65)
elapsed time: 0.027070999145507812 SimulationIteration(time_point=TimePoint(time_us=1623707852950341), index=66)
elapsed time: 0.026733875274658203 SimulationIteration(time_point=TimePoint(time_us=1623707853050396), index=67)
elapsed time: 0.02656245231628418 SimulationIteration(time_point=TimePoint(time_us=1623707853150437), index=68)
elapsed time: 0.026247739791870117 SimulationIteration(time_point=TimePoint(time_us=1623707853250455), index=69)
elapsed time: 0.02589249610900879 SimulationIteration(time_point=TimePoint(time_us=1623707853350458), index=70)
elapsed time: 0.025628089904785156 SimulationIteration(time_point=TimePoint(time_us=1623707853450447), index=71)
elapsed time: 0.025936126708984375 SimulationIteration(time_point=TimePoint(time_us=1623707853550423), index=72)
elapsed time: 0.0257565975189209 SimulationIteration(time_point=TimePoint(time_us=1623707853650396), index=73)
elapsed time: 0.025776147842407227 SimulationIteration(time_point=TimePoint(time_us=1623707853750371), index=74)
elapsed time: 0.025105953216552734 SimulationIteration(time_point=TimePoint(time_us=1623707853850348), index=75)
elapsed time: 0.024316072463989258 SimulationIteration(time_point=TimePoint(time_us=1623707853950316), index=76)
elapsed time: 0.02410602569580078 SimulationIteration(time_point=TimePoint(time_us=1623707854050282), index=77)
elapsed time: 0.0240628719329834 SimulationIteration(time_point=TimePoint(time_us=1623707854150246), index=78)
elapsed time: 0.023929595947265625 SimulationIteration(time_point=TimePoint(time_us=1623707854250202), index=79)
elapsed time: 0.024273395538330078 SimulationIteration(time_point=TimePoint(time_us=1623707854350166), index=80)
elapsed time: 0.023852109909057617 SimulationIteration(time_point=TimePoint(time_us=1623707854450127), index=81)
elapsed time: 0.023021221160888672 SimulationIteration(time_point=TimePoint(time_us=1623707854550087), index=82)
elapsed time: 0.024117708206176758 SimulationIteration(time_point=TimePoint(time_us=1623707854650049), index=83)
elapsed time: 0.023128271102905273 SimulationIteration(time_point=TimePoint(time_us=1623707854750013), index=84)
elapsed time: 0.02261972427368164 SimulationIteration(time_point=TimePoint(time_us=1623707854849975), index=85)
elapsed time: 0.022465229034423828 SimulationIteration(time_point=TimePoint(time_us=1623707854949934), index=86)
elapsed time: 0.022220611572265625 SimulationIteration(time_point=TimePoint(time_us=1623707855049897), index=87)
elapsed time: 0.021961688995361328 SimulationIteration(time_point=TimePoint(time_us=1623707855149866), index=88)
elapsed time: 0.02196502685546875 SimulationIteration(time_point=TimePoint(time_us=1623707855249835), index=89)
elapsed time: 0.021490097045898438 SimulationIteration(time_point=TimePoint(time_us=1623707855349806), index=90)
elapsed time: 0.02141594886779785 SimulationIteration(time_point=TimePoint(time_us=1623707855449781), index=91)
elapsed time: 0.02118968963623047 SimulationIteration(time_point=TimePoint(time_us=1623707855549767), index=92)
elapsed time: 0.021246671676635742 SimulationIteration(time_point=TimePoint(time_us=1623707855649761), index=93)
elapsed time: 0.020877838134765625 SimulationIteration(time_point=TimePoint(time_us=1623707855749759), index=94)
elapsed time: 0.020760774612426758 SimulationIteration(time_point=TimePoint(time_us=1623707855849764), index=95)
elapsed time: 0.020011425018310547 SimulationIteration(time_point=TimePoint(time_us=1623707855949781), index=96)
elapsed time: 0.020204544067382812 SimulationIteration(time_point=TimePoint(time_us=1623707856049800), index=97)
elapsed time: 0.019935131072998047 SimulationIteration(time_point=TimePoint(time_us=1623707856149811), index=98)
elapsed time: 0.020002126693725586 SimulationIteration(time_point=TimePoint(time_us=1623707856249820), index=99)
elapsed time: 0.020210981369018555 SimulationIteration(time_point=TimePoint(time_us=1623707856349835), index=100)
elapsed time: 0.01934981346130371 SimulationIteration(time_point=TimePoint(time_us=1623707856449843), index=101)
elapsed time: 0.0188140869140625 SimulationIteration(time_point=TimePoint(time_us=1623707856549842), index=102)
elapsed time: 0.01867389678955078 SimulationIteration(time_point=TimePoint(time_us=1623707856649840), index=103)
elapsed time: 0.018260478973388672 SimulationIteration(time_point=TimePoint(time_us=1623707856749839), index=104)
elapsed time: 0.01837778091430664 SimulationIteration(time_point=TimePoint(time_us=1623707856849830), index=105)
elapsed time: 0.018278837203979492 SimulationIteration(time_point=TimePoint(time_us=1623707856949823), index=106)
elapsed time: 0.018478870391845703 SimulationIteration(time_point=TimePoint(time_us=1623707857049822), index=107)
elapsed time: 0.018354177474975586 SimulationIteration(time_point=TimePoint(time_us=1623707857149827), index=108)
elapsed time: 0.01824164390563965 SimulationIteration(time_point=TimePoint(time_us=1623707857249832), index=109)
elapsed time: 0.017989397048950195 SimulationIteration(time_point=TimePoint(time_us=1623707857349847), index=110)
elapsed time: 0.018170833587646484 SimulationIteration(time_point=TimePoint(time_us=1623707857449869), index=111)
elapsed time: 0.017641782760620117 SimulationIteration(time_point=TimePoint(time_us=1623707857549895), index=112)
elapsed time: 0.017865657806396484 SimulationIteration(time_point=TimePoint(time_us=1623707857649926), index=113)
elapsed time: 0.017589569091796875 SimulationIteration(time_point=TimePoint(time_us=1623707857749959), index=114)
elapsed time: 0.01693439483642578 SimulationIteration(time_point=TimePoint(time_us=1623707857849999), index=115)
elapsed time: 0.016333580017089844 SimulationIteration(time_point=TimePoint(time_us=1623707857950037), index=116)
elapsed time: 0.016154050827026367 SimulationIteration(time_point=TimePoint(time_us=1623707858050070), index=117)
elapsed time: 0.01594376564025879 SimulationIteration(time_point=TimePoint(time_us=1623707858150098), index=118)
elapsed time: 0.015879392623901367 SimulationIteration(time_point=TimePoint(time_us=1623707858250120), index=119)
elapsed time: 0.015716075897216797 SimulationIteration(time_point=TimePoint(time_us=1623707858350135), index=120)
elapsed time: 0.01625823974609375 SimulationIteration(time_point=TimePoint(time_us=1623707858450145), index=121)
elapsed time: 0.015722990036010742 SimulationIteration(time_point=TimePoint(time_us=1623707858550149), index=122)
elapsed time: 0.01554727554321289 SimulationIteration(time_point=TimePoint(time_us=1623707858650146), index=123)
elapsed time: 0.015479564666748047 SimulationIteration(time_point=TimePoint(time_us=1623707858750137), index=124)
elapsed time: 0.01556706428527832 SimulationIteration(time_point=TimePoint(time_us=1623707858850126), index=125)
elapsed time: 0.015661954879760742 SimulationIteration(time_point=TimePoint(time_us=1623707858950113), index=126)
elapsed time: 0.01565694808959961 SimulationIteration(time_point=TimePoint(time_us=1623707859050096), index=127)
elapsed time: 0.014882326126098633 SimulationIteration(time_point=TimePoint(time_us=1623707859150076), index=128)
elapsed time: 0.014642000198364258 SimulationIteration(time_point=TimePoint(time_us=1623707859250064), index=129)
elapsed time: 0.014568328857421875 SimulationIteration(time_point=TimePoint(time_us=1623707859350064), index=130)
elapsed time: 0.014591693878173828 SimulationIteration(time_point=TimePoint(time_us=1623707859450064), index=131)
elapsed time: 0.014154195785522461 SimulationIteration(time_point=TimePoint(time_us=1623707859550063), index=132)
elapsed time: 0.014048576354980469 SimulationIteration(time_point=TimePoint(time_us=1623707859650055), index=133)
elapsed time: 0.013832807540893555 SimulationIteration(time_point=TimePoint(time_us=1623707859750047), index=134)
elapsed time: 0.013761281967163086 SimulationIteration(time_point=TimePoint(time_us=1623707859850041), index=135)
elapsed time: 0.013667583465576172 SimulationIteration(time_point=TimePoint(time_us=1623707859950028), index=136)
elapsed time: 0.01350092887878418 SimulationIteration(time_point=TimePoint(time_us=1623707860050018), index=137)
elapsed time: 0.013176918029785156 SimulationIteration(time_point=TimePoint(time_us=1623707860150002), index=138)
elapsed time: 0.013062000274658203 SimulationIteration(time_point=TimePoint(time_us=1623707860249979), index=139)
elapsed time: 0.013159036636352539 SimulationIteration(time_point=TimePoint(time_us=1623707860349963), index=140)
elapsed time: 0.013329505920410156 SimulationIteration(time_point=TimePoint(time_us=1623707860449960), index=141)
elapsed time: 0.013332366943359375 SimulationIteration(time_point=TimePoint(time_us=1623707860549964), index=142)
elapsed time: 0.013476133346557617 SimulationIteration(time_point=TimePoint(time_us=1623707860649965), index=143)
elapsed time: 0.013322591781616211 SimulationIteration(time_point=TimePoint(time_us=1623707860749961), index=144)
elapsed time: 0.01374506950378418 SimulationIteration(time_point=TimePoint(time_us=1623707860849946), index=145)
elapsed time: 0.013417720794677734 SimulationIteration(time_point=TimePoint(time_us=1623707860949927), index=146)
elapsed time: 0.013437509536743164 SimulationIteration(time_point=TimePoint(time_us=1623707861049906), index=147)
elapsed time: 0.013459444046020508 SimulationIteration(time_point=TimePoint(time_us=1623707861149865), index=148)
elapsed time: 0.013498783111572266
elapsed time: 0.013631343841552734
elapsed time: 0.013602733612060547
elapsed time: 0.013532161712646484
elapsed time: 0.013321399688720703
elapsed time: 0.013411521911621094
elapsed time: 0.013401508331298828
elapsed time: 0.013605833053588867
elapsed time: 0.013462543487548828
elapsed time: 0.013318061828613281
elapsed time: 0.013405323028564453
elapsed time: 0.013209819793701172
elapsed time: 0.013265848159790039
elapsed time: 0.01320028305053711
elapsed time: 0.013041496276855469
elapsed time: 0.013081550598144531
elapsed time: 0.013251304626464844
elapsed time: 0.0133819580078125
elapsed time: 0.013030290603637695
elapsed time: 0.013294696807861328
elapsed time: 0.013309478759765625
elapsed time: 0.013379335403442383
elapsed time: 0.01327824592590332
%% Cell type:code id:e6c22f5f tags: %% Cell type:code id:e6c22f5f tags:
``` python ``` python
from tutorials.utils.tutorial_utils import visualize_history from tutorials.utils.tutorial_utils import visualize_history
visualize_history(runner.simulation._history, runner.scenario, bokeh_port=5006) visualize_history(runner.simulation._history, runner.scenario, bokeh_port=5008)
``` ```
%% Output %% Output
INFO:bokeh.server.server:Starting Bokeh server version 2.4.3 (running on Tornado 6.2) INFO:bokeh.server.server:Starting Bokeh server version 2.4.3 (running on Tornado 6.3.3)
WARNING:bokeh.server.util:Host wildcard '*' will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly WARNING:bokeh.server.util:Host wildcard '*' will allow connections originating from multiple (or possibly all) hostnames or IPs. Use non-wildcard values to restrict access explicitly
INFO:bokeh.server.tornado:User authentication hooks NOT provided (default user enabled) INFO:bokeh.server.tornado:User authentication hooks NOT provided (default user enabled)
2023-12-04 23:37:42,023 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,738 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:42,024 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,739 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:42,026 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt'. Is this a 'parquet' file?: Could not open Parquet input source 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,740 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt'. Is this a 'parquet' file?: Could not open Parquet input source 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:42,027 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from '.ipynb_checkpoints/test_notebook-checkpoint.ipynb'. Is this a 'parquet' file?: Could not open Parquet input source '.ipynb_checkpoints/test_notebook-checkpoint.ipynb': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,740 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:42,028 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml'. Is this a 'parquet' file?: Could not open Parquet input source 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,740 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml'. Is this a 'parquet' file?: Could not open Parquet input source 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:42,028 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:51,742 INFO {/home/sacardoz/nuplan-devkit/nuplan/planning/nuboard/base/simulation_tile.py:172} Minimum frame time=0.017 s
2023-12-04 23:37:42,032 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/simulation_tile.py:172} Minimum frame time=0.017 s
Rendering a scenario: 100%|██████████| 1/1 [00:00<00:00, 157.64it/s] Rendering a scenario: 100%|██████████| 1/1 [00:00<00:00, 17.42it/s]
WARNING:bokeh.core.validation.check:W-1000 (MISSING_RENDERERS): Plot has no renderers: Figure(id='1005', ...) WARNING:bokeh.core.validation.check:W-1000 (MISSING_RENDERERS): Plot has no renderers: Figure(id='1005', ...)
INFO:tornado.access:200 GET /autoload.js?bokeh-autoload-element=1003&bokeh-absolute-url=http://localhost:5008&resources=none (::1) 1379.10ms
2023-12-04 23:37:44,012 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET / (10.40.117.44) 2030.70ms
2023-12-04 23:37:44,023 INFO {/home/ehdykhne/Repos/nuplan-devkit/tutorials/utils/tutorial_utils.py:267} Done rendering!
INFO:tornado.access:200 GET / (10.40.117.44) 2030.70ms
2023-12-04 23:37:44,370 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET /static/js/bokeh-gl.min.js?v=e5df31fd9010eacff0aa72d315264604b5e34972ba445acea6fce98080eecf33acf2d2986126360faaa5852813cffa16f6f6f4889923318300f062497c02da4e (10.40.117.44) 271.87ms
2023-12-04 23:37:44,398 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET /static/js/bokeh.min.js?v=3c61e952b808bb7e346ce828a565a5f23aaf7708d034fa9d0906403813355d45bb4e8d8b0b23a93f032c76831d4f0221846f28699c7f5147caa62e0d31668314 (10.40.117.44) 299.84ms
2023-12-04 23:37:44,400 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET /static/js/bokeh-widgets.min.js?v=8a1ff6f5aa0d967f4998d275803bbb111d928fd9f605ef9e1f30cfd021df0e77224ee3d13f83edb3a942f6e4ccc569ee5dd8951a8aa6cb600602463b90c65a87 (10.40.117.44) 301.22ms
2023-12-04 23:37:44,435 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET /static/js/bokeh-tables.min.js?v=ae2903e57cf57f52819fdf4d938c648982b51c34f73b6e653a0f3bb3c8ab44f338505931ace43eafc1636e215492e2314acf54c54baffb47813b86b4923a7fe0 (10.40.117.44) 37.66ms
INFO:tornado.access:200 GET /static/js/bokeh-gl.min.js?v=e5df31fd9010eacff0aa72d315264604b5e34972ba445acea6fce98080eecf33acf2d2986126360faaa5852813cffa16f6f6f4889923318300f062497c02da4e (10.40.117.44) 271.87ms
INFO:tornado.access:200 GET /static/js/bokeh.min.js?v=3c61e952b808bb7e346ce828a565a5f23aaf7708d034fa9d0906403813355d45bb4e8d8b0b23a93f032c76831d4f0221846f28699c7f5147caa62e0d31668314 (10.40.117.44) 299.84ms
INFO:tornado.access:200 GET /static/js/bokeh-widgets.min.js?v=8a1ff6f5aa0d967f4998d275803bbb111d928fd9f605ef9e1f30cfd021df0e77224ee3d13f83edb3a942f6e4ccc569ee5dd8951a8aa6cb600602463b90c65a87 (10.40.117.44) 301.22ms
INFO:tornado.access:200 GET /static/js/bokeh-tables.min.js?v=ae2903e57cf57f52819fdf4d938c648982b51c34f73b6e653a0f3bb3c8ab44f338505931ace43eafc1636e215492e2314acf54c54baffb47813b86b4923a7fe0 (10.40.117.44) 37.66ms
INFO:tornado.access:200 GET /static/js/bokeh-mathjax.min.js?v=176c36fdbcd8fc1019fc828101a2804081a35baf4018d7f2633cd263156b593aa73112f400112b662daa0590138b74851bc91f1f2a5fbf5416ee8c876c3e0d0c (10.40.117.44) 135.59ms
INFO:bokeh.server.views.ws:WebSocket connection opened INFO:bokeh.server.views.ws:WebSocket connection opened
INFO:tornado.access:101 GET /ws (10.40.117.44) 1.63ms INFO:tornado.access:101 GET /ws?id=5633698c-81fb-4686-8a38-bed76da7b3ba&origin=da2f890a-eb18-4637-9199-dd0f06169aef&swVersion=4&extensionId=&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=notebookRenderer (::1) 0.61ms
INFO:bokeh.server.views.ws:ServerConnection created INFO:bokeh.server.views.ws:ServerConnection created
2023-12-04 23:37:45,376 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET /static/js/bokeh-mathjax.min.js?v=176c36fdbcd8fc1019fc828101a2804081a35baf4018d7f2633cd263156b593aa73112f400112b662daa0590138b74851bc91f1f2a5fbf5416ee8c876c3e0d0c (10.40.117.44) 135.59ms 2023-12-05 02:24:53,085 INFO {/home/sacardoz/miniconda3/envs/nuplan/lib/python3.9/site-packages/tornado/web.py:2344} 200 GET /autoload.js?bokeh-autoload-element=1003&bokeh-absolute-url=http://localhost:5008&resources=none (::1) 1379.10ms
2023-12-04 23:37:45,551 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 101 GET /ws (10.40.117.44) 1.63ms 2023-12-05 02:24:53,096 INFO {/home/sacardoz/nuplan-devkit/tutorials/utils/tutorial_utils.py:267} Done rendering!
2023-12-04 23:37:45,664 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file. 2023-12-05 02:24:53,097 INFO {/home/sacardoz/miniconda3/envs/nuplan/lib/python3.9/site-packages/tornado/web.py:2344} 101 GET /ws?id=5633698c-81fb-4686-8a38-bed76da7b3ba&origin=da2f890a-eb18-4637-9199-dd0f06169aef&swVersion=4&extensionId=&platform=electron&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&parentOrigin=vscode-file%3A%2F%2Fvscode-app&purpose=notebookRenderer (::1) 0.61ms
2023-12-04 23:37:45,666 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:45,666 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt'. Is this a 'parquet' file?: Could not open Parquet input source 'pretrained_checkpoints/gc_pgp_checkpoint.ckpt': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:45,667 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from '.ipynb_checkpoints/test_notebook-checkpoint.ipynb'. Is this a 'parquet' file?: Could not open Parquet input source '.ipynb_checkpoints/test_notebook-checkpoint.ipynb': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:45,667 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Error creating dataset. Could not read schema from 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml'. Is this a 'parquet' file?: Could not open Parquet input source 'run_sim_closed_loop/training_raster_experiment/train_default_raster/2023.11.14.22.55.23/hparams.yaml': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:45,667 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/experiment_file_data.py:140} Could not open Parquet input source '<Buffer>': Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file.
2023-12-04 23:37:45,669 INFO {/home/ehdykhne/Repos/nuplan-devkit/nuplan/planning/nuboard/base/simulation_tile.py:172} Minimum frame time=0.017 s
Rendering a scenario: 100%|██████████| 1/1 [00:00<00:00, 10.45it/s]
WARNING:bokeh.core.validation.check:W-1000 (MISSING_RENDERERS): Plot has no renderers: Figure(id='3857', ...)
INFO:tornado.access:200 GET / (10.40.117.44) 805.62ms
2023-12-04 23:37:46,467 INFO {/opt/conda/lib/python3.9/site-packages/tornado/web.py:2271} 200 GET / (10.40.117.44) 805.62ms
2023-12-04 23:37:46,513 INFO {/home/ehdykhne/Repos/nuplan-devkit/tutorials/utils/tutorial_utils.py:267} Done rendering!
%% Cell type:code id:887a51e2 tags:
``` python
```
%% Cell type:code id:e0a12035 tags:
``` python
```
%% Cell type:code id:67b67b86 tags:
``` python
```
......
...@@ -13,6 +13,7 @@ defaults: ...@@ -13,6 +13,7 @@ defaults:
- open_loop_boxes_weighted_average - open_loop_boxes_weighted_average
- closed_loop_nonreactive_agents_weighted_average - closed_loop_nonreactive_agents_weighted_average
- closed_loop_reactive_agents_weighted_average - closed_loop_reactive_agents_weighted_average
- closed_loop_multiagent_weighted_average
- override hydra/job_logging: none # Disable hydra's logging - override hydra/job_logging: none # Disable hydra's logging
- override hydra/hydra_logging: none # Disable hydra's logging - override hydra/hydra_logging: none # Disable hydra's logging
......
closed_loop_reactive_agents_weighted_average:
_target_: nuplan.planning.metrics.aggregator.weighted_average_metric_aggregator.WeightedAverageMetricAggregator
name: 'closed_loop_multiagent_weighted_average'
metric_weights: # Below we list the metrics used in the scenario scoring function and their corresponsing weights to calculate a weighted average score for each scenario,
# if not specified, the weight is set as default.
# metric name : metric weight in the weighted average function
ego_progress_along_expert_route: 5.0 # This metric has the highest weight equal to 5.0 in the weighted average function, its base score can take a value in [0,1] depending on the ratio of ego to expert progress
time_to_collision_within_bound: 5.0 # This metric has the highest weight equal to 5.0 in the weighted average function, its base score can be 0 or 1 depending on the minimum time to collision threshold
speed_limit_compliance: 4.0 # This metric has a weight equal to 4.0 in the weighted average function, its base score can take a value in [0,1] depending on the amount and duration of over-speeding
ego_is_comfortable: 2.0 # This metric has the lowest weight equal to 2.0 in the weighted average function, its base score can be 0 or 1 depending on the comfort thresholds on acceleration, jerk and yaw.
default: 1.0
file_name: closed_loop_multiagent_weighted_average_metrics_${now:${date_format}}
# The scenario score is defined as the weighted average score of the metrics listed above, multiplied by the score of the multiple_metrics below.
multiple_metrics:
- no_ego_at_fault_collisions # This metric score can be 0, 0.5 or 1 depending on whether there is an at fault collision with VRUs, vehicles or objects
- drivable_area_compliance # This metric score can be 0 or 1 depending on whether ego drives outside the drivable area
- ego_is_making_progress # This metric score can be 0 or 1 depending on whether ego makes progress more than a minimum threshold compared to expert's progress
- driving_direction_compliance # This metric score can be 0 or 0.5 or 1 depending on how much ego drives in the opposite direction if any
challenge_name: closed_loop_multiagent
_target_: nuplan.planning.simulation.observation.ml_planner_agents.MLPlannerAgents
_convert_: 'all'
model_config: ??? # Dictionary key from existing planner model config (e.g. reactive_agents_model)
checkpoint_path: ??? # Path to trained model checkpoint
# @package _global_
job_name: closed_loop_multiagent
defaults:
- override /observation: ml_planner_agents_observation
- override /ego_controller: two_stage_controller
- override /planner: ml_planner
- override /simulation_metric: simulation_closed_loop_reactive_agents
- override /metric_aggregator:
- closed_loop_multiagent_weighted_average
from collections import deque
from copy import deepcopy
from typing import Dict, List, Type
from nuplan.common.actor_state.agent import Agent
from nuplan.common.actor_state.ego_state import EgoState
from nuplan.common.actor_state.scene_object import SceneObjectMetadata
from nuplan.common.actor_state.state_representation import StateSE2, StateVector2D, TimePoint
from nuplan.common.actor_state.tracked_objects import TrackedObject, TrackedObjects
from nuplan.common.actor_state.tracked_objects_types import TrackedObjectType
from nuplan.common.actor_state.vehicle_parameters import VehicleParameters
from nuplan.planning.scenario_builder.abstract_scenario import AbstractScenario
from nuplan.planning.simulation.history.simulation_history_buffer import SimulationHistoryBuffer
from nuplan.planning.simulation.observation.abstract_observation import AbstractObservation
from nuplan.planning.simulation.observation.observation_type import Observation
from nuplan.planning.simulation.observation.observation_type import DetectionsTracks
from nuplan.planning.simulation.planner.abstract_planner import PlannerInitialization, PlannerInput
from nuplan.planning.simulation.planner.ml_planner.ml_planner import MLPlanner
from nuplan.planning.simulation.simulation_time_controller.simulation_iteration import SimulationIteration
from nuplan.planning.training.modeling.torch_module_wrapper import TorchModuleWrapper
OPEN_LOOP_DETECTION_TYPES = [TrackedObjectType.PEDESTRIAN, TrackedObjectType.BICYCLE, \
TrackedObjectType.CZONE_SIGN, TrackedObjectType.BARRIER, \
TrackedObjectType.TRAFFIC_CONE, TrackedObjectType.GENERIC_OBJECT]
class MLPlannerAgents(AbstractObservation):
"""
Simulate agents based on an ML model.
"""
def __init__(self, model: TorchModuleWrapper, scenario: AbstractScenario) -> None:
"""
Initializes the MLPlannerAgents class.
:param model: Model to use for inference.
:param scenario: scenario
"""
self.current_iteration = 0
self.model = model
self._scenario = scenario
self._ego_state_history: Dict = {}
self._agent_prescence_threshold = 10
self._agents: Dict = None
def reset(self) -> None:
"""Inherited, see superclass."""
self.current_iteration = 0
self._agents = None
def _get_agents(self):
"""
Gets dict of tracked agents, or lazily creates them it
from vehicles at simulation start if it does not exist.
"""
if not self._agents:
self._agents = {}
for agent in self._scenario.initial_tracked_objects.tracked_objects.get_tracked_objects_of_type(TrackedObjectType.VEHICLE):
# TODO: Support ego controllers - right now just doing perfect tracking.
# Revist whether there is a better way of translating agent states to ego states.
# Revist whether there is a better way of setting agent goals.
# Filter out impossible/off-road initial detections.
# Sets agent goal to be it's last known point in the simulation. This results in some strange driving behaviour
# if the agent disappears early in a scene.
goal = None
for frame in range(self._scenario.get_number_of_iterations()-1, self._agent_prescence_threshold, -1):
last_scenario_frame = self._scenario.get_tracked_objects_at_iteration(frame)
matched_track = None
for track in last_scenario_frame.tracked_objects.tracked_objects:
if track.metadata.track_token == agent.metadata.track_token:
matched_track = track
break
if matched_track:
goal = matched_track.center
break
if goal:
# Estimates ego states from agent state at simulation starts, stores metadata and creates planner for each agent
self._agents[agent.metadata.track_token] = {'ego_state': self._build_ego_state_from_agent(agent, self._scenario.start_time), \
'metadata': agent.metadata,
'planner': MLPlanner(self.model)}
# Initialize planner.
planner_init = PlannerInitialization(
route_roadblock_ids=self._scenario.get_route_roadblock_ids(),
mission_goal=goal,
map_api=self._scenario.map_api,
)
self._agents[agent.metadata.track_token]['planner'].initialize(planner_init)
return self._agents
def observation_type(self) -> Type[Observation]:
"""Inherited, see superclass."""
return DetectionsTracks # type: ignore
def initialize(self) -> None:
"""Inherited, see superclass."""
pass
def get_observation(self) -> DetectionsTracks:
"""Inherited, see superclass."""
agents = [self._build_agent_from_ego_state(v['ego_state'], v['metadata']) for v in self._get_agents().values()]
open_loop_detections = self._get_open_loop_track_objects(self.current_iteration)
open_loop_detections.extend(agents)
return DetectionsTracks(tracked_objects=TrackedObjects(open_loop_detections))
def update_observation(
self, iteration: SimulationIteration, next_iteration: SimulationIteration, history: SimulationHistoryBuffer
) -> None:
"""Inherited, see superclass."""
self.current_iteration = next_iteration.index
self.propagate_agents(iteration, next_iteration, history)
def _get_open_loop_track_objects(self, iteration: int) -> List[TrackedObject]:
"""
Get open-loop tracked objects from scenario.
:param iteration: The simulation iteration.
:return: A list of TrackedObjects.
"""
detections = self._scenario.get_tracked_objects_at_iteration(iteration)
return detections.tracked_objects.get_tracked_objects_of_types(OPEN_LOOP_DETECTION_TYPES)
def propagate_agents(self, iteration: SimulationIteration, next_iteration: SimulationIteration, history: SimulationHistoryBuffer):
"""
Propagates agents into next timestep by constructing input for each agent planner, then interpolating new agent
states from the predicted trajectory for each from their respective planners. Caches computed agent states.
"""
traffic_light_data = list(self._scenario.get_traffic_light_status_at_iteration(iteration.index))
# TODO: Find way to parallelize.
# TODO: Propagate non-ego and lower frequency to improve performance.
for agent_token, agent_data in self._agents.items():
history_input = self._build_history_input(agent_token, agent_data['ego_state'], history)
planner_input = PlannerInput(iteration=iteration, history=history_input, traffic_light_data=traffic_light_data)
trajectory = agent_data['planner'].compute_trajectory(planner_input)
agent_data['ego_state'] = trajectory.get_state_at_time(next_iteration.time_point)
self._ego_state_history[agent_token][next_iteration.time_point] = agent_data['ego_state']
def _build_ego_state_from_agent(self, agent: Agent, time_point: TimePoint) -> EgoState:
"""
Builds ego state from corresponding agent state. Since this process is imperfect, it uses cached ego states from the propagation
so casting is only required for the beginning agent states for which we have no propagation information.
"""
if agent.metadata.track_token in self._ego_state_history:
if time_point in self._ego_state_history[agent.metadata.track_token]:
return self._ego_state_history[agent.metadata.track_token][time_point]
else:
self._ego_state_history[agent.metadata.track_token] = {}
# Most of this is just eyeballed, so there may be a more principled way of setting these values.
output = EgoState.build_from_center(
center=agent.center,
center_velocity_2d=agent.velocity,
center_acceleration_2d=StateVector2D(0, 0),
tire_steering_angle=0,
time_point=time_point,
vehicle_parameters=VehicleParameters(
vehicle_name=agent.track_token,
vehicle_type="gen1",
width=agent.box.width,
front_length=agent.box.length * 4 / 5,
rear_length=agent.box.length * 1 / 5,
wheel_base=agent.box.length * 3 / 5,
cog_position_from_rear_axle=agent.box.length * 1.5 / 5,
height=agent.box.height,
),
)
self._ego_state_history[agent.metadata.track_token][time_point] = output
return output
def _build_agent_from_ego_state(self, ego_state: EgoState, scene_object_metadata: SceneObjectMetadata) -> Agent:
"""
Builds agent state from corresponding ego state. Unlike the inverse this process is well-defined.
"""
agent_state = Agent(
metadata=scene_object_metadata,
tracked_object_type=TrackedObjectType.VEHICLE,
oriented_box=ego_state.car_footprint.oriented_box,
velocity=ego_state.dynamic_car_state.center_velocity_2d,
)
return agent_state
def _build_history_input(self, agent_track_token: str, current_state: EgoState, history: SimulationHistoryBuffer) -> SimulationHistoryBuffer:
"""
Builds the planner history input for a given agent. This requires us the interchange the ego states of the actual ego with the
constructed ego states of the agent of interest, and create observations corresponding to the ego in the observation history buffer.
"""
ego_state_buffer = history.ego_state_buffer
observation_buffer = history.observation_buffer
new_observations = []
faux_ego_obervations = []
# Construct a timestep/track_token to observation loopup table for faster proessing
track_token_agent_dict = {}
for t, observation in enumerate(observation_buffer):
track_token_agent_dict[t] = {}
for agent in observation.tracked_objects.tracked_objects:
track_token_agent_dict[t][agent.metadata.track_token] = agent
# Loop through history buffer
for t, (ego_state, observation) in enumerate(zip(ego_state_buffer, observation_buffer)):
# Convert actual ego state into agent object
ego_agent_object = self._build_agent_from_ego_state(ego_state, \
SceneObjectMetadata(token='ego', track_token="ego", track_id=-1, \
timestamp_us=ego_state.time_us))
# Get agent object corresponding to agent from observation buffer. If one does not exist for current timestep, take from the future,
# if one does not exist from the future, take the current state. This might occur at the first timestep for observations that have no
# logged history prior to simulation start, or observations inserted mid-simulation.
matched_agent = None
for i in range(t, len(observation_buffer)):
if i in track_token_agent_dict and agent_track_token in track_token_agent_dict[i]:
matched_agent = track_token_agent_dict[i][agent_track_token]
break
# Convert agent state to a corresponding "ego state" object, or pull it from cache if already computed.
if matched_agent is None:
faux_ego_observation = deepcopy(current_state)
faux_ego_observation._time_point = ego_state.time_point
else:
faux_ego_observation = self._build_ego_state_from_agent(matched_agent, ego_state.time_point)
# Rebuild timestep and buffer - creating a new observations object with old ego appended.
tracks = [ag for ag in observation.tracked_objects.tracked_objects if ag.metadata.track_token != agent_track_token]
tracks.append(ego_agent_object)
new_observations.append(DetectionsTracks(tracked_objects=TrackedObjects(tracks)))
faux_ego_obervations.append(faux_ego_observation)
output_buffer = SimulationHistoryBuffer(deque(faux_ego_obervations), \
deque(new_observations), \
history.sample_interval)
return output_buffer
def add_agent_to_scene(self, agent: Agent, goal: StateSE2, timepoint_record: TimePoint):
"""
Adds agent to the scene with a given goal during the simulation runtime.
"""
# TODO: Inject IDM agents (and non-ML agents more broadly)
self._agents[agent.metadata.track_token] = {'ego_state': self._build_ego_state_from_agent(agent, timepoint_record), \
'metadata': agent.metadata,
'planner': MLPlanner(self.model)}
planner_init = PlannerInitialization(
route_roadblock_ids=self._scenario.get_route_roadblock_ids(),
mission_goal=goal,
map_api=self._scenario.map_api,
)
self._agents[agent.metadata.track_token]['planner'].initialize(planner_init)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment