跳到正文
Skillpedia
测试15k · #11110

run-openscenario

它能做什么

这项技能在 CARLA 模拟器中运行 OpenSCENARIO 标准格式编写的场景文件,许多驾驶工具都使用这种格式。适合用共享场景文件测试自动驾驶软件的工程师。

适用场景

  • ✓当你有其他工具生成的 OpenSCENARIO 文件,并想在 CARLA 中运行时。
  • ✓当你想在运行前检查场景文件是否有错误时。
  • ✓当你需要了解 CARLA 支持该标准的哪些部分时。

技能链接

https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-openscenario/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/run-openscenario/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“你能在 CARLA 中运行这个 OpenSCENARIO 文件,先检查是否有错误,并告诉我是否有不受支持的功能吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会按照标准的规则检查文件,然后用对应的选项开始运行。许多此类文件自带地图和汽车,因此无需单独指定地图名称。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Run an OpenSCENARIO file

Paths. scripts/… and references/… 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

常见问题

两种文件类型有什么区别?

以 .xosc 结尾的文件使用 1.x 标准,以 .osc 结尾的文件使用 2.0 语言,后者仍处于实验阶段。

文件还需要单独的地图设置吗?

通常不需要。这些文件包含自己的道路网络,因此地图来自文件本身。

它能运行需要外部控制器驾驶汽车的文件吗?

可以。如果文件需要外部控制器,这项技能可以驾驶或观察主车。

详情

作者的原始描述

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

热度

GitHub 星标
15k
排名
#11110
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能