import time from pymavlink import mavutil def wait_conn(): """ Sends a ping to stabilish the UDP communication and awaits for a response """ msg = None while not msg: master.mav.ping_send( int(time.time() * 1e6), # Unix time in microseconds 0, # Ping number 0, # Request ping of all systems 0 # Request ping of all components ) msg = master.recv_match() time.sleep(0.5) master = mavutil.mavlink_connection('udpout:0.0.0.0:9000') wait_conn() while True: try: # message = master.recv_match().to_dict() message=master.recv_match(type='ATTITUDE', blocking=True).to_dict() print(message) except: pass time.sleep(0.1)