I’m using PX4 v1.13.1, which receives MAVLink messages via UART, from a companion device that generates the messages using MAVSDK.
I’m seeing large numbers in the
However, after looking at the packets sent from the companion computer, it seems that MAVSDK sends MAVLink packets with noncontinuous sequence numbers, which causes PX4’s mavlink module to mark these as lost messages (in MavlinkReceiver::update_rx_stats), although no message is lost.
It seems that MAVSDK, running on the companion computer, is designed to send non-continuous seq. numbers (correct me if i’m wrong); There are different plugins running at the same time, which call
mavlink_msg_[MSG NAME]_pack (included from the auto-generated mavlink headers code), that propagates to
mavlink_get_channel_status, that returns a status object, containing the seq. number with which to populate the next MAVLink packet (in mavlink_finalize_message_buffer).
But since this array is declared statically in a .h file (mavlink_helpers.h from PX4’s build), which is included by multiple .cpp files in MAVSDK, then each .cpp file that sends a mavlink message will receive a sequence ID from a different pool, thus casing non-continuous sequence numbers.
For instance, if i only send TIMESYNC and VISION_POSITION_ESTIMATE, then there are 2 different MAVSDK cpp files (src/core/timesync.cpp and src/plugins/mocap/mocap_impl.cpp), both are compiled to the same process, but still send different sequence IDs, because they have different copies of
static mavlink_status_t m_mavlink_status[MAVLINK_COMM_NUM_BUFFERS];
Is this design on purpose?
Has anyone encountered this, or am i missing something in my setup?