{"id":10,"date":"2024-04-17T20:00:00","date_gmt":"2024-04-17T12:00:00","guid":{"rendered":"https:\/\/106.14.155.84\/?p=10"},"modified":"2024-04-30T15:23:33","modified_gmt":"2024-04-30T07:23:33","slug":"%e5%a4%a7%e7%96%86v5msdk%e8%88%aa%e7%ba%bf%e4%bb%bb%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/blog.superfyx.top\/?p=10","title":{"rendered":"\u5927\u7586V5MSDK\u822a\u7ebf\u4efb\u52a1"},"content":{"rendered":"\n<p>DJIV5 MSDK \u822a\u7ebf\u4efb\u52a1<\/p>\n\n\n\n<p>\u7248\u672cAndroid MSDK V5.8.0<\/p>\n\n\n\n<p>\u6700\u8fd1\u505a\u5927\u7586\u7684\u6700\u65b0\u7248\u672c\u7684android MSDKV5\u7248\u672c\u6280\u672f\u5f00\u53d1\uff0c\u9996\u9009\u7528\u5b98\u65b9\u4e00\u4e2a\u6559\u7a0b\u53d1\u73b0\u5927\u7586\u7684\u822a\u7ebf\u6267\u884c\u6b63\u5e38\uff0c\u81ea\u5df1\u5f15\u5165\u9879\u76ee\u4e2dM300RTK\u65e0\u4eba\u673a\u6267\u884c\u4efb\u52a1\u6b63\u5e38\uff0c\u4f46\u662f\u5f53\u8bd5\u7528Mavic3T\u65e0\u4eba\u673a\u7684\u65f6\u5019\uff0c\u6267\u884c\u4efb\u52a1\u53d1\u73b0\u822a\u7ebf\u4e0a\u4f20\u6210\u529f\uff0c\u6267\u884c\u4efb\u52a1\u7b49\u5f85\u4e86\u597d\u4e45\u786e\u8fd4\u56de\u5931\u8d25\uff0c\u8fd4\u56de\u201c\u822a\u7ebf\u6307\u4ee4\u8d85\u65f6\u201d\uff0c\u65e5\u5fd7\u5982\u4e0b\u56fe\uff0c\u4e0b\u9762\u4ee3\u7801\u91cc\u5df2\u7ecf\u89e3\u51b3<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"145\" src=\"https:\/\/106.14.155.84\/wp-content\/uploads\/2024\/04\/image-1024x145.png\" alt=\"\" class=\"wp-image-11\" srcset=\"https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/image-1024x145.png 1024w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/image-300x42.png 300w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/image-768x108.png 768w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/image-1536x217.png 1536w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/image.png 1629w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u9996\u9009\u662f\u822a\u7ebf\u4efb\u52a1\u7c7b\uff0c\u8fd9\u91cc\u7f16\u5199\u6700\u7cbe\u7b80\u7684\u4e0a\u4f20\u6267\u884c\u4efb\u52a1\uff0c\u81f3\u4e8e\u822a\u7ebf\u6682\u505c\uff0c\u7ee7\u7eed\u548c\u505c\u6b62\u4efb\u52a1\u529f\u80fd\uff0c\u5927\u5bb6\u6839\u636e\u8fd9\u6bb5\u4ee3\u7801\u81ea\u5df1\u6539\u4e2a\u8c03\u7528\u51fd\u6570\u5c31\u53ef\u4ee5<\/p>\n\n\n\n<pre class=\"wp-block-code has-very-light-gray-to-cyan-bluish-gray-gradient-background has-background\"><code>public class WaypointV3Activity extends AppCompatActivity {\n    private Button open_left, kml_img;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_waypoint_v3);\n\n        initView();\n        \/\/\u65b0\u589e\u76d1\u542c\u673a\u5236\n        addWaypointListener();\n    }\n\n    private String WAYPOINT_FILE_TAG = \".kmz\";\n    String curMissionPath = \"\/storage\/emulated\/0\/KMZ\/\u4ed8\u6d4b\u8bd5\u822a\u7ebf.kmz\";\n    private void initView() {\n        open_left = findViewById(R.id.open_left);\n        kml_img = findViewById(R.id.kml_img);\n        open_left.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                doWaypointTask(\"\/storage\/emulated\/0\/KMZ\/\u4ed8\u6d4b\u8bd5\u822a\u7ebf.kmz\");\n            }\n        });\n        kml_img.setOnClickListener(new View.OnClickListener() {\n            @Override\n            public void onClick(View v) {\n                startWaypoint(\"\/storage\/emulated\/0\/KMZ\/\u4ed8\u6d4b\u8bd5\u822a\u7ebf.kmz\");\n            }\n        });\n    }\n\n    private void doWaypointTask(String kmzFilePath) {\n        if (WaypointMissionManager.getInstance() != null) {\n            WaypointMissionManager.getInstance().pushKMZFileToAircraft(kmzFilePath, new CommonCallbacks.CompletionCallbackWithProgress&lt;Double&gt;() {\n                @Override\n                public void onProgressUpdate(Double aDouble) {\n                    LogUtils.d(\"waypoint\", \"pushKMZFileToAircraft onProgressUpdate\" + aDouble);\n                }\n\n                @Override\n                public void onSuccess() {\n                    showToast(\"pushKMZFileToAircraft Mission Upload Success\" + kmzFilePath);\n                    List&lt;Integer&gt; iDs = WaypointMissionManager.getInstance().getAvailableWaylineIDs(kmzFilePath);\n                    LogUtils.d(\"waypoint\", \"iDs\" + iDs.size() + \",\" + iDs.get(0));\n\/\/                    startWaypoint(kmzFilePath);\n                }\n\n                @Override\n                public void onFailure(@NonNull IDJIError idjiError) {\n                    LogUtils.d(\"waypoint\", \"pushKMZFileToAircraft Mission Upload Failed\" + idjiError.description());\n                }\n            });\n        }\n    }\n\n    private void startWaypoint(String kmzFilePath) {\n        if (WaypointMissionManager.getInstance() != null) {\n            <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\">String fileName = FileUtils.getFileName(curMissionPath, WAYPOINT_FILE_TAG);<\/mark>\n            WaypointMissionManager.getInstance().startMission(fileName, new CommonCallbacks.CompletionCallback() {\n                @Override\n                public void onSuccess() {\n                    showToast(\"\u6210\u529f\u6267\u884c\u822a\u7ebf\u4efb\u52a1\");\n                }\n\n                @Override\n                public void onFailure(@NonNull IDJIError idjiError) {\n                    showToast(\"\u6267\u884c\u822a\u7ebf\u4efb\u52a1\u5931\u8d25\" + idjiError.description() + kmzFilePath);\n                    LogUtils.d(\"WaypointV3\", \"\u6267\u884c\u4efb\u52a1\u5931\u8d25\u8fd4\u56de\" + kmzFilePath + idjiError.description() + \",\" + idjiError.errorCode() + \",\" + idjiError.toString());\n                }\n            });\n        }\n    }\n\n    private void addWaypointListener() {\n        WaypointMissionManager.getInstance().addWaypointMissionExecuteStateListener(waypointMissionExecuteStateListener);\n        WaypointMissionManager.getInstance().addWaylineExecutingInfoListener(waylineExecutingInfoListener);\n        WaypointMissionManager.getInstance().addWaypointActionListener(waypointActionListener);\n    }\n\n    private void clearWaypointListener() {\n        WaypointMissionManager.getInstance().removeWaypointMissionExecuteStateListener(waypointMissionExecuteStateListener);\n        WaypointMissionManager.getInstance().removeWaylineExecutingInfoListener(waylineExecutingInfoListener);\n        WaypointMissionManager.getInstance().removeWaypointActionListener(waypointActionListener);\n        \/\/\u6e05\u7a7a\u6240\u6709waypoint\u76d1\u542c\n        WaypointMissionManager.getInstance().clearAllWaypointMissionExecuteStateListener();\n    }\n\n    @Override\n    protected void onDestroy() {\n        super.onDestroy();\n        clearWaypointListener();\n    }\n\n    private WaypointMissionExecuteStateListener waypointMissionExecuteStateListener = new WaypointMissionExecuteStateListener() {\n        @Override\n        public void onMissionStateUpdate(WaypointMissionExecuteState missionState) {\n            if (WaypointMissionExecuteState.FINISHED == missionState) {\n                showToast(\"Mission Finished\");\n                LogUtils.d(\"WaypointV3\", \"State is:\" + missionState.name());\n            }\n\n            LogUtils.d(\"WaypointV3\", \"State is:\" + missionState.name());\n        }\n    };\n\n    private WaylineExecutingInfoListener waylineExecutingInfoListener = new WaylineExecutingInfoListener() {\n        @Override\n        public void onWaylineExecutingInfoUpdate(WaylineExecutingInfo excutingWaylineInfo) {\n\n            LogUtils.d(\"WaypointV3\", \"Wayline Execute Info WaylineID\" + excutingWaylineInfo.getWaylineID()\n                    + \"WaypointIndex:\" + excutingWaylineInfo.getCurrentWaypointIndex()\n                    + \"MissionName : \" + excutingWaylineInfo.getMissionFileName()\n            );\n\/\/            nextWayPoint = excutingWaylineInfo.getCurrentWaypointIndex();\n        }\n\n        @Override\n        public void onWaylineExecutingInterruptReasonUpdate(IDJIError error) {\n            if (error != null) {\n                LogUtils.e(\"WaypointV3\", \"interrupt error${error.description()}\" + error.description());\n            }\n        }\n    };\n\n    private WaypointActionListener waypointActionListener = new WaypointActionListener() {\n        @Override\n        public void onExecutionStart(int actionId) {\n            LogUtils.e(\"WaypointV3\", \"onExecutionStart\" + actionId);\n        }\n\n        @Override\n        public void onExecutionFinish(int actionId, @Nullable IDJIError error) {\n            LogUtils.e(\"WaypointV3\", \"onExecutionFinish\" + actionId);\n        }\n\n        @Override\n        public void onExecutionStart(int actionGroup, int actionId) {\n            LogUtils.e(\"WaypointV3\", actionGroup + \"onExecutionStart\" + actionId);\n        }\n\n        @Override\n        public void onExecutionFinish(int actionGroup, int actionId, @Nullable IDJIError error) {\n            LogUtils.e(\"WaypointV3\", actionGroup + \"onExecutionFinish\" + actionId);\n        }\n    };\n\n\n    \/**\n     * \u6d88\u606f\u63d0\u793a\n     *\n     * @param message \u5b57\u7b26\u4e32\n     *\/\n    private void showToast(String message) {\n        if (TextUtils.isEmpty(message)) {\n            return;\n        }\n        Toaster.setGravity(Gravity.BOTTOM);\n        Toaster.show(message);\/\/\u89e3\u51b37.1.2\u7248\u672c\u7684Toast\u7cfb\u7edfbug\n    }\n\n}<\/code><\/pre>\n\n\n\n<p>\u4e0a\u9762\u8fd9\u4e2a\u5c31\u662f\u80fd\u591f\u8fd0\u884c\u7684\u4ee3\u7801\u5757\uff0c\u8fd9\u91cc\u53ea\u7f16\u5199MSDK\u7684\u822a\u7ebf\u6267\u884c\u903b\u8f91\u529f\u80fd\uff0c\u5927\u5bb6\u81ea\u5df1\u52a0\u4e2axml\u5e03\u5c40\u6587\u4ef6\u52a0\u4e0a\u90a3\u4e24\u4e2a\u6309\u94ae\u5c31\u53ef\u4ee5\u4e86\u3002\u82e5\u662f\u6709\u4eba\u9700\u8981\u6e90\u7801\uff0c\u53ef\u4ee5\u8054\u7cfb\u6211\uff0c\u6211\u4e5f\u53ef\u4ee5\u628a\u8fd9\u5feb\u4ee3\u7801\u5757\u63d0\u51fa\u6765\u63d0\u4f9b\u7ed9\u4f60\u3002<\/p>\n\n\n\n<p>Tips\uff1a\u524d\u9762\u8bf4\u7684\u5f02\u5e38\u95ee\u9898\u4e3b\u8981\u662f\u56e0\u4e3a\u6211\u4e4b\u524d\u8c03\u7528startWaypoint\u65b9\u6cd5\uff0c\u4f20\u5165\u7684\u662fcurMissionPath\u8fd9\u4e2a\u8def\u5f84\u6ca1\u6709\u63d0\u53d6\u6587\u4ef6\u540d\uff0c\u5bfc\u81f4startMission\u91cc\u4f20\u5165\u7684\u662f\u6587\u4ef6\u8def\u5f84\uff0cM300RTK\u662f\u53ef\u4ee5\u6267\u884c\u822a\u7ebf\u7684\uff0c\u4f46\u662fMavaic3T\u4e0d\u80fd\u6267\u884c\u822a\u7ebf\uff0c\u5f53\u6211\u7528<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">String fileName = FileUtils.getFileName(curMissionPath, WAYPOINT_FILE_TAG);<\/mark>\u8fd9\u4e2a\u65b9\u6cd5\u63d0\u53d6\u51fa\u540d\u5b57\u540e\uff0cMavic3T\u5c31\u80fd\u6b63\u5e38startMission\u4e86\uff0c\u800c\u4e14M300RTK\u4e5f\u80fd\u6b63\u5e38\u6267\u884c\uff0c\u6211\u89c9\u5f97\u8fd9\u7b97\u4e2a\u5c0fbug\u5177\u4f53\u539f\u56e0\u5f97\u95ee\u5927\u7586\u6280\u672f\u5ba2\u670d\uff0c\u6211\u8fd9\u91cc\u7528\u8fd9\u4e2a\u65b9\u6cd5\u89e3\u51b3\u4e86\u95ee\u9898\u3002<\/p>\n\n\n\n<p>\u4e2a\u4eba\u7f51\u7ad9\uff0c\u540e\u7eed\u4f1a\u6839\u636e\u5927\u5bb6\u7684\u9700\u6c42\u5199\u5927\u7586MSDK\u7684\u6280\u672f\u6559\u7a0b\uff0c\u5e0c\u671b\u5927\u5bb6\u559c\u6b22\uff0c\u5982\u679c\u5e2e\u5230\u4f60\u6216\u8005\u4f60\u559c\u6b22\u53ef\u4ee5\u6253\u8d4f\u51e0\u6bdb\u94b1\u4e70\u5976\u7c89\uff0c\u4e00\u5206\u4e0d\u5acc\u5c11\u4e00\u4e07\u4e0d\u5acc\u591a\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" loading=\"lazy\" width=\"828\" height=\"1124\" src=\"https:\/\/106.14.155.84\/wp-content\/uploads\/2024\/04\/290fef7660f61ac87c1fee90767360d.jpg\" alt=\"\" class=\"wp-image-19\" srcset=\"https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/290fef7660f61ac87c1fee90767360d.jpg 828w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/290fef7660f61ac87c1fee90767360d-221x300.jpg 221w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/290fef7660f61ac87c1fee90767360d-754x1024.jpg 754w, https:\/\/blog.superfyx.top\/wp-content\/uploads\/2024\/04\/290fef7660f61ac87c1fee90767360d-768x1043.jpg 768w\" sizes=\"(max-width: 828px) 100vw, 828px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>DJIV5 MSDK \u822a\u7ebf\u4efb\u52a1 \u7248\u672cAndroid MSDK V5.8.0 \u6700\u8fd1\u505a\u5927\u7586\u7684\u6700\u65b0\u7248\u672c\u7684androi [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":[],"categories":[3],"tags":[6,8],"_links":{"self":[{"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/posts\/10"}],"collection":[{"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10"}],"version-history":[{"count":5,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":26,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=\/wp\/v2\/posts\/10\/revisions\/26"}],"wp:attachment":[{"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.superfyx.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}