Skip to content

Conversation

robustini
Copy link
Contributor

@robustini robustini commented Jul 29, 2025

ArduPilot's SOAR mode equips gliders with the essential capability to autonomously thermal. When lift is encountered, it can efficiently center the thermal to gain altitude, extending flight time.
However, its effectiveness is bound by significant limitations. The system operates reactively and lacks a proactive exploration strategy to search a designated area for lift. Furthermore, it possesses no spatial memory; once a thermal dissipates or is lost, its location is forgotten, preventing the aircraft from revisiting historically productive zones.
When used in AUTO mode, SOAR simply follows a predefined waypoint track, enabling thermalling only if lift is found by chance along that rigid path. It performs no intelligent analysis or strategic deviation to actively hunt for thermals.
SoarNav was developed to overcome these boundaries, introducing the strategic exploration and intelligence that the core system lacks.
SoarNav is an advanced Lua script designed for automated thermal hunting. It utilizes a dual, intelligent strategy that goes beyond simple navigation.

Key Features:

  • Systematic Exploration (Virtual Grid): The script divides the flight area into a virtual grid, which is systematically explored to find new lift sources. The flight area is highly flexible, supporting both a circular radius and multiple polygon files selected via parameter. The grid logic is highly optimized with pre-calculated cell centers and distance-based updates to ensure high performance and low CPU load.

  • Advanced Thermal Analysis (Strength & Quality): The script remembers not just the location of a thermal, but also its quality. It analyzes the climb rate to save its average and peak strength and assesses its consistency (steady vs. variable lift).

  • Intelligent Thermal Memory (Core, Clustering & Focus Mode): The script now saves the thermal core (the location of the strongest lift) for superior accuracy. A clustering algorithm identifies "hot zones" with a high density of thermals. When a cluster is detected, the script can engage a Focus Mode, temporarily concentrating its search in that highly promising area. To ensure reliability, a "Lost Thermal-Awareness" failsafe prevents the script from chasing thermals that have dissipated.

  • Energy-Aware Logic: The script's strategy adapts to the aircraft's energy state. When low on altitude, it prioritizes safety by navigating to the strongest known thermal to regain height. With ample altitude, it makes a probabilistic choice between exploring a new grid cell or navigating towards a known thermal, balancing exploration with exploitation.

  • Thermal Streeting (Pattern Recognition): Instead of treating thermals as isolated events, the script attempts to identify "thermal streets"—lines of lift aligned with the wind. If a pattern is detected, it will proactively navigate along the projected street axis to find the next thermal in the chain.

  • Dynamic Drift Prediction: When targeting a known hotspot, the script uses the current wind vector and the hotspot's age to predict its new, drifted position, increasing the chances of a successful intercept.

  • Advanced Tactical Navigation (Anti-Stuck & Reroute): The script features two distinct tactical maneuvers. First, a robust anti-stuck logic detects if the aircraft is making poor progress (e.g., due to headwinds) and initiates an upwind repositioning maneuver. Second, a tactical reroute can be triggered mid-flight, initiating an intelligent 90-degree course change to break out of sink and explore a different airmass.

  • Intuitive Pilot Interaction: The pilot can intervene at any time. Moving the pitch or yaw sticks instantly pauses navigation. A rapid roll gesture toggles a persistent manual override, while a rapid pitch gesture re-centers the circular search area to the aircraft's current location.

This contribution aims to provide a powerful and robust autonomous soaring experience for the ArduPilot glider community.

@robustini robustini changed the title LUA Applet - SoarNav, intelligent autonomous soaring Scripting: SoarNav applet, intelligent autonomous soaring Jul 29, 2025
@Hwurzburg Hwurzburg added the WikiNeeded needs wiki update label Jul 29, 2025
@robustini robustini requested a review from IamPete1 August 2, 2025 05:00
@robustini robustini force-pushed the master branch 11 times, most recently from b4cb86c to 6306c75 Compare August 5, 2025 06:33
@robustini
Copy link
Contributor Author

robustini commented Aug 5, 2025

Sample log of a flight on SITL and Realflight using the latest version of SoarNav 0.9.57.
In this case, the autopilot only activated the motor once to bring the glider back to cutoff altitude; for the rest, the script took care of it by exploiting the thermals found.
The SoarNav log is set to maximum to provide complete debugging of what is happening.

00000012.ZIP

@robustini robustini force-pushed the master branch 11 times, most recently from 2ba201d to a8ea5e6 Compare August 6, 2025 08:05
@robustini robustini force-pushed the master branch 26 times, most recently from 5d69a37 to e8a3b62 Compare August 17, 2025 11:09
SoarNav is an advanced Lua script for intelligent, autonomous soaring
that enhances ArduPilot's capabilities. It uses a suite of strategic
features to maximize flight time within a defined area.
The script employs a hybrid exploration strategy, dynamically balancing
the search for new grid cells with guided re-visiting of the least
explored areas based on recent thermal success. This is coupled with an
intelligent thermal memory that saves thermal core locations. A
sophisticated clustering algorithm then identifies promising hot zones
using a weighted score based on nearby thermals' strength, age, and
proximity.
Real-time thermal analysis is performed using adaptive sampling for a
responsive strength calculation. The script is architected for robust
performance with a modular state machine and parameter caching. Safety
is enhanced with dynamic anti-stuck logic, tactical rerouting, and
thermal street detection capabilities.
@robustini
Copy link
Contributor Author

Sorry, this PR is too messy. I'll open another one from a separate branch of my fork, as it should be.

@robustini robustini closed this Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WikiNeeded needs wiki update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants