简体   繁体   English

如何使用 DJI Windows SDK 将航点列表导入无人机

[英]How can I import a list of Waypoints to a Drone by using DJI Windows SDK

I created a Polygon in a GIS application.我在 GIS 应用程序中创建了一个多边形。 I can export the Polygon to a KML or any other required format.我可以将多边形导出为 KML 或任何其他所需的格式。

I need to define a mission's Waypoints for my drone based on the Polygon that I have.我需要根据我拥有的多边形为我的无人机定义任务的航点。

Is there a simple way to directly feed the Polygon missions Waypoints to a Drone without a MapView?有没有一种简单的方法可以在没有 MapView 的情况下将多边形任务航路点直接提供给无人机?

I have to use DJI Windows SDK, but I saw this sample that interacts with the user to define a mission's Waypoints in a MapView.我必须使用 DJI Windows SDK,但我看到这个示例与用户交互以在 MapView 中定义任务的航点。 My scenario is different.我的情况不同。 I already have Waypoints, and I just need to import them.我已经有了航点,我只需要导入它们。

Update 1: Please note that DJI SDK for iOS and Android are very mature, feature-rich and proven tested.更新 1:请注意,适用于 iOS 和 Android 的 DJI SDK 非常成熟、功能丰富且经过验证。 However, it is not the same with DJU Windows SDK.但是,它与 DJU Windows SDK 不同。 The SDK target platform is vague, but reading its example, I think it runs only on UWP platform. SDK 目标平台含糊不清,但阅读其示例,我认为它仅在 UWP 平台上运行。 That is why the question mentions DJI Windows SDK explicitly.这就是问题明确提到DJI Windows SDK 的原因 I know the SDK for Android or iOS provides much higher quality and features.我知道适用于 Android 或 iOS 的 SDK 提供了更高的质量和功能。

You can simply add them to the list using the Latitude and Longitude.您可以简单地使用纬度和经度将它们添加到列表中。 You also need the altitude for each point.您还需要每个点的高度。 Make a for loop for all the points that you need or do this code once, use the config dialog then upload and start the mission.为您需要的所有点创建一个 for 循环或一次执行此代码,使用配置对话框然后上传并开始任务。

// Create a waypoint instance
Waypoint mWaypoint1 = new Waypoint(Latitude, Longitude, altitude);

//check if the mission's builder is null
if (waypointMissionBuilder != null) {
  if (waypointList.size() > 2)
    configWayPointMission();

  waypointList.add(mWaypoint1);
  waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
}
else {
  waypointMissionBuilder = new WaypointMission.Builder();
  waypointList.add(mWaypoint1);
  waypointMissionBuilder.waypointList(waypointList).waypointCount(waypointList.size());
}

So, I haven't used the Windows SDK, but I imagine it is similar to the Mobile SDK.所以,我没有使用 Windows SDK,但我认为它类似于 Mobile SDK。 For mobile, you would just put the waypoints in an array/arraylist and load them into the mission all at once.对于移动设备,您只需将航点放在数组/数组列表中,然后一次性将它们加载到任务中。

I'm not sure if you need to convert the KML into waypoints or if you already have the waypoints.我不确定您是否需要将 KML 转换为航点,或者您是否已经拥有航点。 In the former case, you would need to parse the KML.在前一种情况下,您需要解析 KML。 Assuming you have the waypoints parse, then you need to use WaypointMissionManager and WaypointMissionHandler to load the mission and then start the mission.假设你有航点解析,那么你需要使用WaypointMissionManager和WaypointMissionHandler来加载任务然后开始任务。

You can use the load/upload mission functions.您可以使用加载/上传任务功能。 The paramater of load mission is WaypointMission where you can set the number of waypoints and other related info.加载任务的参数是WaypointMission ,您可以在其中设置航点数量和其他相关信息。

For example in Android, I do the following:例如在 Android 中,我执行以下操作:

    ArrayList<Waypoint> waypoints = new ArrayList<>();
    for(int i = 0; i < wplist.size(); i++) {
        double lat = wplist.get(i).latitude;
        double lon = wplist.get(i).longitude;
        //each dji waypoint corresponds to the predetermined waypoints
        Waypoint djiWaypoint = new Waypoint(lat, lon, altitude);
        //Point Gimbal down for each waypoint
        djiWaypoint.gimbalPitch = gimbalPitchDown;
        //add waypoint to waypoints array
        waypoints.add(djiWaypoint);
    }

    //initiate builder and add waypoints to it- not yet built
    waypointMissionBuilder = new WaypointMission.Builder();
    waypointMissionBuilder.waypointList(waypoints).waypointCount(waypoints.size());
    totalNumberOfWaypointsInMission = waypointMissionBuilder.getWaypointCount();

    //Prepare mission by updating configure and instantiate waypointMissionBuilder
    configWayPointMission();
    //upload Mission
    uploadWaypointMission();

暂无
暂无

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

相关问题 我可以使用DJI Drone模拟器测试Windows 10应用程序的DJI SDK,而不必运行真正的DJI Drone吗? - Can I test my DJI SDK for Windows 10 application with a DJI Drone simulator without the risk of running a real DJI Drone? 如何使用 DJI Android SDK 为 DJI 无人机获取正确的当前视频设置 - How to get correct current video settings for DJI Drone using DJI Android SDK 大疆MSDK与经纬M300无人机如何获取绝对高度值(ASL) - How can I obtain Absolute Altitude Value (ASL) using DJI MSDK and M300 drone DJI无人机位置-移动SDK - DJI drone location - Mobile SDK 我们可以在不连接无人机(实际设备)的情况下使用应用程序测试 Dji Sdk 吗?? 通过任何其他方式的虚拟设备或使用 PC 模拟器 - Can we test Dji Sdk with app without connecting to Drone (Actual Device)?? By any other means of virtual Device or using PC Simulator 如何使用 DJI SDK for Windows 从 mavic 2 获取 GPS 数据? - How to get gps data from mavic 2 using DJI SDK for Windows? 使用 DJI SDK for Windows 在本地保存图像 - Save Images locally using DJI SDK for Windows 使用 DJI Android SDK LiveStreamManager 到 stream 无人机摄像机直播有很大的延迟。 使用 SampleCode 它没有,我错过了什么? - Using DJI Android SDK LiveStreamManager to stream drone camera live has a huge delay. Using the SampleCode it doesn't, what am I missing? 发布Dji Windows SDK - Release of Dji Windows SDK 如何使用DJI mobile sdk连接DJI产品 - How to connect DJI product using DJI mobile sdk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM