run-scenario
できること
このスキルは、CARLAシミュレーターで用意された運転テストシナリオを1つ開始します。お使いのバージョンのCARLAが実行できるものを一覧にすることもできます。自動運転のソフトウェアが特定の状況をどう扱うかをテストしたい人向けです。
使う場面
- ✓先行車についていくような標準テストを実行したいとき。
- ✓選ぶ前に、インストールされたバージョンでサポートされるシナリオを確認したいとき。
- ✓テストに主要な車の制御を任せ、または自分のプログラムに運転させたいとき。
スキルのリンク
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-scenario/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“CARLAでFollowLeadingVehicleのテストを実行し、私の車が合格したかどうかを見せてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは設定名でシナリオを選び、地図が一致しているかを確認してから、実行を開始します。必要なら地図を再読み込みし、テストが終わると結果を報告します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Run a scenario
Paths.
scripts/…andreferences/…below are relative to the directory holding this SKILL.md. Your working directory is the user's project, not that directory, so prefix them with its absolute path or the command is not found.
A "scenario" here is a Python class in srunner/scenarios/ plus an XML config in
srunner/examples/ that gives it a town, an ego spawn point and parameters. You
select it by the config name (FollowLeadingVehicle_1), not the class name.
Two things decide whether a run works, and both are silent when wrong:
- the branch — which scenarios and which towns exist at all,
- the map — a scenario declares its town, and ScenarioRunner refuses to run if the server is on a different one unless you let it reload.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: List what this checkout can run
- [ ] Step 3: Run it, with --reloadWorld unless the map already matches
- [ ] Step 4: Give the ego a driver (manual_control or an agent) if it needs one
- [ ] Step 5: Read the result; reset the world to async when done
Step 1-2: What can I run
source scripts/env.sh
bash scripts/check_env.sh
python3 scripts/list_scenarios.py # every config, its type and town
python3 scripts/list_scenarios.py --town Town04_Opt # only what fits the loaded map
python3 scripts/list_scenarios.py --check # configs whose type or town does not resolve
python3 scripts/list_scenarios.py --here # only what fits the *running* server's map
python3 scripts/list_scenarios.py --types # class -> configs, incl. route-only classes
list_scenarios.py parses the XML directly, so it works with no server and no
carla import — unlike scenario_runner.py --list, which constructs a client
first.
Step 3: Run
source scripts/env.sh
# the canonical smoke test
bash scripts/run_scenario.sh FollowLeadingVehicle_1
# every config of one class, in sequence
bash scripts/run_scenario.sh group:FollowLeadingVehicle
# deterministic: 20 Hz synchronous, results printed and written as JSON
SYNC=1 FRAME_RATE=20 OUTPUT=1 JSON=1 OUTPUT_DIR=./results \
bash scripts/run_scenario.sh ControlLoss_1
# repeat with randomised parameters, and record for later analysis
REPETITIONS=3 RANDOMIZE=1 RECORD=recordings bash scripts/run_scenario.sh DynamicObjectCrossing_1
Or call ScenarioRunner directly — the wrapper only adds the env, the map check and the async reset:
python3 "$SCENARIO_RUNNER_ROOT/scenario_runner.py" --scenario FollowLeadingVehicle_1 --reloadWorld
Knobs (all env vars on run_scenario.sh):
| Var | Effect |
|---|---|
RELOAD=0 |
do not reload the world (default reloads; needed when the map differs) |
SYNC=1 |
synchronous mode at FRAME_RATE Hz — required for reproducibility |
FRAME_RATE |
sync tick rate, default 20 |
OUTPUT=1 / FILE=1 / JSON=1 / JUNIT=1 |
result to stdout / .txt / .json / .xml |
OUTPUT_DIR |
where those files land |
REPETITIONS / RANDOMIZE=1 |
repeat count / randomise scenario parameters |
AGENT / AGENT_CONFIG |
drive the ego with an agent (route mode only — see below) |
RECORD=dir |
CARLA recorder log + a criteria JSON, relative to $SCENARIO_RUNNER_ROOT |
WAIT_FOR_EGO=1 |
attach to an ego someone else spawned instead of spawning one |
DEBUG=1 |
print the behaviour tree every tick |
TIMEOUT |
client timeout, default 120 s — an editor map switch needs it |
MAX_WALL |
wall-clock guard, default 1800 s; 0 disables. ScenarioRunner can print its verdict and never exit |
Step 4: Somebody has to drive
Most scenarios spawn the ego and then wait for it to move. Nothing drives it by itself. If you see
Preparing scenario: FollowLeadingVehicle_1
ScenarioManager: Running scenario FollowVehicle
No more scenarios .... Exiting
with nothing happening, that is the symptom. Options:
# keyboard control, in a second terminal
python3 "$SCENARIO_RUNNER_ROOT/manual_control.py"
# or hand the ego to the autopilot instead of driving it
python3 "$SCENARIO_RUNNER_ROOT/manual_control.py" -a
manual_control.py attaches to the vehicle whose role_name equals --rolename,
default hero, which is the ego role ScenarioRunner uses, so no flag is needed to
find the ego. -a/--autopilot only switches on the autopilot. It needs
pygame, which `requirement
よくある質問
シナリオが開始しないことがあるのはなぜですか?
通常は、シミュレーターがシナリオの必要とする地図と違う地図になっているか、そのシナリオがこのバージョンのソフトウェアにないためです。
実行を記録できますか?
はい。実行を保存しておけば、後で再生できます。
主要な車にドライバーが必要ですか?
一部のシナリオでは必要なので、手動制御か自動のエージェントを選べます。
詳細
作者による元の説明
Runs a single ScenarioRunner Python scenario (or a whole group) against a running CARLA server — FollowLeadingVehicle, ControlLoss, DynamicObjectCrossing, SignalizedJunctionLeftTurn and the rest of srunner/examples — in sync or async mode, with result output, recording and manual/agent control of the ego. Lists what is runnable on the checked-out branch and on the loaded map. Use when the user asks to "run a scenario", "test FollowLeadingVehicle", "list scenarios", "run a CARLA traffic scenario", or reports a scenario that is "not supported".
repo: carla-simulator/carla
人気
- GitHubのスター
- 15k
- ランキング
- #11112
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
create-leaderboard-route
15kエージェントが、シミュレーターのカメラでウェイポイントとシナリオのトリガーを配置し、CARLA Leaderboardのルートファイルを作成・確認できるよう支援します。
package-leaderboard-agent
15kエージェントが、ドライビングエージェントをCARLA Leaderboardへの提出用のDockerイメージにまとめられるよう支援します。フォルダ構成の確認と読み込みテストを行います。
read-leaderboard-results
15kエージェントが、CARLA Leaderboardの結果ファイルを読み、各ルートの得点と違反を説明し、別のルールのバージョンで実行結果を再採点できるよう支援します。
run-leaderboard-evaluation
15kエージェントが、ドライビングエージェントを使って一連のルートでCARLA Leaderboardの評価ツールを実行できるよう支援します。実行前に設定を確認し、再開可能なチェックポイントを保存します。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。