PyMavlink no Message Output

I’m trying to get the distance to waypoint using custom python code and pymavlink. I followed a tutorial where after sending the position_target_global_int message creates a while loop to filter with recv_match the NAV_CONTROLLER_OUTPUT but in my case, the recv_match with NAV_CONTROLLER_OUTPUT always returns None.
What can be the issue?
Thanks in advance for the help.

from pymavlink import mavutil

the_connection = mavutil.mavlink_connection('tcp:localhost:5762')

print("Heartbeat from system (system %u component %u)" % (the_connection.target_system, the_connection.target_component))

the_connection.mav.send(mavutil.mavlink.MAVLink_set_position_target_global_int_message(10, the_connection.target_system, the_connection.target_component, mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT, int(0b110111111000), int(41.2763083 * 10 ** 7), int(1.9884215 * 10 ** 7), 20, 0, 0, 0, 0, 0, 0, 0, 0))

while 1:
    msg = the_connection.recv_match(type='NAV_CONTROLLER_OUTPUT', blocking=True)

is the message being sent at all?

Did you test it with mavlink inspector?

Are you sure about the port?
Also, you need to be in navigation-related modes, like GUIDED or AUTO.

In the Mavlink Inspector the NAV_CONTROLLER_OUTPUT is shown and the wp_dist shows data correctly.


From the console window that the simulator opens yes.


I’m in GUIDED mode as otherwise, the takeoff command does not work.

I managed to solve it by sending a command long with MAV_CMD_SET_MESSAGE_INTERVAL with the corresponding ID, in this case, 62.

Can you elaborate on what you did here? I am currently facing the same problem where I am getting only None values on the reception side of things.