不是“船在场景里会动”,而是一套可训练、可拒绝、可回放、可追溯的自主航行策略准入实验台。 Not merely a moving vessel—a trainable, rejectable, replayable, and traceable admission bench for autonomous-navigation policies.
Godot 4.7 负责船舶操控、港区环境、风险包络和三维证据回放;Python/Gymnasium 负责时间隔离数据集、无渲染训练、模型固化、独立测试和策略准入。训练进度直接来自 Stable-Baselines3 的实际 num_timesteps,测试轨迹只由训练完成后的封存 test rollout 生成;失败、碰撞、近失和越界不会被演示层改写。
Godot 4.7 owns vessel control, port geometry, risk envelopes, and 3D evidence replay. Python and Gymnasium own chronological data isolation, headless learning, model persistence, independent evaluation, and policy admission. Training progress comes from actual Stable-Baselines3 timesteps, while visual replay is generated only from sealed post-training test rollouts.
可核验维度 / Verifiable dimension
固定证据 / Pinned evidence
工程意义 / Why it matters
场景合同 / Scenario contracts
121/121 完整 121/121 complete
航线、障碍、地形、动态船与风浪流字段可逐场检查 Routes, obstacles, terrain, traffic vessels, and wind–wave–current fields are inspectable per scenario.
训练执行 / Training execution
80,480 RL环境步、167 episodes 80,480 RL steps and 167 episodes
真实 learner 路径,不用计时器模拟进度 Real learner execution; no timer-driven progress simulation.
独立评测 / Independent evaluation
155 validation + 150 final rollouts
训练、选型与最终测试严格分离 Training, model selection, and final testing remain strictly separated.
回放一致性 / Replay consistency
5/5 回放、1,723 采样点 5/5 replays and 1,723 samples
后端指标、逐场CSV与Godot轨迹相互校验 Backend metrics, per-scenario CSV files, and Godot trajectories cross-check one another.
证据门禁 / Evidence gate
28/28 检查通过 28/28 checks passed
数据、奖励、模型、轨迹与源码哈希绑定 Dataset, reward, model, trajectory, and source hashes are bound together.
安全准入 / Safety admission
五方法均被保守门禁拒绝 All five methods rejected by the conservative gate
证明系统会暴露安全裕度缺口,而非美化零碰撞 The platform exposes safety-margin deficiencies instead of polishing a zero-collision result.
The evidence demonstrates simulator integrity, algorithm-evaluation capability, and fail-closed admission—not sea-trial performance, COLREGs certification, or commercial navigation authorization. Public environmental forcing, simulated dynamics, and real sensing/actuation data are always labelled as distinct evidence layers.
The v2 benchmark adds a ship_port_dataset_v3 contract and a 45-dimensional port environment without rewriting any frozen v1 model or metric. It streams seven nationwide NOAA AccessAIS daily archives from 1–7 January 2025 and combines the retained tracks with derived NOAA ENC geometry and co-temporal Open-Meteo forcing.
Standard DQN is restricted to discrete actions because it does not natively support continuous control. The four RL methods and LOS-PID share the same observation definition, dynamics, reward/safety metrics, and dataset splits for reproducible comparison.
The numerical environment is not a two-dimensional point demo. It evaluates circular, rectangular, and polygonal obstacles; applies additional clearance to overhangs and shorelines; advances dynamic traffic vessels; and incorporates closing speed, TCPA/DCPA, target identity, boundary clearance, forward/port/starboard sector clearance, and relative wind–wave–current directions into a 28-dimensional observation. Wind, waves, and current affect state transitions, while the Godot scene’s 落水悬岩 overhangs, navigation rocks, and temporary port obstacles can be merged into each training configuration.
The benchmark evaluates simulator completeness and reliability; it does not present offline simulation results as port cost savings, revenue growth, or proven vessel-safety benefits.
环境输入 / Environmental input:Open-Meteo 长滩邻近水域 2024-01-01 至 2024-04-30 共 2,904 条小时级再分析/模式归档,派生 121 个日级场景。 EN: 2,904 hourly reanalysis/model archive records for waters near Long Beach from 1 January through 30 April 2024, transformed into 121 daily scenarios.
时间隔离 / Temporal isolation:1—2 月 60 场训练、3 月 31 场验证、4 月 30 场最终测试;不随机打乱日期。 EN: 60 January–February training scenarios, 31 March validation scenarios, and 30 April sealed-test scenarios, with no randomized dates.
训练预算 / Training budget:PPO、SAC、TD3、DQN 各设置 20,000 timestep,LOS-PID 为同环境控制理论基线。 EN: 20,000 timesteps are configured for each of PPO, SAC, TD3, and DQN; LOS-PID is the control-theory baseline in the same environment.
最终验证 / Final evaluation:五方法共 150 个方法-场景 rollout。SAC 与 LOS-PID 在各自 30 场测试中实现 100% 无碰撞到达且碰撞场景率为 0;SAC 平均/P95 最大横向航迹误差为 9.98/15.13 m,但 P05 最小净距仅 0.99 m。 EN: The five methods complete 150 method-scenario rollouts. SAC and LOS-PID achieve 100% collision-free arrival and zero collision scenarios across their respective 30 tests. SAC’s mean/P95 maximum cross-track error is 9.98/15.13 m, while its P05 minimum clearance is only 0.99 m.
安全语义 / Safety semantics:旧字段 safe_completion_rate 不排除近失事件,因此只能解释为“无碰撞到达率”。当前五方法在 32 m 风险包络下均触发过包络侵入,保守离线策略准入门禁拒绝全部方法,不把零碰撞包装成安全认证。 EN: The legacy safe_completion_rate field does not exclude near misses and therefore means only “collision-free arrival rate.” Every method enters the 32 m risk envelope at least once, so the conservative offline admission gate rejects all five instead of treating zero collision as safety certification.
证据边界 / Evidence boundary:海况来自公开数值产品,航线、障碍、船舶动力学和动作响应来自项目仿真设定;结果不是实船海试、避碰认证或 COLREGs 合规结论。 EN: Environmental forcing comes from public numerical products, whereas routes, obstacles, vessel dynamics, and action response come from project simulation settings. The result is not a sea trial, collision-avoidance certification, or COLREGs compliance finding.
train split -> Python 数值环境 / numerical environment -> 真实训练 / real training -> checkpoint
|
用户点击“运行测试集并渲染” / user starts held-out rendering
v
test split -> Python 确定性 rollout / deterministic rollout
-> 真实轨迹/指标 / recorded trajectory and metrics -> Godot 3D 回放 / replay
训练进程不启动 Godot 场景渲染。 The training process never starts Godot scene rendering.
训练阶段只实例化 train split。 Only the train split is instantiated during learning.
checkpoint 同时记录数据集和完整实验配置 SHA-256;训练后数据、船体动力、奖励或环境安全设置被替换时,测试会拒绝运行。 Each checkpoint records SHA-256 for both the dataset and the complete experiment configuration. Evaluation refuses to run if data, vessel dynamics, reward, or environmental safety settings change after training.
测试失败、碰撞、超时和航线误差不会被改写。 Failures, collisions, timeouts, and route errors are never rewritten by the presentation layer.
Godot 回放使用测试 rollout 记录的油门/舵角序列,而不是内置演示路线。 Godot replay consumes the throttle/rudder sequence captured by the test rollout, not a built-in demonstration route.
快速开始 / Quick start
安装 Python 训练环境:
Install the Python training environment:
cd /path/to/sailing-simulator
bash tools/setup_rl_env.sh
默认开发、测试和 CI 使用 requirements-rl.txt。只有对仓库自带、SHA-256
校验通过的历史模型进行字节级深度复算时,才使用报告保存的旧环境记录。
Development, tests, and CI use requirements-rl.txt. Use the recorded legacy environment only for byte-level deep recomputation of repository-bundled historical models whose SHA-256 hashes have already been verified:
运行主场景后按 C 打开训练页。“算法/环境设置”可配置船体半径、悬岩净距、感知范围、碰撞时间窗、域随机化和生成交通船;“预览安全边界”会把有效包络直接画回场景。选择算法和预算后点击“启动训练”,完成后再点击“运行测试集并渲染”。
Run the main scene and press C to open the training page. “Algorithm / Environment Settings” configures hull radius, overhang clearance, sensing range, collision horizon, domain randomization, and generated traffic. “Preview Safety Boundary” draws the effective envelope into the scene. Select an algorithm and budget, start training, and only after completion run the held-out test set with rendering.
# 离线重建121个场景 / rebuild 121 scenarios from the bundled 2,904 hourly records
.venv/bin/python tools/build_public_navigation_benchmark.py
# 快速哈希核验 / quickly verify data, config, code, model, and trajectory hashes
.venv/bin/python tools/run_navigation_benchmark.py verify
# 深度复算 / rerun 150 deterministic sealed-test rollouts across five methods
.venv/bin/python tools/run_navigation_benchmark.py verify --deep
# v2 十方法报告与港口契约核验 / verify the v2 ten-method port benchmark
make port-contract-verify
make port-benchmark-verify
# Godot 前端联动与主船航行回归 / UI linkage and navigation regression
make godot-ui-navigation-smoke \
GODOT=/absolute/path/to/Godot
接入真实港口 / Bring your own port
项目接受包含 train、validation、test 的 ship_port_dataset_v3 JSON。复制 港口包清单模板,对齐历史 AIS、授权水深/航道/限制区 GIS 与逐小时环境输入,通过契约后只需让实验 JSON 指向新数据包,无需修改十种算法代码。
The platform accepts a ship_port_dataset_v3 JSON contract with chronological train, validation, and test splits. Fill the port package manifest, align AIS, authorized chart/GIS layers, and hourly forcing, then point an experiment file at the new package without modifying any of the ten algorithms:
AIS 提供历史航迹,GeoJSON 提供岸线、悬岩、礁石、码头和防波堤;二者会投影到同一个局部米制坐标系。港口场景配置可通过 SHIP_PORT_PROFILE 或 user://port_profile.json 替换。RL 测试回放直接读取测试任务中的航线、地形、静态障碍和动态交通,因此换训练集/测试集即可更换算法实验水域。
AIS supplies historical tracks, while GeoJSON supplies shorelines, overhangs, reefs, berths, and breakwaters; both are projected into the same local metric coordinate system. Replace the port profile through SHIP_PORT_PROFILE or user://port_profile.json. RL test replay reads routes, terrain, static obstacles, and dynamic traffic directly from the test task, so changing the train/test dataset changes the experimental waterway.
公开海况数据 / Public environmental data
默认启动会读取仓库内带来源元数据的 Open-Meteo 新加坡水域快照,并异步刷新实时公开数据。气象面板会显示 live、cache、manual 等真实来源状态;点击天气预设或手动改数值后,来源会明确变成 scenario_override/manual_override。
By default the project reads the bundled provenance-tagged Open-Meteo snapshot for Singapore waters and refreshes public live data asynchronously. The weather panel exposes source states such as live, cache, and manual; selecting a preset or editing a value explicitly changes provenance to scenario_override or manual_override.
固定可靠性基准则使用长滩邻近水域 2024 年 1—4 月归档数据,不依赖启动时的网络状态。data/public/*.provenance.json 保留请求 URL、许可、抓取时间和小时 CSV SHA-256。Open-Meteo 的数值产品只作为离线环境强迫,不用于实际沿海导航。
The pinned reliability benchmark uses archived January–April 2024 records near Long Beach and does not depend on network availability at launch. data/public/*.provenance.json preserves the request URL, license, retrieval timestamp, and hourly CSV SHA-256. Open-Meteo numerical products are offline forcing only, never a source for real coastal navigation.
tools/ship_rl/:v1/v2 Gymnasium 环境、十算法训练/控制和测试。 v1/v2 Gymnasium environments plus ten-method RL/control evaluation.
tools/rl_train_baselines.py:Godot 与命令行共用入口。 Shared entry point for Godot and command-line workflows.
data/rl/long_beach_public_weather_benchmark_v1.json:固定公开海况可靠性基准,明确区分公开环境输入与仿真场景。 Pinned public-forcing benchmark that separates public environmental input from simulated scenarios.
data/rl/default_port_dataset.json:安装级项目原生 smoke fixture,不冒充实测 AIS。 Installation-level native smoke fixture; never represented as measured AIS.
tools/public_data_pipeline.py:公开气象和 NOAA AIS 数据适配器。 Adapters for public weather and NOAA AIS data.
tools/run_navigation_benchmark.py:五方法准备、冻结测试集、最终测试和深度复核。 Five-method preparation, test sealing, final evaluation, and deep verification.
tools/run_port_ops_benchmark.py:十方法真实港口数据覆盖测试、冻结测试集与哈希复核。 Ten-method real-port data coverage, sealed-test evaluation, and hash verification.
tools/run_simulator_reliability_audit.py:场景覆盖、逐场指标、回放一致性、证据完整性和控制策略准入双门禁。 Dual reliability/admission gate for coverage, per-scenario metrics, replay consistency, and evidence integrity.
tools/run_godot_acceptance.py:Godot 版本、解析和短时 headless 启动验收,回执绑定脚本/场景源文件树。 Godot version, parse, and short headless-start acceptance bound to the script/scene source tree.
tools/release_check.py:数据、模型、轨迹、报告和开源边界门禁。 Release gate for data, models, trajectories, reports, and open-source boundaries.
scripts/ui/ship_rl_control_panel.gd:真实训练/测试任务控制台。 Console for real training and evaluation jobs.
scripts/rl/ship_policy_replay_controller.gd:测试动作序列可视化回放。 Visual replay of held-out action sequences.
docs/DATASET_SCHEMA.md:数据契约与港口接入说明。 Dataset contract and port-integration guide.
docs/PORT_PROFILE_SCHEMA.md:Godot 港口场景与航行任务配置。 Godot port-scene and navigation-task profile.
docs/MODULE_DATA_DRIVERS.md:每个面板的数据源、计算边界和替换入口。 Source, computation boundary, and replacement entry for each panel.
docs/ALGORITHM_PARAMETERS.md:训练面板参数与 v1 五方法、v2 十方法后端的实际映射。 Exact mapping from UI parameters to the frozen v1 and extended v2 backends.
docs/LEGACY_ASSET_COMPATIBILITY.md:旧场景/资源路径的保留边界与航行模拟器命名规则。 Retention boundaries and naming rules for legacy scenes and assets.
The code is Apache-2.0 licensed. make release-check verifies code, data, experiment, and model evidence; .venv/bin/python tools/release_check.py --strict-assets also fails on unresolved asset licenses. Provenance review for all existing images, textures, and character assets is not yet complete, so the full visual package must pass the asset-license audit before public redistribution. See data sources for provenance and attribution, simulator metrics for evaluation semantics, and resume evidence and prohibited claims for externally defensible wording.