This guide covers how to use SimEngine for closed-loop simulation, rollout generation, and model testing. SimEngine provides photorealistic simulation environments powered by 3D Gaussian Splatting.
- Quick Reference
- Running Simulations
- Rollout Scripts
- Testing Scripts
- Configuration
- Output Format
- Troubleshooting
cd projects/SimEngine
# Single-GPU testing
bash scripts/run_testing.sh <config> <checkpoint> <model_name> <data_type> <react_type> [<asset_name>]
# Multi-GPU distributed testing (8 GPUs)
bash scripts/run_ray_distributed_testing.sh <config> <checkpoint> <model_name> <data_type> <react_type> [<asset_name>]
# Multi-GPU distributed rollout (data generation)
bash scripts/run_ray_distributed_rollout.sh <config> <checkpoint> <model_name> <data_type> [<asset_name>]Run a basic simulation with default settings:
conda activate simengine
cd projects/SimEngine
python worldengine/runner/run_simulation.py \
data_pkl_file_name=your_scenario.pklParameters:
data_pkl_file_name: Scene pickle file indata/sim_engine/scenarios/
python worldengine/runner/run_simulation.py \
data_pkl_file_name=your_scenario.pkl \
num_scenarios=50 Rollout scripts run closed-loop simulation with an E2E planning model and reward computation. Useful for:
- Generating training data for RL-based fine-tuning (with reward)
- Rollout data augmentation/synthesis
For large-scale data generation:
export WORLDENGINE_ROOT=/path/to/WorldEngine
# The exporter expects these parent directories to exist.
mkdir -p "$WORLDENGINE_ROOT/data/alg_engine/openscene-synthetic/"{meta_datas,pdms_pkl,sensor_blobs}
bash "$WORLDENGINE_ROOT/projects/SimEngine/scripts/run_ray_distributed_rollout.sh" \
"$WORLDENGINE_ROOT/projects/AlgEngine/configs/worldengine/e2e_vadv2_50pct.py" \
"$WORLDENGINE_ROOT/data/alg_engine/ckpts/e2e_vadv2_50pct_ep8.pth" \
e2e_vadv2_50pct \
navtrain_50pct_collision \
navtrainArguments:
<config>: Model configuration file<checkpoint>: Trained model checkpoint<model_name>: Experiment name (creates output folder)<data_type>: Scenario directory name (e.g.,navtrain_50pct_collision). The launcher readsdata/sim_engine/scenarios/original/<data_type>/all_scenarios.pklby default. For BWM inputs, see Rollouts from BWM Scenarios.<asset_name>(optional): Asset folder name underdata/sim_engine/assets/. Defaults to<data_type>if not provided
Features:
- Distributes scenarios across 8 GPUs (8 splits)
- Each GPU processes 1/8 of scenarios in parallel
- Automatically merges results and exports an AlgEngine dataset at the end
- Resumes from previous runs (
ENABLE_RESUME=true)
The output directory is
$WORLDENGINE_ROOT/experiments/closed_loop_exps/<model_name>/<data_type>_NR/.
asset_name selects the rendering assets; it does not change the output name.
After a successful run, continue with
Verify the Exported Rollout Dataset
and configure fine-tuning. Manual merge and export commands below are for
processing existing results separately. Resume skips completed simulation
scenarios, but export is not idempotent: an existing export with the same
dataset name causes FileExistsError.
First generate and publish BWM scenarios.
For a job named my_scenario, the input is
data/sim_engine/scenarios/augmented/my_scenario/all_scenarios.pkl.
The current rollout launcher selects original or augmented through its
DATAFILE_FOLDER_PATH assignment, rather than a command-line argument.
Before launching a BWM run, edit that assignment in
projects/SimEngine/scripts/run_ray_distributed_rollout.sh to:
DATAFILE_FOLDER_PATH="data/sim_engine/scenarios/augmented/${DATA_TYPE}"Then run the published scenario set with the original base scene assets:
export WORLDENGINE_ROOT=/path/to/WorldEngine
mkdir -p "$WORLDENGINE_ROOT/data/alg_engine/openscene-synthetic/"{meta_datas,pdms_pkl,sensor_blobs}
bash "$WORLDENGINE_ROOT/projects/SimEngine/scripts/run_ray_distributed_rollout.sh" \
"$WORLDENGINE_ROOT/projects/AlgEngine/configs/worldengine/e2e_vadv2_50pct.py" \
"$WORLDENGINE_ROOT/data/alg_engine/ckpts/e2e_vadv2_50pct_ep8.pth" \
e2e_vadv2_50pct \
my_scenario \
navtrainHere my_scenario is the BWM scenario_name, and navtrain selects the
base assets under data/sim_engine/assets/navtrain/assets. Adjust the
asset name to match the corpus used during BWM generation.
Rollout uses NR mode: other agents follow the trajectories stored in the input scenario, including BWM-generated trajectories, while AlgEngine controls ego in closed loop. The launcher computes dense rewards and automatically merges and exports results:
- Rollout directory:
$WORLDENGINE_ROOT/experiments/closed_loop_exps/e2e_vadv2_50pct/my_scenario_NR/ - Exported dataset name:
e2e_vadv2_50pct_my_scenario_NR_<YYMMDD>
Use that exported name in the BWM rollout fine-tuning config, following
AlgEngine Fine-Tuning Configuration.
Restore the launcher's original/${DATA_TYPE} input path before using it
for original scenarios again.
Edit the rollout script to change GPU count:
# In run_ray_distributed_rollout.sh, line ~140
# Change from:
for i in {0..7}; do # 8 GPUs
run_planner $i &
done
# To (for 4 GPUs):
for i in {0..3}; do # 4 GPUs
run_planner $i &
doneTesting scripts run closed-loop evaluation with a planning model. Used for:
- Model performance evaluation
- Rare case testing
For quick tests or debugging:
export WORLDENGINE_ROOT=/path/to/WorldEngine
cd projects/SimEngine
bash scripts/run_testing.sh \
$WORLDENGINE_ROOT/projects/AlgEngine/configs/worldengine/e2e_vadv2_50pct.py \
$WORLDENGINE_ROOT/data/alg_engine/ckpts/e2e_vadv2_50pct_ep8.pth \
e2e_vadv2_50pct \
navtest_failures \
NRArguments:
<config>: Model configuration file<checkpoint>: Trained model checkpoint<model_name>: Experiment name (creates output folder)<data_type>: Scenario split (e.g.,navtest_failures,navtest)<react_type>: Reactive mode (NRorR)NR(Non-Reactive): Other agents replay logged trajectoriesR(Reactive): Other agents use IDM policy to react
<asset_name>(optional): Asset folder name underdata/sim_engine/assets/. Defaults to<data_type>if not provided
Output:
experiments/closed_loop_exps/e2e_vadv2_50pct/navtest_failures_NR/
├── WE_output/
│ └── openscene_format/
│ └── all_scenes_pdm_averages_NR.csv # Main metrics CSV
├── plan_traj/ # Model-predicted trajectories (.npy)
├── frames/ # Communication files (deleted after run)
└── merged_ann_files/ # Merged annotations (.pkl)
For faster evaluation on large test sets:
export WORLDENGINE_ROOT=/path/to/WorldEngine
cd projects/SimEngine
bash scripts/run_ray_distributed_testing.sh \
$WORLDENGINE_ROOT/projects/AlgEngine/configs/worldengine/e2e_vadv2_50pct.py \
$WORLDENGINE_ROOT/data/alg_engine/ckpts/e2e_vadv2_50pct_ep8.pth \
e2e_vadv2_50pct \
navtest_failures \
NRHow it works:
- Launches SimEngine ray distributed server (handles scenario distribution)
- Spawns 8 AlgEngine clients (one per GPU)
- Each client processes 1/8 of scenarios in parallel
- Auto-merges results after completion
# Test on all navtest scenarios (not just failures)
bash scripts/run_ray_distributed_testing.sh \
... \
navtest \ # Changed from navtest_failures
NR
# Test on training set
bash scripts/run_ray_distributed_testing.sh \
... \
navtrain \
NR# Non-reactive (default): Other agents replay logged paths
bash scripts/run_ray_distributed_testing.sh \
... \
NR
# Reactive: Other agents use IDM to react to ego
bash scripts/run_ray_distributed_testing.sh \
... \
R # Changed to RReactive mode impact:
- More challenging (agents respond to ego's mistakes)
- Lower scores expected
- Tests robustness to unexpected agent behaviors
SimEngine uses Hydra for configuration management.
Default config: projects/SimEngine/worldengine/configs/default_runner.yaml
Override with:
python worldengine/runner/run_simulation.py \
--config-name custom_config.yamlexperiments/closed_loop_exps/<model_name>/<data_type>_<react_type>/
├── split_0/ ... split_7/
├── plan_traj/
└── WE_output/
└── openscene_format/
├── meta_datas/
├── pdms_pkl/
├── sensor_blobs/
└── all_scenes_pdm_averages_NR.csv
WE_output/openscene_format/
├── sensor_blobs/
│ ├── CAM_F0/ # Front camera
│ ├── CAM_L0/ # Left camera
│ ├── CAM_R0/ # Right camera
│ └── LIDAR_TOP/ # LiDAR point clouds
├── meta_datas/
│ └── {scenario_token}.pkl # Per-scenario metadata
└── all_scenes_pdm_averages_NR.csv
Convert nuPlan dataset to SimEngine scenario format with navsim filter-based scene selection.
Example:
conda activate simengine
python projects/SimEngine/worldengine/utils/dataset_utils/nuplan/digitaltwin_nuplan_converter_navsim_filter.py \
--navsim-filters $ALGENGINE_ROOT/configs/navsim_splits/navtrain_split/e2e_vadv2_50pct_rare/navtrain_50pct_collision.yaml \
$ALGENGINE_ROOT/configs/navsim_splits/navtrain_split/e2e_vadv2_50pct_rare/navtrain_50pct_ep_1pct.yaml \
$ALGENGINE_ROOT/configs/navsim_splits/navtrain_split/e2e_vadv2_50pct_rare/navtrain_50pct_off_road.yaml \
--out-dir data/sim_engine/scenarios/original/navtrain_vadv2_50pct_rare \
--num-processes 8Key Parameters:
--navsim-filters: Path(s) to navsim config file(s) for scenario filtering (supports multiple files)--digitaltwin-asset-root: Digital Twin asset root directory (default:data/sim_engine/assets/navtrain)--nuplan-root-path: nuPlan dataset root directory--nuplan-db-path: nuPlan database file directory--openscene-dataroot: OpenScene data root directory--out-dir: Output directory for converted scenario files--sample-interval: Keyframe sampling interval (default: 10)--num-processes: Number of parallel processes
Output:
{out-dir}/all_scenarios.pkl- Converted WorldEngine scenario file
The script extracts from Digital Twin config and nuPlan raw data:
- Ego and agent vehicle trajectories
- Camera and LiDAR calibration parameters
- Traffic light states
- Map features (lanes, intersections, etc.)
Converted scenarios can be directly used for SimEngine simulation.
The distributed rollout and testing launchers already merge results. Use this command only when merging existing split outputs separately. The example follows the scenario set used in AlgEngine Fine-Tuning.
conda activate simengine
ROLLOUT_PATH="$WORLDENGINE_ROOT/experiments/closed_loop_exps/e2e_vadv2_50pct/navtrain_vadv2_50pct_rare_NR"
python "$WORLDENGINE_ROOT/projects/SimEngine/scripts/merge_simulation_results.py" \
--test_path "$ROLLOUT_PATH" \
--react_type NRThe rollout launcher automatically exports after merging, with a YYMMDD
suffix from the system date at export time. After a successful automatic
export, proceed directly to
dataset verification.
For an existing merged rollout that has not been exported, use this manual
command. Choose an unused suffix; manual_v1 is an example:
conda activate simengine
ROLLOUT_PATH="$WORLDENGINE_ROOT/experiments/closed_loop_exps/e2e_vadv2_50pct/navtrain_vadv2_50pct_rare_NR"
mkdir -p "$WORLDENGINE_ROOT/data/alg_engine/openscene-synthetic/"{meta_datas,pdms_pkl,sensor_blobs}
python "$WORLDENGINE_ROOT/projects/SimEngine/scripts/export_simulation_data.py" \
--test_path "$ROLLOUT_PATH" \
--appendix manual_v1Pass an absolute --test_path without a trailing slash. The exporter uses
the path directly and derives the model and run names from its last two
components.
The example creates dataset
e2e_vadv2_50pct_navtrain_vadv2_50pct_rare_NR_manual_v1 under each of
data/alg_engine/openscene-synthetic/{meta_datas,sensor_blobs,pdms_pkl}.
Omitting --appendix omits the suffix; the exporter does not add a date
itself. Existing symlink destinations are not overwritten. A new suffix
creates another name for the same source rollout, not a new simulation.
Error: ray.exceptions.RaySystemError: System error: Failed to start Ray
Solution:
# Kill existing Ray processes
ray stop
# Check port availability
netstat -tulpn | grep 6379
# Restart simulation
bash scripts/run_ray_distributed_testing.sh ...Error: CUDA out of memory
Solution:
# Reduce GPU allocation (fewer scenarios per GPU)
# Edit the script and change:
number_of_gpus_allocated_per_simulation=1.0 # From 0.5
# Or reduce batch size in model configError: FileNotFoundError: all_scenarios.pkl
Solution:
# Check scenario data path
ls -lh data/sim_engine/scenarios/original/navtest_failures/
# Verify pickle file exists
file data/sim_engine/scenarios/original/navtest_failures/all_scenarios.pklSymptoms: Process runs but no progress
Solution:
# Check if AlgEngine client is connected
tail -f experiments/closed_loop_exps/*/WE_output/*.log
# Check for stuck frames
ls -lt experiments/closed_loop_exps/*/frames/ | head -20
# Kill and restart with debug mode
debug_mode=true num_scenarios=1Error: Scenarios restart from beginning
Solution:
# Ensure resume flag is set
enable_resume=true
# Check completed scenarios file
cat experiments/closed_loop_exps/*/completed_scenarios/completed_scenarios.txt
# Verify scenario IDs match- GPU Allocation: Use
0.5for most scenarios (2 workers per GPU) - Resume Mode: Always enable
enable_resume=truefor long runs - Distributed Mode: Both testing and rollout use
SCENARIO_BASEDmode by default - Cleanup: Set
sim.clean_temp_files=Trueto save disk space - Ray Resources: Limit Ray memory with
RAY_memory_limit=30GBif needed
- Train models: See AlgEngine Usage Guide
- Understand data: See Data Organization
For questions, visit GitHub Discussions.