# RRT Benchmark 测试案例扩展报告

本报告扩展了轻量静态 2D RRT 测试集，覆盖 `open_space, narrow_passage, bug_trap, cluttered, maze, start_goal_near_obstacle, long_distance` 共 7 个场景；每个 `scenario × algorithm` 使用 7 个 seed。脚本仅依赖 Python 标准库，适合作为快速回归/冒烟测试。

## 标准 benchmark 调研结论

- **OMPL benchmark + Planner Arena**：采样式运动规划领域最标准、最可复用的 benchmark/log 分析组合，适合严肃比较 RRT/RRT*/RRT-Connect/PRM/KPIECE 等规划器；需要 OMPL 依赖，Planner Arena 可分析 OMPL benchmark log。
- **MoveIt benchmarking / ROS planning pipeline benchmark**：适合机械臂/机器人模型、场景和规划流水线比较；依赖 ROS/MoveIt/OMPL，较重。
- **MotionBenchMaker / 机器人运动规划问题集**：更接近机器人任务级 benchmark，适合后续扩展到真实 robot scene；依赖和数据集维护成本高于本次轻量测试。
- **PythonRobotics path planning examples**：有 RRT、RRT*、RRT-Connect 等教学示例，适合参考实现和简单 2D 案例；它本身更像示例集合，不是严格标准 benchmark。
- **常见轻量 2D 场景**：open space、narrow passage、bug trap、cluttered、maze-like、start/goal near obstacle、long-distance sparse barriers；适合当前页面展示和 CI 回归。

## 新增场景

- `open_space`: Mostly open map with two small sparse rectangular obstacles.
- `narrow_passage`: Vertical wall with a narrow central gate; tests passage discovery.
- `bug_trap`: U-shaped trap opening away from the goal, plus a second gate near the goal side.
- `cluttered`: Many rectangles create a cluttered static planning scene.
- `maze`: Alternating walls form a simple maze-like corridor with a final right-side exit gap.
- `start_goal_near_obstacle`: Start and goal are close to obstacle corners; tests collision margin behavior.
- `long_distance`: Longer start-goal distance with sparse barriers over a 150x100 map.

## 算法与指标

算法：RRT、RRT*、RRT-Connect。指标：success_rate、avg_planning_time_sec、avg_path_length、avg_nodes_or_iterations、avg_iterations、collision_checks、failure_reason_summary。

| scenario | algorithm | success_rate | avg_time_sec | avg_path_length | avg_nodes_or_iterations | avg_collision_checks | failure_reason_summary |
|---|---|---:|---:|---:|---:|---:|---|
| open_space | RRT | 100.0% (7/7) | 0.0027 | 128.82 | 102.1 | 217.6 | — |
| open_space | RRT* | 100.0% (7/7) | 0.5859 | 128.24 | 1600.1 | 8403.7 | — |
| open_space | RRT-Connect | 100.0% (7/7) | 0.0013 | 128.12 | 37 | 69.4 | — |
| narrow_passage | RRT | 100.0% (7/7) | 0.0015 | 84.00 | 72.9 | 157.1 | — |
| narrow_passage | RRT* | 100.0% (7/7) | 2.6579 | 84.00 | 3384.7 | 22437 | — |
| narrow_passage | RRT-Connect | 100.0% (7/7) | 0.0004 | 84.00 | 20.3 | 23.6 | — |
| bug_trap | RRT | 100.0% (7/7) | 0.0589 | 134.35 | 517.1 | 1873.7 | — |
| bug_trap | RRT* | 100.0% (7/7) | 2.7765 | 121.52 | 3396.7 | 24227 | — |
| bug_trap | RRT-Connect | 100.0% (7/7) | 0.0091 | 141.71 | 148 | 788.6 | — |
| cluttered | RRT | 100.0% (7/7) | 0.0071 | 136.24 | 121.7 | 413.1 | — |
| cluttered | RRT* | 100.0% (7/7) | 2.1376 | 128.45 | 2945.1 | 20513.1 | — |
| cluttered | RRT-Connect | 100.0% (7/7) | 0.0042 | 131.05 | 45.9 | 245.4 | — |
| maze | RRT | 100.0% (7/7) | 0.5235 | 334.23 | 1685.4 | 7706.4 | — |
| maze | RRT* | 100.0% (7/7) | 3.2033 | 306.22 | 3576.9 | 31363.1 | — |
| maze | RRT-Connect | 100.0% (7/7) | 0.2109 | 339.36 | 935.7 | 6962 | — |
| start_goal_near_obstacle | RRT | 100.0% (7/7) | 0.1635 | 219.75 | 1006.7 | 4022.3 | — |
| start_goal_near_obstacle | RRT* | 100.0% (7/7) | 1.4462 | 189.10 | 2412.4 | 18797.1 | — |
| start_goal_near_obstacle | RRT-Connect | 100.0% (7/7) | 0.0521 | 231.53 | 408 | 3538 | — |
| long_distance | RRT | 100.0% (7/7) | 0.0136 | 214.85 | 226.1 | 795.3 | — |
| long_distance | RRT* | 100.0% (7/7) | 2.7183 | 191.33 | 3436.1 | 25789.7 | — |
| long_distance | RRT-Connect | 100.0% (7/7) | 0.0073 | 208.86 | 105.1 | 565.9 | — |

## 可视化

每个场景有 seed=0 的路径示意 SVG，颜色：蓝色 RRT、红色 RRT*、绿色 RRT-Connect，黑色为障碍物。


### open_space

![open_space](assets/open_space.svg)

### narrow_passage

![narrow_passage](assets/narrow_passage.svg)

### bug_trap

![bug_trap](assets/bug_trap.svg)

### cluttered

![cluttered](assets/cluttered.svg)

### maze

![maze](assets/maze.svg)

### start_goal_near_obstacle

![start_goal_near_obstacle](assets/start_goal_near_obstacle.svg)

### long_distance

![long_distance](assets/long_distance.svg)
