Geofence on pixhawk

Three questions regarding geofence function in PixHawk:

  1. Is there any geofence function?
  2. Is it circle type or polygon type geofence?
  3. What’s the behavior for a quad-cotper if it violate the geofence?

Yes, there’s a geofence of both types, but only the simple circle type (plus ceiling) is visible in the QGC settings. You can still do the polygon, but it requires putting the coordinates in a txt file on the sdcard.

During violation you have the option of triggering RTL (fly home), loiter (pause), flight terminate, or just a warning.
https://pixhawk.org/firmware/parameters#geofence

Considering addition of custom hardware to px4 via I2C how can I enforce Polygon fence on px4 through the external hardware? where do i get the list commands required for it?