Connect the Hardware PX4

Hi !!
I’m a newbie and i have a job to connect the Laptop with the hardware PX4 via Rdf900A and MAVSDK Python) but i can’t connect with the instruction in the website.
Hope you guys can give me some advice
Thanks!!!

What did you try and what does it say?

I try the code and that is what it say !

Can you describe how you installed mavsdk?

And maybe run:

python3 -m pip install --upgrade mavsdk

And share the output of that. (You might have to use python instead of python3, I don’t know that for Windows.)


the output:

But, when I follow the step of CONTRIBUTE, I have changed some infor in requirement.txt and requirement-dev.txt and so that the version of protobuf is 4.21.12 and i don’t know is it effect to anything else ?!

Ok, so it installs version 1.4.1 which is the latest, so that’s good.

However, it looks like the version for Windows doesn’t contain the mavsdk_server_bin binary, for some reason.

I need to have a closer look at this tomorrow.

Until then, what you can try is to run the binary in a separate console manually.

For this, you download the binary from here: Release v1.4.9 · mavlink/MAVSDK · GitHub

You want to download the win32 one.

Then you run it with the connection string as an argument, e.g.

./mavsdk_server_win32.exe serial://COM4:57600

(you need to change to the directory where the exe is in using cd)

Then you use this in your script:

drone = System(mavsdk_server_address='localhost', port=50051)
await drone.connect()

And note, when you want to run the Python script, the server needs to be running already in a separate console.

thanks a lot ! I will try it and report back to you as soon as possible

1 Like


but i don’t recieve any respone after “await drone.connect()”

It’s just:

await drone.connect()

No system_address there.

Have you checked whether MAVLink is arriving on that port, e.g. using QGroundControl?

“Have you checked whether MAVLink is arriving on that port”
how can i see that ?!
i usually check that on mission planner

oh i connected my PX4 !! Thank you very very very much !!!

1 Like

Yes, MissionPlanner works too. However, I’m assuming you are using PX4. MAVSDK was mostly developed around PX4 and not ArduPilot, so compatibility there is not great, and some work is still required.

but !! My research is about multi drone connect to one GCS (My laptop) so in this case have i run many mavsdk_server ?!

Yes, you run the mavsdk_server multiple times. For that you need to add the argument -p and specify a port number of the respective server.

You then need to reference that port number in Python as well where you specify the port.

1 Like

can u detail it, eg com9 and com10 because I still can’t figure it out

E.g.

mavsdk_server.exe serial://COM9:57600 -p 50059

with:

drone = System(mavsdk_server_address='localhost', port=50059)
1 Like

Do you have any document about mavsdk_server ?! I don’t understand about how it work yet

https://mavsdk.mavlink.io/main/en/faq.html#why-is-grpc-used-for-the-language-wrappers

mavsdk_server is the binary that hosts the gRPC server which the language wrappers (e.g. Python) talk to.

1 Like