dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
290 stars 147 forks source link

Start mission failed: Waypoint number should be within 2 to 65535 #435

Open otoo-peacemaker opened 1 month ago

otoo-peacemaker commented 1 month ago

I have been able to create a kmz file, pushed and upload is successfully but mission cannot start.

main err: Start mission failed: Failed to execute flight route. Waypoint number error. Waypoint number should be within 2 to 65535 device: mavic 3 enterprise simulator: DJI Assistant 2 (Enterprise) Log info:

CreateFromKmlFile : 1
kmzFilePath : /storage/emulated/0/Android/data/mypackagename/files/DJI/waypoint/generate_test.kmz
Save Kmz Success Path is : /storage/emulated/0/Android/data/mypackagename/files/DJI/waypoint/generate_test.kmz
::waypointFile
 /storage/emulated/0/Android/data/mypackagename/files/DJI/waypoint/generate_test.kmz
State is UPLOADING
Upload State: progress:90.0 
Upload State: progress:90.0 
Upload State: progress:100.0 
Upload State: progress:100.0 
Mission Upload Success
State is READY
Mission Upload Success
::waylineIds 0
Start mission failed: Failed to execute flight route. Waypoint number error. Waypoint number should be within 2 to 65535

this is how I created the kmz file

    private fun createWaylineTemplateObject() {
        val distance = 3.0f
        val missionInfoModel = MissionInfoModel()
        missionInfoModel.distance = distance
        val kmzOutPath = rootDir + "generate_test.kmz"
        //create wayline mission
        val waylineMission: WaylineMission = createWaylineMission(missionInfoModel)
        val missionConfig: WaylineMissionConfig = KMZTestUtil.createMissionConfig()
        //create and generate KMZ file
        println("inside::${infoModelArrayList[0].waylineWaypoint.location}")
        val template: Template = KMZTestUtil.createTemplate(infoModelArrayList)
        WPMZManager.getInstance().generateKMZFile(kmzOutPath, waylineMission, missionConfig, template)
        curMissionPath = kmzOutPath
        wayPointV3VM.setCurrentPath(curMissionPath)
        println("Save Kmz Success Path is : $kmzOutPath")
    }

onstart mission button clicked


btnFly.setOnClickListener {
                createWaylineTemplateObject()
                val waypointFile = File(curMissionPath)
                println("::waypointFile\n $waypointFile")
                val waylineIds = wayPointV3VM.getAvailableWaylineIDs(curMissionPath).last()
                println("::waylineIds $waylineIds")
                selectWaylines.add(waylineIds)
                if (waypointFile.exists()) {
                    wayPointV3VM.pushKMZFileToAircraft(curMissionPath)
                } else {
                   println("Mission file not found!")
                    return@setOnClickListener
                }
                //: Delay for 10 seconds
                Handler(Looper.getMainLooper()).postDelayed({

                    wayPointV3VM.startMission(
                        FileUtils.getFileName(curMissionPath, WAYPOINT_FILE_TAG),
                        selectWaylines,
                        object : CommonCallbacks.CompletionCallback {
                            override fun onSuccess() {
                                println("Start mission success")
                            }
                            override fun onFailure(error: IDJIError) {
                                println("Start mission failed: ${getErrorMsg(error)}")
                            }
                        }
                    )
                }, 10000)  // 10-second delay
            }
dji-dev commented 1 month ago

Agent comment from yating.liao in Zendesk ticket #119816:

This error indicates that the waypoint index has not been set or is out of range. Could you please send us the contents of waylines.wpml for analysis?

°°°