run-scenario
Skill này làm gì
Skill khởi chạy một trong các kịch bản kiểm thử lái xe có sẵn trong simulator CARLA, và có thể liệt kê những gì phiên bản CARLA của bạn chạy được. Skill dành cho người kiểm tra cách phần mềm lái xe tự động xử lý các tình huống đã định.
Khi nào nên dùng
- ✓Khi bạn muốn chạy một bài kiểm thử chuẩn như xe chạy theo một xe dẫn đầu.
- ✓Khi bạn cần xem các kịch bản nào phiên bản đã cài hỗ trợ trước khi chọn.
- ✓Khi bạn muốn bài kiểm thử nắm quyền điều khiển xe chính hoặc để chương trình của bạn lái.
Liên kết skill
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-scenario/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể chạy bài kiểm thử FollowLeadingVehicle trong CARLA và cho tôi xem xe của tôi có đạt không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent chọn kịch bản theo tên cấu hình, kiểm tra bản đồ có khớp không, rồi bắt đầu chạy. Nó có thể tải lại bản đồ nếu cần và báo cáo kết quả khi bài kiểm thử kết thúc.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Vì sao kịch bản đôi khi không khởi động được?
Thường là simulator đang ở bản đồ khác với bản đồ kịch bản cần, hoặc kịch bản không có trong phiên bản phần mềm này.
Tôi có thể ghi lại lần chạy không?
Có. Lần chạy có thể được lưu để bạn phát lại sau.
Xe chính có cần người lái không?
Một số kịch bản cần, nên bạn có thể chọn điều khiển thủ công hoặc để agent tự động lái.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #11112
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
create-leaderboard-route
15kGiúp agent của bạn tạo file tuyến đường CARLA Leaderboard bằng cách đặt các điểm waypoint và trigger kịch bản từ camera của simulator, rồi kiểm tra và sắp xếp chúng.
package-leaderboard-agent
15kGiúp agent của bạn đóng gói một agent lái xe thành image Docker để nộp lên CARLA Leaderboard, kiểm tra cấu trúc thư mục và thử rằng image nạp được agent.
read-leaderboard-results
15kGiúp agent của bạn đọc file kết quả CARLA Leaderboard, giải thích điểm và vi phạm của từng tuyến, và chấm lại một lần chạy theo phiên bản luật khác.
run-leaderboard-evaluation
15kGiúp agent của bạn chạy bộ đánh giá CARLA Leaderboard trên một tập tuyến với agent lái xe, kiểm tra thiết lập trước và lưu checkpoint để có thể tiếp tục.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.