Home        Store        Learn        Blog

Can't Connect to Mavlink

Hello,
I’m trying to get the pymavlink connection up and running using the instructions found here.

I’ve followed everything (I think) correctly and have my surface computer connected to the pi and the pi connected to the pixhawk. I can open up QGroundControl and see the connection being made properly and can even open up the companion web app on http://192.168.2.2:2770

I’m now trying to pull some data using the pymavlink instructions, but it doesn’t seem to be working properly. I’m running the default one without QGroundControl open, and it doesn’t seem to print out anything. If I force it to print out an error it gives me, “print(master.recv_match().to_dict()) AttributeError: ‘NoneType’ object has no attribute ‘to_dict’”

Here’s the script I’m running:

import time
from pymavlink import mavutil
master = mavutil.mavlink_connection('udpin:192.168.2.1:14550')
# Get some information !
while True:
    try:
    	print(master.recv_match().to_dict())
    except:
        pass
    time.sleep(0.1)

Any help would be super appreciated!

Hi @tdoe,

That’s odd. Can you check that your IP is really 192.168.2.1 ?
Alternatively, try using udpin:0.0.0.0:14550 in the code.

I double checked that my ip address is correct, and it is:
ip
And that’s the only adapter I have enabled, so none other even show up. I am doing this on a windows machine if that changes anything, but I thought it was all web socket based which would mean it wouldn’t matter.

I also tried 0.0.0.0, and that didn’t do anything different.