Unable to Upload File to FlightPlanItf (iOS)

I am attempting to upload a flight plan file to the FlightPlanItf on iOS in a nearly identical way as I am able to do successfully on Android, but it’s not working. Here’s an example of the flight plan:

QGC WPL 120
0 1 3 22 0.00000 0.00000 0.00000 0.00000 42.54480 -83.11800 0.00000 1
1 0 3 16 0.00000 0.00000 0.00000 0.00000 42.54480 -83.11800 0.00000 1
2 0 3 16 0.00000 0.00000 0.00000 42.54535 -83.11851 0.00000 0.00000 1
3 0 2 2000 1.00000 1.00000 12.00000 0.00000 0.00000 0.00000 0.00000 1
4 0 2 93 10.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
5 0 2 2001 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
6 0 3 16 0.00000 0.00000 0.00000 42.54507 -83.11823 0.00000 0.00000 1
7 0 2 2000 1.00000 1.00000 12.00000 0.00000 0.00000 0.00000 0.00000 1
8 0 2 93 10.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
9 0 2 2001 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
10 0 3 16 0.00000 0.00000 0.00000 42.54535 -83.11823 0.00000 0.00000 1
11 0 2 2000 1.00000 1.00000 12.00000 0.00000 0.00000 0.00000 0.00000 1
12 0 2 93 10.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
13 0 2 2001 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
14 0 3 16 0.00000 0.00000 0.00000 42.54535 -83.11796 0.00000 0.00000 1
15 0 2 2000 1.00000 1.00000 12.00000 0.00000 0.00000 0.00000 0.00000 1
16 0 2 93 10.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
17 0 2 2001 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
18 0 3 16 0.00000 0.00000 0.00000 42.54507 -83.11796 0.00000 0.00000 1
19 0 2 2000 1.00000 1.00000 12.00000 0.00000 0.00000 0.00000 0.00000 1
20 0 2 93 10.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
21 0 2 2001 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1
22 0 3 16 0.00000 0.00000 0.00000 0.00000 42.54480 -83.11800 0.00000 1
23 0 3 21 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1

I am writing the file with:

    if let dir = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
        let path = dir.appendingPathComponent("mission.mavlink")
        do {
            try missionString.write(to: path, atomically: true, encoding: .utf8)

            return path.absoluteString
        } catch {
            // Handle error
        }
    }

I have observed that writing this file is successful; however when passing path.absoluteString to the Itf’s uploadFlightPlan() the state changes to uploading and never reached uploaded, so the interface never goes into the idle state.

I’ve tried passing the path both with and without the file:// prefix. Is there anything I am clearly doing wrong? Any help would be greatly appreciated!

-Nick

Hi,

The expected path for the uploadFlightPlan function is a local path, i.e. without the file:// prefix. You can use path instead of absoluteString to obtain it.
Otherwise, I can’t see the issue : your Mavlink file seems OK, as well as your code.
Have you checked whether you could upload your Mavlink file with GroundSdkDemo?

Regards,
Thibaut

I’ve tried sending the path without the file:// prefix as well without any luck. I haven’t tried with GroundSdkDemo, can you provide a link?

https://developer.parrot.com/docs/groundsdk-ios/installcocoapods.html#install-the-groundsdk-demo-app-and-pods

In the sample app, the file uploads successfully but does not execute properly. Here is a video of what it is doing: https://imgur.com/a/kvHoFNt

The drone moves forward a few feet then back, and stops. Then the piloting interface goes idle.

Update; I have been able to get the mission to upload in my implementation (I was not using the Ref properly). But the same behavior persists with the mission file, where the drone just moves forward then back again.

Success! The problem was a bug in the way the altitude target was being injected into the flight file (resulting in them all being zero, which the drone couldn’t understand), alongside some indexing issues.

1 Like