1

I'm trying to set fence for the copter using dronekit-python.I found command MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION in this document.

But it doesn't work when I use the vehicle.message_factory.command_long_send (which is the function command_long_send in class MAVLink from the file ardupilotmega.py actually ), I cannot find mavutil.mavlink.MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION either (so I use integer 5003 directly).

After reading the source code of ardupilotmega.py, I found that there is a function called fence_point_send, so can anyone tell me how to use it? How can I set the geofence just like what Misson Planner do with python?

Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
whxru
  • 11
  • 3

1 Answers1

0

You should use this command MAV_CMD_DO_FENCE_ENABLE to enable or disable geo-fence. geo-fence has two parameters.

  1. FENCE_ALT_MAX: The maximum altitude that the vehicle can reach.
  2. FENCE_RADIUS : The maximum circle radius the vehicle can move in.

To change the parameters in code, you should use a function like PARAM_SET and pass the name and value for the parameter.

P.S: You can do all that using GCS like Mission Planner, APM Planner2 or Mavproxy.

Soubhi M. Hadri
  • 133
  • 1
  • 15