In PX4, a geofence breach can trigger None, Warning, Hold, Return, Terminate or Land, set by the GF_ACTION parameter. Terminate is disabled unless the CBRK_FLIGHTTERM circuit breaker is reset. For strict no fly zones the documentation suggests Hold with a safety margin. Return needs a clear path back.
What the geofence checks
The PX4 documentation describes the geofence failsafe as triggering when the vehicle leaves the horizontal or vertical limit. You choose the action with GF_ACTION. The options are None, Warning, Hold, Return, Terminate and Land.
That is a lot of choices for a single event. The right one depends on what is outside the fence and what is on the way back.
Choosing an action
| Situation | A reasonable starting choice |
|---|---|
| Strict no fly zone, such as an airport edge | Hold, with a safety margin inside the line |
| Open site, clear route home | Return |
| Obstacles on the return path | Land, or Hold and let the pilot decide |
| Test flights over water | Think hard about Land and Terminate |
The table reflects general practice and the PX4 note about strict zones. It is not a recommendation for your site, so test it.
Why Hold is the documented choice for strict zones
Return flies the vehicle to its home position. If home lies on the far side of the fence, a return can carry the aircraft further through the very zone you wanted to avoid. Hold stops the aircraft where it is, which keeps the breach small. The documentation also says to use a safety margin, so the fence trips before the boundary.
Return mode details
The Return behavior, including return altitude and loiter time, is set in the ground station's return settings. The documentation says defaults usually suffice, but fixed wing vehicles generally need a defined mission landing, and the Return mode page should be read for your vehicle type before you change settings.
Terminate is a last resort
Terminate stops the motors in flight. It is disabled unless a circuit breaker is reset, which tells you how seriously the project treats it. Think of it as a tool for a flyaway near people when no other action is acceptable, and then only after testing and with a clear policy.
Testing
- Simulate a breach before flying the real aircraft.
- Fly a low risk test near the fence, with a pilot ready to take over.
- Verify the return altitude clears obstacles near the fence.
- Check the combination of a geofence breach and a link loss.
- Keep the parameter file, and diff it after updates.
Why this is a security topic
A geofence is a control that software enforces. Changes to the parameters or to the fence file change the behavior of the aircraft, so treat them like any security relevant configuration. Limit who can edit them, keep approved versions in version control and review changes.
Quick check
Is Terminate available by default as a geofence action?
No. The PX4 documentation says Terminate is disabled unless CBRK_FLIGHTTERM is reset.
What does the documentation suggest for strict no fly zones?
Use Hold and a safety margin, according to the PX4 safety configuration page.
Sources
- PX4 User Guide, Safety configuration: geofence actions, return mode notes. The page was truncated at the end in my fetch.
Last reviewed: 19 October 2026.