Does MAVSDK-Swift support mavlink2? How to set ip address?

Hello. I would like to know if MAVSDK-Swift supports mavlink2. I could not find it in documentation.

We try to work with drone’s PX4 flight controller (which supports Mavlink2) via MAVSDK-Swift and it does not work. We also have an Android app with source code (based on dronefleet mavlink) which works well with the drone.

Could you please also help, how to properly confidure address in SDK?

We have a drone with a Wi-Fi point (esp) and its address is

We tried various cases how to connect, the last one is:

let port = “udp://”)
drone = Drone(port: Int32(port))

Are there any mistakes in this type of connection configuration?

When we try to call smth like

.subscribe(onCompleted: {
}, onError: { error in

we get errors:

“The operation couldn’t be completed. (MAVSDK_Swift.Action.ActionError error 1.)”

Do you have any suggestions of what we do wrong?

1 Like


First note: I’m generally more reactive if you ask questions by opening issues on the repo directly (here :blush:.

let port = “udp://”)
drone = Drone(port: Int32(port))

This looks good, though you don’t need to specify the IP. Just udp://:8001 would do it and would listen for messages coming to 8001 from any network interface. The way you write it, you will receive messages coming from into port 8001, but not if they come from I think your way should work, but just to be sure, try udp://:8001.

Then, this means that the drone is sending MAVLink to your mavsdk instance on port 8001, is that correct? PX4 by default usually broadcasts on 14550 and 14540, that’s why I’m asking about 8001 :+1:.

Do you get mavsdk_server output somewhere? Something that would look like this:

[10:46:24|Info ] MAVSDK version: v0.37.0-35-gf192baa8 (mavsdk_impl.cpp:21)
[10:46:24|Debug] New: System ID: 0 Comp ID: 0 (mavsdk_impl.cpp:418)
[10:46:24|Info ] Server started (grpc_server.cpp:45)
[10:46:24|Info ] Server set to listen on (grpc_server.cpp:46)
[10:46:24|Info ] Waiting to discover system on udp:// (connection_initiator.h:21)

And finally, is that an iOS app? Did you try running the example app? You would have to specify the systemAddress here, but other than that it should work.

Hello, Jonas.

I’ve created the issue on github:

We still can’t connect to the drone via MAVSDK swift.
I would very much appreciate any help on this issue.

I don’t know if it is important but we suppose iOS app to be Ground Control Station and drone to be a Vehicle which responses to GCS (telemetry should be sent from Vehicle to GCS). But in our app we don’t get anything like telementry.battery (our ‘next’ handler is never called)