Servers by jDrones

Clearing a polygon fence?

Sorry if I missed this in the docs, but how do I clear a polygon fence? Also, according to the docs LOITER is the only mode that will “stop” at the fence. Does that mean that all other modes, including POSHOLD will use the selected “Action” on the geofence page? It would be nice if in addition to RTL and Land, “Stop” would be an option, and that POSHOLD and LOITER were treated the same for polygon fences.

Rich

Hi Rich,

I think that in Mission Planner there isn’t an easy way to clear the polygon fence, but you can just disable it. MAVProxy has a command to remove points and a command to clear the fence (you can emulate this last command in MP by setting FENCE_TOTAL to 0).

Regarding stopping at the fence, can you link to where you have read that it only works in Loiter? Fence has two possible actions for when it is breached: RTL or Land. Besides that you can activate an option (AVOID_ENABLE) to try to stop the vehicle before the fence is breached - and as far as I’m aware it works the same for Loiter and PosHold.

I played around with it a little and remember being able to display and edit each of the poly fence waypoints. I was able to delete or create individual points in an existing polygon. Saying that, you should be able to delete each point to clear the fence.

Thanks Francisco,

My assumption was based on the following from this page: http://ardupilot.org/copter/docs/polygon_fence.html

“The purpose of this fence is to attempt to stop your vehicle from flying out of the polygon by initiating an RTL or, if flying in Loiter mode, the vehicle will normally stop before breaching the fence.”

It makes no mention of POSHOLD, so I assumed that only LOITER was supported.

Ralph, I will give that a try. It would be nice if Mission Planner had an option to clear the current fence. It sounds to me like both your suggestion and Francisco’s are basically work a-rounds for accomplishing the same thing.

If you use QGroundControl daily builds click the Sync button (One with circular arrows) and select Remove All. Then send to the vehicle. Use the same thing to clear Rally Points.

As for me, option to set fence on/of via RC channel, (say as option for Ch6) also would be great.

Hi Rich,

I would say that that page probably doesn’t have a very accurate text.

Regarding the clearing: the reason this isn’t a wide available option is that you can just disable the polygon fence. What is the point of having it enabled if you don’t have points? It will actually waste more resources to have it enabled without points than to have it disabled it with points.

Francisco,

When I hit the polygon fence in POSHOLD, it performed an RTL. I will add LOITER to my configuration and verify that it works as expected in that mode. I disagree on clearing the polygon fence. I think it would be appropriate that if no fence exists and avoid_enable is ON, that the command be ignored - and avoid_enable turned off for the duration of the flight. From a safety perspective, I would want to know that a fence could not be activated accidentally and have unexpected consequences with the aircraft. If I have deliberately deleted the fence then I know that it can’t be enabled. I am curious as to what would happen if avoid_enable was activated when the aircraft is already out of the fence.

Hi Rich,

Ok, let us know when you have tested Loiter. I might be wrong but from the quick overlook I had at the code it looked like PosHold would get the same behavior at the fence.

Regarding clearance: as I said before, you can just disable the fence. There is no way for it to turn on unless commanded by you. Also, avoid is separate from the fence, I’m not sure if that is clear to you. It will avoid the fence if both are on, but they are separate behaviors.

If the fence is off, nothing would happen, there’s nothing to avoid. If the fence is on, you have breached the fence so your fence action would happen (RTL or Land).

Francisco,

I have confirmed that in POSHOLD mode, an RTL is initiated. In LOITER, the fence works as expected.

Understood about the difference between fence and avoid. I will fly with “Altitude an Circle” instead of “All” so that the polygon fence is ignored, and set the fence to something I can live with if it is accidentally turned on.

If Avoid is turned on and Action is set to “Report Only”, will the aircraft stop at the altitude and radius defined in GeoFence? This would be more useful for me than an RTL in most cases. I would prefer an altitude “avoid” and a radius RTL. Altitude avoid keeps my out of trouble, in a radius RTL likely something unusual has happended and the craft really does need to return.

To me, “Avoid” should be an option in addition to “RTL or Land” and “Report Only”. I don’t see a scenario where you would RTL and Avoid, but do see “Report Only” and Avoid.

Thanks,

Rich

One thing I meant to mention… If your outside the poly fence I believe you can not arm (which thinking about it makes sense). It did, however, catch me by surprise until I saw a pre check Breach Fence status message from MP. Just have to remember to disable the fence to arm and fly outside the fence.

A couple of answers:

  1. we don’t currently support stopping at the fence in PosHold. In case it matters, the reason is that it’s quite a bit trickier than in Loiter mode. In PosHold mode the pilot has full control over the vehicle lean angle so it’s much more like AltHold. Stopping at the polygon fence shares a lot of code with object avoidance so hopefully after we get object avoidance working for manual modes (it already works for Loiter) we can extend it to also cover the fence. The only thing is that it will probably still be possible for a determined user to go outside the fence if he/she gives full stick input… or maybe it will be configurable … not totally sure just thinking about what’s safest.
  2. I added a to-do item for Michael Oborne requesting some improvements to the MP’s fence interface. Feel free to ping him on the issue here: https://github.com/ArduPilot/MissionPlanner/issues/1308

Thanks for the reports!

Hi Rich,

It will try to avoid the fence, but, if for some reason you break the fence (not common but it can happen), it won’t return back, which why the option for RTL is there.

Thanks Randy. I fly 99% of the time in PosHold, as I really enjoy the “feel” of the aircraft in this mode.

I am excited about the fence capability, thanks for your work on that. I plan on experimenting with a fence that would allow for tower inspection, keeping the aircraft a specified distance from the tower, but also between the guy wires, sort of a modified triangle <| The nice thing about the current implementation in MP is the ability to pre-define fences and load them. Any possibility of adding a switch to turn fence on/off, or build a fence around an object - fencing something “out” instead of in? Think water tower inspection.

Rich

Old thread I know but having just come across it with the same question I have also worked out a solution. Go onto the mission or fence, clear the mission or fence and then hit write. Job’s a goodun!

Servers by jDrones