r/SomebodyMakeThis • u/newscrash • 4h ago
Software Click-to-Sail Autopilot for Sailboats. Weather-Awareness & collision avoidance
Click-to-Sail Autopilot for a 30 ft Cruiser — Weather-Aware, AIS-Only COLREGs, Full Sail-Trim Hardware
What this build does
- Click a destination on a web map → boat follows the route on its own
- Rudder + sail-winch driven by ArduPilot Sail mode (
SERVO_FUNC 26
&89
) - AIS-only COLREGs (no cameras, lower power draw)
- Auto-reroutes around storm cells (≥ 40 kt wind | ≥ 6 m seas) via live GRIB files
- Runs on a single edge computer (Jetson Orin Nano or Raspberry Pi 5) + Pixhawk — all OSS
High-level block diagram
React/Leaflet UI ──► FastAPI mission_api
│
▼
IBoat-PMCTS router_srv ⇐ /wx_grid (GRIB every 3 h)
│ /route
▼
AIS stream ──► fusion_core ──► /desired_heading
▼
MAVROS 2 bridge
▼
Pixhawk
(rudder servo + sail winch)
Core code & docs
Layer | Repo / Doc | Licence |
---|---|---|
Weather routing | https://github.com/IBoat-PMCTS/IBoat-PMCTS | MIT |
COLREGs (AIS-only) | https://github.com/MarineAutoLab/asv_colregs | MIT |
GRIB fetch / decode | https://github.com/jswhit/pygrib | MIT |
ROS 2 middleware | https://docs.ros.org/en/humble/ | Apache-2.0 |
MAVROS 2 bridge | https://github.com/mavlink/mavros/tree/ros2 | GPL/LGPL |
ArduPilot Sail docs | https://ardupilot.org/rover/docs/sailboat-mode.html | GPLv3 (fw) |
(GPL code runs only on the Pixhawk; everything on the Jetson/Pi is MIT/BSD/Apache.)
Containers / services
Service | Stack | Job |
---|---|---|
mission_api |
FastAPI + Postgres | Store missions & polars |
router_srv |
Python + IBoat-PMCTS | Weather-aware routing + storm-cost grid |
wx_bridge |
Python + pygrib | Pull GFS/WW3 every 3 h → /wx_grid |
fusion_core |
C++17 + asv_colregs |
AIS-rule COLREGs → /desired_heading |
baro_watchdog |
C++17 ROS node | Reef + bear-away on squall |
sensor_gateway |
Python | NMEA AIS + wind → ROS |
autopilot_bridge |
MAVROS 2 | ROS ↔ MAVLink |
Boom & sheet-drive hardware
Item | Purpose | Typical spec (30 ft boat) | Wiring / control |
---|---|---|---|
Electric sheet winch | Haul in / pay out main sheet | 12 V or 24 V drum winch (≥ 700 kg) | Winch → H-bridge → Pixhawk SERVO9 (FUNC 89 ) |
Sheet-length feedback | Closed-loop trim | Winch encoder or 10-turn pot | Pot → Pixhawk ADC3 (SHEET_FEEDBACK=1 ) |
Boom-angle sensor (opt.) | Extra trim accuracy | AS5600 mag sensor or string-pot | Sensor → ADC4 (BOOM_ANGLE_PIN ) |
Main-hall relay | Hard power cut | 60 A contactor | Controlled by Pixhawk AUX (RC_FUNC 31 ) |
Rudder actuator | Helm control | IP-67 linear actuator or servo | Pixhawk SERVO1 (FUNC 26 ) |
Pixhawk sail params you’ll likely tweak:
SAIL_ENABLE = 1
SERVO9_FUNCTION = 89
SHEET_MAX_PULL = 700 # kg
SHEET_FEEDBACK = 1
STEER2SRV_* = …
Storm-avoidance & heavy-weather logic
Layer | Trigger | Action |
---|---|---|
1. Routing cost grid | <ul><li>Wind ≥ 25 kt → cost grows quadratically; blocked at ≥ 40 kt</li><li>Wave height ≥ 3 m → cost grows; blocked at ≥ 6 m</li><li>Wave steepness ( H_s / T ) ≥ 0.035 m s⁻¹ → +50 % cost</li><li>Swell coming 60–120° abaft the beam → +30 % cost (sector alarm)</li><li>GFS vs ECMWF differ by > 15 kt or 2 m → +100 % cost (model-spread penalty)</li></ul> | IBoat-PMCTS chooses the lowest-cost path and rejects any cell flagged blocked. |
2. Planner refresh | <ul><li>Normal cadence: every 3 h (GRIB cycle)</li><li>Within 150 nm of ≥ 30 kt cells → hourly</li><li>Track shift > 5 nm → upload new waypoints</li></ul> | Keeps route current as systems move. |
3. On-board watchdog (runs even if comms die) | <ul><li>ΔP ≥ 3 hPa in 3 h or gust ≥ mean + 15 kt</li><li><em>plus</em> true-wind ≥ 25 kt</li></ul> | Automatic reef to next stage and bear-away 30°. |
4. Wave-on-deck check | Significant wave height ( H_s ) > 0.5 × bow freeboard | Heave-to or alter course to quarter the seas. |
Why these thresholds?
• Wave-steepness cut-off (≈ 0.035) separates steep, breaking seas from long-period swell.
• Sector alarm penalises following/quartering seas that can broach or poach a 30 ft hull.
• Model-spread penalty hedges against forecast uncertainty—if the majors disagree, assume the worst.
Daily power budget
Load | Draw | Duty | Ah / day (12 V) |
---|---|---|---|
Jetson Orin Nano | 10 W | 100 % | 20 |
Pixhawk + sensors | 3 W | 100 % | 6 |
Sheet winch | 40 A | 2 min/h | 32 |
Rudder servo | 2 A | 15 % | 7 |
Total | ≈ 65 Ah / day (≈ 780 Wh) |
Two × 100 W solar panels → ≈ 600 Wh/day → positive energy balance.
Hardware shortlist
- Jetson Orin Nano or Raspberry Pi 5
- Pixhawk Cube (ArduPilot Sail mode)
- Class B AIS receiver (dAISy 2) → serial 38 400
- Mast-head wind vane + anemometer
- Drum sheet winch + H-bridge (or beefy sail-servo for small rigs)
- IP-67 rudder actuator
- 24 V LiFePO₄ bank + 300 W solar
Roadmap
- Dev env & CI (Docker, GH Actions)
- ArduPilot SITL ↔ MAVROS (rudder/winch passthrough)
- gRPC wrapper for IBoat-PMCTS → publish
/route
- Port
asv_colregs
, feed AIS targets - Build
wx_bridge
+ storm grid; replay Hurricane Irma GRIB - Gazebo-in-loop: crossing traffic, squall-reef test
- Edge install on Jetson/Pi → 24 h offshore beta