Failed to send fence point 5 mavproxy.py

Hello all,

I am trying to upload fence polygon using mavproxy.py

my experiment setup is the following:

  1. Open SITL with the rover, fences enabled, Object avoidance is Dijkstra and avoid enable = 0
  2. run mavproxy.py
  3. connect with TCP 127.0.0.1:5762
  4. write "fence load “\path\to\fence.poly”

after step 4, I’m always getting this issue:

MANUAL> fence load "D:\fence.poly"
Loaded 6 geo-fence points from "D:\fence.poly"
Failed to send fence point 5
MANUAL>

I get the “.poly” file by drawing a polygon and clicking save polygon button. when i check the fence.poly the input is the following:

#saved by Mission Planner 1.3.76
35.6351466868017 34.5220202207565
35.635403920251 34.5253139734268
35.634490514543 34.5254909992218
35.6335771088351 34.5256680250168
35.6332021495376 34.5220953226089
35.6343488218537 34.5220148563385
35.6351466868017 34.5220202207565

to debug what is going on, i played a little bit and checked the source code. i printed what is happening and what causes this issue.

MANUAL> fence load "D:\fence.poly"
Loaded 7 geo-fence points from "D:\fence.poly"
----------------------------
p.lat:  35.6351466868017
p2.lat:  35.63540267944336
p.lng:  34.5220202207565
p2.lng:  34.52531433105469
Failed to send fence point 6

I tried erasing the last point. because the last point is basically the duplicate of the first point. it didn’t work either.

Any suggestions on that?

Thanks

First location is return location inside the polygon (good idea to calculate the center and set it with it).
This is not implemented in Copter AFAIK but it must be set anyway.
In Plane there is a parameter about it.
So, the below will work.

#saved by Mission Planner 1.3.76
35.63432153 34.52380485
35.6351466868017 34.5220202207565
35.635403920251 34.5253139734268
35.634490514543 34.5254909992218
35.6335771088351 34.5256680250168
35.6332021495376 34.5220953226089
35.6343488218537 34.5220148563385
35.6351466868017 34.5220202207565

BTW, return location can be also located outside of the polygon but not implemented in Copter (AFAIK) so just set it with something inside polygon.

1 Like

Thank you so much, adding the center solved the issue.

1 Like