简体   繁体   English

带有pymavlink或dronekit-python的Geofence

[英]Geofence with pymavlink or dronekit-python

I'm trying to set fence for the copter using dronekit-python.I found command MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION in this document . 我正在尝试使用dronekit-python为直升机设置围栏。我在本文档中找到了命令MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION

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). 但是,当我使用它不工作vehicle.message_factory.command_long_send (这是功能command_long_send类MAVLink从实际文件ardupilotmega.py),我找不到mavutil.mavlink.MAV_CMD_NAV_FENCE_CIRCLE_INCLUSION或者(所以我直接使用整数5003) 。

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? 阅读ardupilotmega.py的源代码后,我发现有一个名为fence_point_send的函数,所以有人可以告诉我如何使用它吗? How can I set the geofence just like what Misson Planner do with python? 如何像Misson Planner使用python一样设置地理围栏?

You should use this command MAV_CMD_DO_FENCE_ENABLE to enable or disable geo-fence. 您应该使用此命令MAV_CMD_DO_FENCE_ENABLE启用或禁用地理围栏。 geo-fence has two parameters. 地理围栏有两个参数。

  1. FENCE_ALT_MAX: The maximum altitude that the vehicle can reach. FENCE_ALT_MAX:车辆可以达到的最大高度。
  2. FENCE_RADIUS : The maximum circle radius the vehicle can move in. FENCE_RADIUS:车辆可以移动的最大圆半径。

To change the parameters in code, you should use a function like PARAM_SET and pass the name and value for the parameter. 要更改代码中的参数,应使用PARAM_SET之类的函数,并传递参数的名称和值。

PS: You can do all that using GCS like Mission Planner, APM Planner2 or Mavproxy. PS:您可以使用GCS来完成所有任务,例如Mission Planner,APM Planner2或Mavproxy。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM