uploadMission: error Last waypoint index is invalid. -2003
254 0 2023-9-19
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_6PLRACXJPRSl
lvl.1

Italy
Offline

Hi


I am developing app with msdk v4.16 with kotlin. when I try to create a list of waypoints and upload it on the drone I receive this error:

uploadMission: error Last waypoint index is invalid. error code: -2003

this is my codes :

to create the waypoints :

fun createWaypoints(
    pointList: List<Point>,
    height: Double,
    speed: Double
): List<WaypointV2> {

    val waypointList = ArrayList<WaypointV2>()

    for (point in pointList) {
        val waypointV2 = WaypointV2.Builder()
            .setAltitude(height)
            .setCoordinate(LocationCoordinate2D(point.latitude(), point.longitude()))
            .setFlightPathMode(WaypointV2MissionTypes.WaypointV2FlightPathMode.GOTO_POINT_STRAIGHT_LINE_AND_STOP)
            .setHeadingMode(WaypointV2MissionTypes.WaypointV2HeadingMode.MANUAL)
            .setAutoFlightSpeed(speed.toFloat())
            .setMaxFlightSpeed(speed.toFloat())
            .build()

        waypointList.add(waypointV2)
    }

    return waypointList

}


and to config the mission :  

fun
configWaypointMission(waypointList: List<WaypointV2>) {

   
waypointMissionBuilder = WaypointV2Mission.Builder()
        .setMissionID(Random().nextInt(
65535).toLong())
        .setFinishedAction(WaypointV2MissionTypes.MissionFinishedAction.
NO_ACTION)
        .setGotoFirstWaypointMode(WaypointV2MissionTypes.MissionGotoWaypointMode.
SAFELY)
        .setMaxFlightSpeed(
2f)
        .setAutoFlightSpeed(
2f)


   
waypointMissionBuilder.let {
        it?.addwaypoints(waypointList)
   
}
getMissionController().addWaypointEventListener(missionListener())
    Log.i(
TAG, "configWaypointMission:count ${waypointMissionBuilder?.waypointCount}")
    getMissionController().loadMission(WaypointV2Mission.Builder().build())
{
if (it == null) {
            Log.i(
TAG, "configWaypointMission: loadWaypoint succeeded")
            uploadMission()
        }
else {
            Log.i(
TAG, "configWaypointMission: error ${it.description} ${it.errorCode}")
        }
   
}
}  

fun
uploadMission() {

    getMissionController().uploadMission
{
if (it == null) {
            Log.i(
TAG, "uploadMission: success")
        }
else {
            Log.i(
TAG, "uploadMission: error ${it.description} ${it.errorCode}")

        }
   
}
}

in this code, mission is loaded successfully but I cant upload it and I receive that error
I do not know what is the problem please help me

2023-9-19
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules