dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
282 stars 145 forks source link

Seeking Guidance on Implementing Waypoint Mission with Custom App Using DJI SDK #182

Closed ghost closed 1 year ago

ghost commented 1 year ago

I am currently in the process of developing an Android application that allows a user to select waypoints on the app interface. The chosen waypoints are then transmitted to a DJI drone, which autonomously carries out a mission following the specified route. I am a beginner when it comes to drone-related app development and am using the v5 sample code as my primary point of reference. Any guidance would be greatly appreciated.

I've succeeded in generating a KMZ file containing the waypoints and am able to upload this KMZ file to the drone. However, I am facing some challenges:

  1. I was initially unable to include any waylineIds in the selectWaylines ArrayList. I have since implemented a function to extract them.
  2. The documentation indicates that only KMZ files can be accepted for waypoint missions, and I've written code to generate this file accordingly.

* Code Snippets

* Starting the Mission and Uploading KMZ File

btn_mission_start.setOnClickListener {
    // Step 1: Generate KMZ File
    val kmzOutPath = convertToSDKFormat(showWaypoints, rootDir)
    curMissionPath = kmzOutPath

    // Step 2: Upload KMZ File
    uploadKMZFileToDrone(kmzOutPath) { uploadSuccess ->
        selectWaylines = extractWaylineIDs(kmzOutPath)
        if (uploadSuccess) {
            wayPointV3VM.startMission(
                FileUtils.getFileName(curMissionPath, WAYPOINT_FILE_TAG),
                selectWaylines,
                object : CommonCallbacks.CompletionCallback {
                    override fun onSuccess() {
                        ToastUtils.showToast("startMission Success")
                    }
                    override fun onFailure(error: IDJIError) {
                        ToastUtils.showToast("startMission Failed")
                    }
                }
            )
        } else {
            ToastUtils.showToast("Failed to upload KMZ file")
        }
    }
}

* Extracting Wayline IDs

fun extractWaylineIDs(kmzFilePath: String): ArrayList<Int> {
    val waylineIDs = ArrayList<Int>()
    // ... (your code for extracting wayline IDs)
    return waylineIDs
}

* Generating KMZ File

fun convertToSDKFormat(showWaypoints: ArrayList<WaypointInfoModel>, rootDir: String): String {
    val kmzOutPath = "$rootDir/generate_waypoint_file.kmz"
    // ... (your code for generating the KMZ file)
    return kmzOutPath
}

Questions

  1. Is my approach to extracting waylineIds accurate and efficient?
  2. Are there alternative methods to transmitting waypoints to the drone, or is using a KMZ file the only viable option as per the current SDK?
  3. Could anyone provide insights on best practices when implementing such waypoint missions?

Thank you in advance for your assistance!

dji-dev commented 1 year ago

Agent comment from Hummels Lei in Zendesk ticket #92855:

I would like to provide you with some information regarding your inquiries.

  1. To obtain WaylineIDs, I suggest utilizing the getAvailableWaylineIDs method.
  2. May I kindly inquire about the type of aircraft you are utilizing? With the exception of the M300, the only available option for performing a waypoint mission is by uploading kmz files.
  3. I highly recommend referring to our sample code, as it offers a relatively comprehensive guide.

    °°°

ghost commented 1 year ago

Agent comment from Hummels Lei in Zendesk ticket #92855:I would like to provide you with some information regarding your inquiries.

  1. To obtain WaylineIDs, I suggest utilizing the getAvailableWaylineIDs method.
  2. May I kindly inquire about the type of aircraft you are utilizing? With the exception of the M300, the only available option for performing a waypoint mission is by uploading kmz files.
  3. I highly recommend referring to our sample code, as it offers a relatively comprehensive guide. °°°

Thank you for your reply! I am now currently aiming to make the waypoint mission function for the Matrice 300 RTK

I found out that even when i get the waypoint id it still goes to ToastUtils.showToast("startMission Failed") I can seem to be able to find the origin of the error or what is going wrong, I am planning on making the waypoint mission function work with these drones DJI Mini3 Pro DJI Mini3 Mavic 3 Enterprise Series M30 Series M300 RTK Matrice 350 RTK

IakovlevAA commented 6 months ago

Agent comment from Hummels Lei in Zendesk ticket #92855:I would like to provide you with some information regarding your inquiries.

  1. To obtain WaylineIDs, I suggest utilizing the getAvailableWaylineIDs method.
  2. May I kindly inquire about the type of aircraft you are utilizing? With the exception of the M300, the only available option for performing a waypoint mission is by uploading kmz files.
  3. I highly recommend referring to our sample code, as it offers a relatively comprehensive guide. °°°

Thank you for your reply! I am now currently aiming to make the waypoint mission function for the Matrice 300 RTK

I found out that even when i get the waypoint id it still goes to ToastUtils.showToast("startMission Failed") I can seem to be able to find the origin of the error or what is going wrong, I am planning on making the waypoint mission function work with these drones DJI Mini3 Pro DJI Mini3 Mavic 3 Enterprise Series M30 Series M300 RTK Matrice 350 RTK

Agent comment from Hummels Lei in Zendesk ticket #92855:I would like to provide you with some information regarding your inquiries.

  1. To obtain WaylineIDs, I suggest utilizing the getAvailableWaylineIDs method.
  2. May I kindly inquire about the type of aircraft you are utilizing? With the exception of the M300, the only available option for performing a waypoint mission is by uploading kmz files.
  3. I highly recommend referring to our sample code, as it offers a relatively comprehensive guide. °°°

Thank you for your reply! I am now currently aiming to make the waypoint mission function for the Matrice 300 RTK

I found out that even when i get the waypoint id it still goes to ToastUtils.showToast("startMission Failed") I can seem to be able to find the origin of the error or what is going wrong, I am planning on making the waypoint mission function work with these drones DJI Mini3 Pro DJI Mini3 Mavic 3 Enterprise Series M30 Series M300 RTK Matrice 350 RTK

Agent comment from Hummels Lei in Zendesk ticket #92855:I would like to provide you with some information regarding your inquiries.

  1. To obtain WaylineIDs, I suggest utilizing the getAvailableWaylineIDs method.
  2. May I kindly inquire about the type of aircraft you are utilizing? With the exception of the M300, the only available option for performing a waypoint mission is by uploading kmz files.
  3. I highly recommend referring to our sample code, as it offers a relatively comprehensive guide. °°°

Thank you for your reply! I am now currently aiming to make the waypoint mission function for the Matrice 300 RTK

I found out that even when i get the waypoint id it still goes to ToastUtils.showToast("startMission Failed") I can seem to be able to find the origin of the error or what is going wrong, I am planning on making the waypoint mission function work with these drones DJI Mini3 Pro DJI Mini3 Mavic 3 Enterprise Series M30 Series M300 RTK Matrice 350 RTK

Hi! Did you manage to run Waypoint Mission on mini3 pro?