Auto Landing flies out of Geofence

A beautiful mission at my local field ended in disaster when the auto landing seemed to ignore the geofence I had set up and flew directly into a real fence that was outside geofence I had set up.
See the linked YouTube video starting at 18:00 to see the problem.
[Landing in Geofence Exclusion zone 2021 12 17 at 3 41 15 PM - YouTube]

You can see the geofence on Mission Planner, It is set to the restrictions that apply at this field, some are for safety and some are real obstacles. On my first mission, the plane flew into the trees that surround the field, which is why I set the geofence so (I thought) the plane would not fly into the trees or the fences around the field.

The log is for two flights, both flying the same mission. The second one is is where the crash happens. It shows that the plane went into auto land mode, and had started to flare when it hid the fence. It would have been lined up for a pretty perfect landing if wasn’t for the obstacle. This is on my Bixler 2 with a PixRacer R15 with ArduPlane 4.1.2.

The log is on Logfile Drobbox link

Why did this happen? Why would Arduplane fly out of the Geofenced area?

as I replied on the facebook post, the ArduPilot plane fence support is a “detection fence” only, not an “avoidance fence”. That means it will detect if you breach the fence, and take the action you specify in the fence parameters, but it will not do any sort of planning to avoid the fence. The flight plan to ensure it avoids the fence is up to the person planning the mission.

Thanks @tridge, so I had set (I think) RTH for breach action and a rally point that was in the middle of the field. It seems like this didn’t fire while it was landing. Was there something I needed to do to make this fire?

Apologies - it seems this is an RTFM, I guess setting up the fence wasn’t enough, I also needed to ENABLE_FENCE. Perhaps this option could be on the FENCE screen in Mission Planner? After setting all the options on the FENCE page in Plan, I really did think that was all I needed to do.

So I’ve set up a geofence around the field, enabled it with FENCE_ENABLE and simulated it with SITL. The plane keeps flying out of bounds, mostly because it often doesn’t turn in the direction I would expect at a waypoint, so it does a circle around that takes it out of bounds.
Is there a way go get the plane to turn in a certain direction at a waypoint?

Hi @tridge - so I just flew my Bixinator with the geofence enabled and it does work, but the plane continues to fly into the geofence (now triggering RTL) when it could avoid it. I just found out about “Bendy Ruler” avoidance algorithm which is in Rover and Copter. What would it take to put this in Plane?

BTW - this is all about my goal to be able to try the Aerobatics scripts, but I need to be able to fly autonomously around my field first before I try that.

I’ve been doing some more testing on the GeoFence and had this interesting flight yesterday where the plane flew out of bounds several times but failed to failsafe (which should have been fly back to a breach point). Instead I just get this:

2022-01-22 16:51:26.049 Error: Subsys FAILSAFE_FENCE ECode 4 
2022-01-22 16:51:26.369 Error: Subsys FAILSAFE_FENCE ECode 0 
2022-01-22 16:51:26.689 Error: Subsys FAILSAFE_FENCE ECode 0 
2022-01-22 16:51:27.012 Error: Subsys FAILSAFE_FENCE ECode 0 
2022-01-22 16:51:27.334 Error: Subsys FAILSAFE_FENCE ECode 0 

But I can’t find out what this means. I think ECode 4 is “UNHEALTHY” but I’m not really clear what is unhealthy. The log is here: Dropbox - 2022-01-23 Bixinator 02.BIN - Simplify your life

Can anyone tell me what I’m doing wrong?

I tried this with master from about a week ago (so 4.2 from about 24 Feb). No geofence action at all. Geofence autoenable - shows in the log it gets enabled after takeoff. This is on a PixHawk 1-1M in a Bixler.

The GeoFence seems to have been ignored completely.

New information - I discovered that the FENCE_ACTION had been set to 4. This is not a valid value for a plane. It is a valid value for a Copter (4 = Brake or Land). This flight controller had previously been used in a copter - is it possible this parameter was not reset when I switched to Plane? I thought all parameters were reset when the vehicle type was changed?