Pymavlink get latest message

Hello,

I don’t think I am understanding the pymavlink library message receive functions. I would like to get the latest message of a certain type. When using the mavutil recv_match() method with blocking=True, it seems to access EVERY message that it has received in order of arrival. I want the most recent one at each call.

Example:

not_there = True
while not_there:

dist = the_connection.recv_match(type='NAV_CONTROLLER_OUTPUT', blocking=True).wp_dist
print(dist)
not_there = dist > 5
time.sleep(1)

The printed dist value lags behind the currently received mavlink messages as if it is reading each one one after the other.

I’ve tried the the_connection.messages method since the docs sound closer to my need, but it doesn’t seem to even update after the first call :confused:

Thank you!

I’ve the same problem… I think that is possible to receive a list of all messages in the FIFO but I don’t find the command.
If anyone can help us