run-openscenario
Skill này làm gì
Skill chạy các file kịch bản viết theo chuẩn OpenSCENARIO, mà nhiều công cụ lái xe dùng, bên trong simulator CARLA. Skill dành cho kỹ sư kiểm thử phần mềm lái xe tự động bằng các file kịch bản dùng chung.
Khi nào nên dùng
- ✓Khi bạn có một file OpenSCENARIO từ công cụ khác và muốn chạy nó trong CARLA.
- ✓Khi bạn muốn kiểm tra lỗi của một file kịch bản trước khi chạy.
- ✓Khi bạn cần biết CARLA hỗ trợ những phần nào của chuẩn.
Liên kết skill
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-openscenario/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 file OpenSCENARIO này trong CARLA, kiểm tra lỗi trước, và cho tôi biết có tính năng nào chưa được hỗ trợ không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent kiểm tra file theo các quy tắc của chuẩn, rồi bắt đầu chạy với tùy chọn phù hợp. Nhiều file này tự mang bản đồ và xe của chúng, nên không cần tên bản đồ riê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 an OpenSCENARIO file
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.
ScenarioRunner speaks two unrelated standards that happen to share a name:
| OpenSCENARIO 1.x | OpenSCENARIO 2.0 | |
|---|---|---|
| Extension | .xosc |
.osc |
| Format | XML (<Storyboard>, <Act>, <Maneuver>) |
a domain-specific language |
| Flag | --openscenario |
--openscenario2 |
| Implementation | srunner/tools/openscenario_parser.py |
srunner/osc2/ (ANTLR grammar) |
| Maturity | broad, partial | experimental |
They are not versions of each other and no file works with both flags.
Unlike Python scenarios, an OSC file carries its own map, entities and ego —
so there is no --scenario name, no town lookup, and --reloadWorld is implied by
whatever <RoadNetwork> says.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh)
- [ ] Step 2: Find or validate the file (list / validate)
- [ ] Step 3: Run it with the right flag
- [ ] Step 4: Drive or observe the ego if the file expects an external controller
Step 2: Find and validate
source scripts/env.sh
bash scripts/run_openscenario.sh list # bundled .xosc and .osc, per branch
bash scripts/run_openscenario.sh validate path/to.xosc # schema + map + entity check, no server
validate is worth running first: it resolves the <RoadNetwork><LogicFile> map
against the server's map list, checks catalog references, and reports the
ParameterDeclarations you can override — all of which otherwise fail several
seconds into a run, after the world has already been reloaded.
Step 3: Run
source scripts/env.sh
# OpenSCENARIO 1.x
bash scripts/run_openscenario.sh run "$SCENARIO_RUNNER_ROOT/srunner/examples/FollowLeadingVehicle.xosc"
# with global parameter overrides — note the 'key: value' comma-separated form
PARAMS='leadingSpeed: 8.0, egoSpeed: 12.0' \
bash scripts/run_openscenario.sh run .../FollowLeadingVehicle.xosc
# OpenSCENARIO 2.0
bash scripts/run_openscenario.sh run2 "$SCENARIO_RUNNER_ROOT/srunner/examples/cut_in_and_slow_right.osc"
Direct equivalents:
python3 "$SCENARIO_RUNNER_ROOT/scenario_runner.py" --openscenario file.xosc --openscenarioparams 'k: v'
python3 "$SCENARIO_RUNNER_ROOT/scenario_runner.py" --openscenario2 file.osc
--openscenarioparams overrides only entries in the global
ParameterDeclarations; per-story parameters are not reachable. The format is
'name: value, name2: value2' — it is split on , then on : and both sides are
stripped, so a value containing either character breaks the parse.
The OSC timeout is hard-coded to 100000 seconds for both flags. A stuck OSC run
does not time out on its own; interrupt it.
Step 4: Who drives the ego
An .xosc that assigns a controller (<ObjectController> with the CARLA
NpcVehicleDriving / simple_vehicle_control controllers) drives itself. One
that declares the ego with an external controller does not — same silent
"nothing happens" as with Python scenarios:
python3 "$SCENARIO_RUNNER_ROOT/manual_control.py" -a --rolename=hero
--rolename picks the actor (default hero); -a hands it to the autopilot.
Drop -a to drive it by keyboard.
OscControllerExample.xosc is the file to read for how controllers are wired.
Examples
Example 1: "run this xosc I got from another tool"
validate first. The two usual rejections are a map name the server does not have
(<LogicFile filepath="Town04"> needs Town04 loaded/available) and OSC features
ScenarioRunner does not implement — validate names both. Then run.
Example 2: "sweep a parameter"
for v in 4 8 12; do
PARAMS="leadingSpeed: $v" bash scripts/run_openscenario.sh run .../FollowLeadingVehicle.xosc
done
Example 3: "try OpenSCENARIO 2.0"
list shows the .osc corpus (cut_in_and_slow_right.osc, overtake1.osc,
follow_trajectory.osc, …). On ue5-master and ue58-dev they live in
srunner/osc_examples/, not srunner/examples/. Expect gaps: the osc2 pipeline
parses a subset of the language and raises from srunner/osc2/ on the rest.
Troubleshooting
Problem: File does not exist
Cause: ScenarioRunner checks the path before anything else, and relative paths
resolve agains
Câu hỏi thường gặp
Hai loại file khác nhau thế nào?
File có đuôi .xosc dùng chuẩn 1.x, còn file có đuôi .osc dùng ngôn ngữ 2.0, vẫn đang thử nghiệm.
File có cần cài đặt bản đồ riêng không?
Thường là không. Các file này có mạng đường riêng, nên bản đồ lấy từ file.
Nó có chạy được file cần bộ điều khiển cho xe không?
Có. Skill có thể lái hoặc quan sát xe chính nếu file cần một bộ điều khiển bên ngoài.
Chi tiết
Mô tả gốc của tác giả
Runs standard-format scenarios through ScenarioRunner — ASAM OpenSCENARIO 1.x (.xosc, via --openscenario, with catalogs and ParameterDeclaration overrides) and OpenSCENARIO 2.0 (.osc, via --openscenario2, the ANTLR/osc2 pipeline). Validates a file against the schema before running, lists the bundled examples, and reports which OSC features ScenarioRunner actually implements. Use when the user asks to "run an xosc", "run an OpenSCENARIO file", "use the OpenSCENARIO standard", "run a .osc / OSC2 scenario", or hands over a scenario file from another tool.
repo: carla-simulator/carla
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #11110
- 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.