Backbone of drone containment

Setting up geofencing is not just turning on one parameter.

It is more like building a digital safety cage around the aircraft.

In this page I will be going through the basic intuition of how geofencing works, how DJI drones handle this through their GPS / GEO pipeline, and how to actually set it up in ArduPilot using FENCE_ parameters.

— Alexi


What geofencing setup is actually doing

A geofence is basically asking the drone three questions again and again:

  1. Where am I?

    The drone needs position from GNSS / RTK, altitude from barometer or fused sensors, attitude from IMU, heading from compass, and a filtered state estimate from the flight controller.

  2. Where am I allowed to be?

    This is the fence itself: a circle, polygon, altitude ceiling, exclusion zone, or manufacturer GEO zone.

  3. What should I do if I reach the boundary?

    This can be warning the pilot, stopping, braking, returning home, landing, or blocking takeoff.

Think of it like this:

A physical test cage stops a robot from leaving the lab.

A geofence is the flight-controller version of that cage. It does not physically touch the drone, but it watches the drone’s position and forces a behavior when the aircraft gets too close to the limit.

For small drones, this can be a useful training feature.

For heavy drones, it becomes part of the safety case.

The important point:

The fence is only as good as the position estimate and the failsafe action behind it.

If GPS is bad, the drone may not know where the fence is.

If RTL is badly configured, the drone may respond to a fence breach in a way that creates a different problem.