Does RTL cross geofences?

I’ve been looking to make use of the polygonal geofence added to 3.4, but before I do, I’d like to understand how the RTL mode interacts with geofences. The potential for complex shapes for polygonal fences means there could be situations where an RTL is issued, but a straight path back to home would cross geofence boundaries. What is the expected behavior in this case, and has anyone tested it?

RTL will take the shortest straight-line distance back to home. There’s currently no checks for if that path would cross the geofence.

So if the geofence was in the way of the copter and the home point, the copter would keep going until it crossed the geofence and went into failsafe.

You could use rally points (http://ardupilot.org/copter/docs/common-rally-points.html), where the copter would RTL to the nearest rally point instead of heading all the way home.

Great, thanks for the info. The rally points is a good idea.

Great, thanks for the info. The rally points is a good idea.

You can also use the “do_land_start” technique we used at the OBC 2016.

Crossing the geofence boundary in that competition leads to (or, at least
, should lead to) the aircraft terminating its existence as a flying
object. Thus, if we had to RTL the aircraft, or some sort of failsafe
occured, we sprinkled DO_LAND_STARTs throughout the code to ensure a
reasonable path was followed.

The Heli’s mission is here:
https://github.com/CanberraUAV/cuav/blob/master/script/OBC2016/mission-heli.txt

You can also use the “do_land_start” technique we used at the OBC 2016.

Looks like Copter doesn’t support DO_LAND_START, did you add that function to your firmware, or were you using Plane (or am I wrong)?

It looks like an ideal solution for my application, though; being able to follow a known safe route upon an RTL command at any time is just what I was hoping for.

Looks like Copter doesn’t support DO_LAND_START, did you add that function
to your firmware, or were you using Plane (or am I wrong)?

We used both Plane and Copter in the OBC, and both had the functionality
:slight_smile:

My apologies, but the code for DO_LAND_START for Copter is not in
mainline.

It is in one of tridge’s branches:

specifically

It looks like an ideal solution for my application, though; being able to
follow a known safe route upon an RTL command at any time is just what I was
hoping for.

Maybe we could get that in for Copter 2.6? If you could test that patch
separately to all of the other stuff in tridge’s branch it stands more of
a chance of getting in :slight_smile:

No! We aren’t going back to version 2 :laughing:

By the way, the PR for adding this is open: https://github.com/ArduPilot/ardupilot/pull/4723 It just haven’t made it to master yet.

It is in one of tridge’s branches:

Great, thanks for the links. We’ll definitely look into it and hopefully report back with positive results.