analyze-scenario-results
它能做什么
这项技能读取驾驶测试运行生成的结果文件,并将其整理为通俗的摘要。适合需要知道测试是否通过、出了什么问题的人。
适用场景
- ✓当你想知道某次驾驶测试是通过还是失败时。
- ✓当你需要了解是哪一项具体检查导致失败时。
- ✓当你想比较两次测试运行,看看有哪些变化时。
技能链接
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/scenario-runner/analyze-scenario-results/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的 CARLA 驾驶测试通过了吗?如果没有,是哪项检查失败了,原因是什么?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会打开保存的结果文件,列出每项检查及其通过或失败状态,也可以并排比较两次运行。它还可以在不运行模拟器的情况下,从保存的录制中计算额外的数值。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Analyse scenario results
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.
Three separate things get called "results", and they answer different questions:
| Artefact | Produced by | Answers |
|---|---|---|
| criteria table | --output / --file / --json / --junit |
did it pass, and which criterion failed |
| criteria JSON next to a recording | --record |
the full criterion state, for tooling |
| CARLA recorder log | --record |
everything that happened, replayable |
The metrics module works off the third one, so anything you did not --record can
only be re-measured by re-running.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh)
- [ ] Step 2: Summarise the result files you have
- [ ] Step 3: For deeper analysis, run a metric over a recording
- [ ] Step 4: Compare runs if you have more than one
Step 2: Summarise
source scripts/env.sh
python3 scripts/analyze_results.py summary ./results # a directory of results
python3 scripts/analyze_results.py summary ./results/*.json # specific files
python3 scripts/analyze_results.py compare ./before ./after # two runs, criterion by criterion
summary reads .json, .xml (junit) and .txt outputs, normalises them, and
prints one line per scenario with the failing criteria named. compare diffs two
sets by scenario name and criterion, which is the useful view when you changed a
controller and want to know what got worse.
To produce these in the first place, run with the output flags:
cd ../run-scenario
OUTPUT=1 JSON=1 OUTPUT_DIR=./results bash scripts/run_scenario.sh group:ControlLoss
Note the file naming: ScenarioRunner writes
<outputDir>/<config name><YYYY-MM-DD-HH-MM-SS>.json with no separator before
the timestamp, so names look like ControlLoss_12025-08-14-10-22-31.json.
analyze_results.py splits that back apart.
Step 3: Metrics over a recording
Record first — this writes both a .log recording and a <name>.json of criteria:
cd ../run-scenario
RECORD=recordings bash scripts/run_scenario.sh FollowLeadingVehicle_1
# -> $SCENARIO_RUNNER_ROOT/recordings/FollowLeadingVehicle_1.log
# $SCENARIO_RUNNER_ROOT/recordings/FollowLeadingVehicle_1.json
Then run a metric:
source scripts/env.sh
python3 scripts/analyze_results.py metrics --list # bundled example metrics
python3 scripts/analyze_results.py metrics \
--metric "$SCENARIO_RUNNER_ROOT/srunner/metrics/examples/distance_between_vehicles.py" \
--log recordings/FollowLeadingVehicle_1.log \
--criteria recordings/FollowLeadingVehicle_1.json
which is a wrapper for
python3 "$SCENARIO_RUNNER_ROOT/metrics_manager.py" \
--metric <metric.py> --log <recording.log> [--criteria <criteria.json>]
The metrics module needs a running server even though it computes offline: it replays the recording to recover the map and to resolve actor ids to positions. That is the one non-obvious prerequisite.
Bundled examples, in increasing complexity:
| Metric | What it shows |
|---|---|
basic_metric.py |
the minimum: subclass BasicMetric, implement _create_metric |
criteria_filter.py |
pull specific fields out of the criteria JSON into a table |
distance_between_vehicles.py |
per-frame distance between two actors, plotted |
distance_to_lane_center.py |
lateral error against the lane centre, plotted |
Writing your own is a subclass of BasicMetric with one method; the recording is
exposed as a MetricsLog object with get_actor_transforms, get_ego_vehicle_id,
get_all_frames and friends. Details in
references/metrics.md.
Step 4: What the criteria mean
A failing criterion names the behaviour that broke, not the cause:
| Criterion failed | Read as |
|---|---|
CollisionTest |
the ego hit something — check the recording for what |
DrivenDistanceTest |
the ego did not get far enough: blocked, or the scenario ended early |
ActorBlockedTest |
the ego stopped and stayed stopped |
KeepLaneTest / WrongLaneTest / OnSidewalkTest |
lateral control or a bad overtake |
RunningRedLightTest / RunningStopTest |
traffic-control handling |
RouteCompletionTest < 100 |
route not finished (route mode |
常见问题
它需要模拟器正在运行吗?
不需要。它读取的是已保存的结果和录制,因此不需要模拟器。
它能读取哪些文件?
结果表格、JSON 和 JUnit 结果文件,以及与录制一同保存的判定标准文件。
它能测量未录制的内容吗?
不能。额外测量只适用于运行期间保存的录制。
详情
作者的原始描述
Reads and summarises ScenarioRunner output — the criteria pass/fail tables from --output/--file, the machine-readable --json and --junit result files, and the criteria JSON written alongside a --record recording — and runs the metrics module (metrics_manager.py) to compute custom measurements over a recorded run offline, without the simulator. Use when the user asks "did the scenario pass", "why did it fail", "summarise these results", "compare these runs", or wants distance/speed/lane metrics from a recording.
repo: carla-simulator/carla
热度
- GitHub 星标
- 15k
- 排名
- #11108
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
create-leaderboard-route
15k帮你的智能体通过在模拟器视角中放置路径点和场景触发器,构建 CARLA Leaderboard 路线文件,并对其进行检查和排序。
package-leaderboard-agent
15k帮你的智能体把驾驶智能体打包成 Docker 镜像,用于提交 CARLA Leaderboard,并检查文件夹结构,测试镜像能否加载它。
read-leaderboard-results
15k帮你的智能体阅读 CARLA Leaderboard 结果文件,解释每条路线的得分和违规情况,并按另一规则版本重新计分。
run-leaderboard-evaluation
15k帮你的智能体用你的驾驶智能体在一组路线上运行 CARLA Leaderboard 评估器,先检查设置,并保存可以恢复的检查点。