spawn-vehicles
できること
このスキルは、実行中のCARLAの道路シミュレーションに車を追加し、終わったら取り除きます。自動運転のソフトウェアを作ったりテストしたりする人で、道路に交通が必要な人向けです。
使う場面
- ✓自律的に走る車で、にぎやかな道路を作りたいとき。
- ✓自分のソフトウェアが制御するテスト用の車を1台置く必要があるとき。
- ✓追加した車を取り除き、シミュレーションを空の状態に戻したいとき。
スキルのリンク
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/spawn-vehicles/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“CARLAの道路シミュレーションに自動運転の車を40台追加し、終わったら取り除いてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、地図のスポーン地点に車を配置し、各車を交通システムに渡します。交通システムが道路に沿って車を走らせます。車を取り除くと、それらの車がシミュレーションから削除されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Spawn autopilot vehicles
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.
Populate the roads with self-driving traffic. Vehicles are placed at the map's
predefined spawn points and, by default, handed to the Traffic Manager
autopilot at spawn time so they drive the road network autonomously. destroy
removes them.
spawn and line make the world synchronous. The Traffic Manager is not
reliable driving an asynchronous server: it runs its own loop against a server
advancing at whatever rate it likes. Measured on 0.10.0, async, 50 autopilot
vehicles with the spawning client alive and holding the TM: only 24 were
moving, and the actor count decayed on its own — 50 vehicles down to 39 and 15
walkers down to 5 over a couple of minutes. With a fixed timestep and the TM in
sync, 37 of 50 move and nothing decays. --no-sync keeps the old behaviour.
The TM cannot be driven by another client's tick
The Traffic Manager steps only when the process that created it ticks the world. Measured on 0.10.0: with a camera client owning a 20 Hz clock and this skill attached as an observer, its 40 vehicles never moved at all — no error, just a frozen scene. So a held traffic pool and a lock-step frame capture cannot share a world; record the traffic here and replay it into the capture instead ([[read-sensor]] has the recipe).
The clock rule
The world settings are read before anything else happens:
- asynchronous — this client switches it to synchronous (
--delta, default 0.05 s = 20 Hz), puts the TM in sync, and becomes the ticker. - already synchronous — another client owns the clock. This one never calls
tick(); it observes withwait_for_tick(). Ticking a world you do not own silently drops commands — it is what stoppedspawn-walkers'start()from landing.
The previous settings are restored on release, because a synchronous world with
nothing ticking does not advance and looks exactly like a hung server. Stop a
holder with Ctrl+C, never kill -9: the restore is in a finally.
The Traffic Manager lives in the client process that created it. So a
spawn that exits leaves the vehicles registered with a dead TM: they sit at
throttle 0.00 for ever, in async and sync. Pass --hold to keep the TM
open (Ctrl+C releases it, and the vehicles then coast to a stop). Measured on
0.10.0: without --hold, 0/50 vehicles move; with it, 49/50 move.
The same is true of controller.ai.walker in [[spawn-walkers]] — its
controllers stop when their client exits — so a scene with both wants two
resident processes: this one owning the clock, the walker one held as an
observer.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: Spawn N vehicles with --hold (the TM dies with the process without it)
- [ ] Step 3: Verify visually / via the world-data skill; spawn reports its count
- [ ] Step 4: Ctrl+C the held process, then destroy when done
Commands need CARLA_HOST/CARLA_PORT/TM_PORT from scripts/env.sh.
Negative coordinates: pass --at with an = (--at=-24,-57,0.6) so the
leading minus isn't parsed as a flag.
Step 1: Check prerequisites
bash scripts/check_env.sh
Step 2-4: Spawn / list / destroy
source scripts/env.sh
# 40 vehicles driving around on autopilot — --hold keeps the TM (and so the
# driving) alive; without it they spawn, then freeze when this command returns.
# The world is put in sync at 20 Hz and this client ticks it.
python3 scripts/vehicles.py spawn --count 40 --hold
# leave the world asynchronous (the old behaviour; the TM misbehaves)
python3 scripts/vehicles.py spawn --count 40 --hold --no-sync
# a different fixed timestep
python3 scripts/vehicles.py spawn --count 40 --hold --delta 0.033
# four-wheeled cars only, reproducible
python3 scripts/vehicles.py spawn --count 30 --safe --seed 42
# only Teslas, parked (no autopilot)
python3 scripts/vehicles.py spawn --count 10 --filter 'vehicle.tesla.*' --no-autopilot
# 5 vehicles in one lane, 15 m apart, starting near (x,y,z)
python3 scripts/vehicles.py line --at 30,20,0 --count 5 --gap 15
# ...as a static queue (no autopilot), laid behind the point
python3 scripts/vehicles.py line --at 30,20,0 --count 5 --gap 15 --
よくある質問
出てくる車の種類を選べますか?
はい。使われる車種を絞り込めるので、ランダムではなく特定の種類を選べます。
遅い、または不安定なシミュレーターでも使えますか?
このスキルはシミュレーターをステップごとのモードに設定します。交通システムが確実に走らせるには、このモードが必要です。
交通ではなく、特定の1台を置けますか?
はい。1台のヒーローまたは自車を配置でき、ROS 2への公開のために名前を付けることもできます。
詳細
作者による元の説明
Spawns vehicles on a running CARLA server and destroys them — scattered across the map's spawn points on Traffic Manager autopilot, a row queued in a single lane at a fixed spacing, or a single hero/ego vehicle (optionally named for native ROS 2 publishing with --ros-name). Covers blueprint filtering, the atomic autopilot hand-off, and cleanup. Use when the user asks to "spawn vehicles/cars/traffic", "add N cars driving around", "put cars in a lane 15 m apart", "spawn the ego/hero vehicle", or "remove the vehicles".
repo: carla-simulator/carla
人気
- GitHubのスター
- 15k
- ランキング
- #11102
- ライセンス
- 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ライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。