run-route-scenario
Skill này làm gì
Skill lái một tuyến đã lên kế hoạch trong CARLA với một chương trình lái tự động điều khiển xe, cùng với giao thông và các sự kiện kịch bản dọc đường. Skill dành cho các nhóm đánh giá phần mềm lái xe tự động của họ.
Khi nào nên dùng
- ✓Khi bạn muốn kiểm tra chương trình lái tự động trên cả một tuyến thay vì một tình huống đơn lẻ.
- ✓Khi bạn cần chạy một tuyến trong danh sách để xem xe hoạt động thế nào trên đó.
- ✓Khi bạn muốn kết quả khớp với thiết lập CARLA Leaderboard chính thức.
Liên kết skill
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-route-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 tuyến 5 trong CARLA với chương trình lái tự động của tôi cầm lái, rồi cho tôi biết kết quả thế nào không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent đọc file tuyến để tìm các thị trấn và sự kiện, rồi cho xe chạy theo tuyến với chương trình lái của bạn. Agent báo cáo các kiểm tra tuyến như mức hoàn thành, độ lệch, vượt đèn đỏ, va chạm và việc xe có bị chặn hay không.
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 route
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 route is a list of waypoints plus a set of scenarios pinned to trigger
points along it. RouteScenario builds one behaviour tree containing every
scenario on the route, plus background traffic, and evaluates route-level criteria
(completion, deviation, red lights, collisions, blocked).
This is the mode that matters for autonomous-driving work, for three reasons:
- An agent drives.
--agentonly works here; with--scenarioit is refused. - Most of the scenario library is only reachable here. ~34 classes have no standalone config.
- It is what the Leaderboard runs. Same
RouteScenario, same criteria. The Leaderboard adds scoring, sensor limits and result bookkeeping on top.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh)
- [ ] Step 2: Inspect the route file — ids, towns, scenarios
- [ ] Step 3: Pick or write the agent
- [ ] Step 4: Run one route id first, then the file
- [ ] Step 5: Read the criteria; reset the world to async
Step 2: Inspect
source scripts/env.sh
bash scripts/run_route.sh list "$LEADERBOARD_ROOT/data/routes_devtest.xml"
bash scripts/run_route.sh show "$LEADERBOARD_ROOT/data/routes_devtest.xml" 0
list prints each route id, its town, waypoint count and scenario histogram, and
flags whether the towns it needs exist on the running server. show dumps one
route's scenarios in trigger order.
Route files come from two places: the Leaderboard's data/*.xml, or your own
(see [[create-leaderboard-route]] for the authoring tools). ScenarioRunner itself
ships no route files on master — the old srunner/data/routes_*.xml referenced
by the docs was removed.
Step 3: The agent
Route mode needs something to drive. srunner/autoagents/ has three:
| Agent | Use |
|---|---|
npc_agent.py |
a BasicAgent at 30 km/h following the route (not the Traffic Manager); the reference "it works" agent |
human_agent.py |
pygame window, keyboard control |
dummy_agent.py |
returns zero control; the template to copy |
ScenarioRunner derives the class name from the file name: npc_agent.py →
NpcAgent, my_cool_agent.py → MyCoolAgent
(os.path.basename(agent).split('.')[0].title().replace('_','')). A mismatch is an
AttributeError at load, not a helpful message. Writing one is
[[write-leaderboard-agent]] — the same AutonomousAgent interface applies here.
Step 4: Run
source scripts/env.sh
# one route, the NPC agent — the canonical check that routes work at all
AGENT="$SCENARIO_RUNNER_ROOT/srunner/autoagents/npc_agent.py" \
bash scripts/run_route.sh run "$LEADERBOARD_ROOT/data/routes_devtest.xml" 0
# every route in the file, results as JSON
AGENT=.../npc_agent.py OUTPUT=1 JSON=1 OUTPUT_DIR=./results \
bash scripts/run_route.sh run routes.xml
# your own agent with a config file, recorded for later replay
AGENT=~/team_code/my_agent.py AGENT_CONFIG=~/team_code/config.json RECORD=recordings \
bash scripts/run_route.sh run routes.xml 3
Direct equivalent:
python3 "$SCENARIO_RUNNER_ROOT/scenario_runner.py" \
--route routes.xml --route-id 0 --agent .../npc_agent.py --agentConfig cfg.json
--route-id is one id, not a range. Unlike the Leaderboard's
--routes-subset, there is no 0-4 or 1,6 syntax here: omit it to run every
route in the file, or loop.
Route mode forces two things regardless of what you pass:
--reloadWorld (the route names its town) and --sync when --agent is given
(arguments.sync = True). So the world will be reloaded and will be in
synchronous mode — plan the aftermath accordingly.
Step 5: Aftermath
Same trap as any sync run, worse here because it is unconditional: an interrupted
route leaves the world synchronous, which every other client sees as a hang.
run_route.sh resets it on exit including Ctrl-C. Otherwise:
[[set-world-settings]] async.
Examples
Example 1: "check that routes work"
AGENT="$SCENARIO_RUNNER_ROOT/srunner/autoagents/npc_agent.py" \
bash scripts/run_route.sh run "$LEADERBOARD_ROOT/data/routes_devtest.xml" 0
The NPC agent drives the route with a BasicAgent at 30 km/h; criteria print at the
end. If this fails,
Câu hỏi thường gặp
Tôi có cần chương trình lái để dùng không?
Có. Chạy tuyến cần một agent lái xe, đó là điểm khác biệt của chế độ này so với kịch bản đơn lẻ.
Tôi có thể thử một tuyến trước khi chạy cả file không?
Có. Skill có thể chạy một ID tuyến trước, rồi chạy toàn bộ file.
Những kiểm tra nào được báo cáo?
Mức hoàn thành tuyến, độ lệch khỏi đường đi, vượt đèn đỏ, va chạm và việc xe có bị chặn không.
Chi tiết
Mô tả gốc của tác giả
Runs a route through ScenarioRunner's RouteScenario mode (--route / --route-id) with an autonomous agent driving the ego — the same mechanism the CARLA Leaderboard uses, and the only way to reach the ~34 route-only scenario classes (Accident, ParkedObstacle, HazardAtSideLane, InvadingTurn, HardBreakRoute, YieldToEmergencyVehicle, junction and actor-flow scenarios). Inspects route files, lists route ids and their scenarios, and runs one or all of them. Use when the user asks to "run a route", "drive a route with my agent", "run leaderboard scenarios without the leaderboard", or names a route-on
repo: carla-simulator/carla
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #11111
- 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.