mavlink / MAVSDK

API and library for MAVLink compatible systems written in C++17
https://mavsdk.mavlink.io
BSD 3-Clause "New" or "Revised" License
583 stars 485 forks source link

Increase rx rate #2249

Closed StefanoColli closed 1 week ago

StefanoColli commented 2 months ago

Hi, I'm trying to send a custom message at a high frequency (1kHz) to a SITL simulation running on the same machine. However, using the mavlink status the received message rate is 25Hz and most of the packets are lost:

 instance #1:
    GCS heartbeat valid
    mavlink chan: #1
    type:       GENERIC LINK OR RADIO
    flow control: OFF
    rates:
      tx: 27988.0 B/s
      txerr: 0.0 B/s
      tx rate mult: 1.000
      tx rate max: 4000000 B/s
      rx: 28871.5 B/s
      rx loss: 0.6%
    Received Messages:
      sysid:245, compid:190, Total: 13088 (lost: 7358)
        msgid:    4, Rate:  1.4 Hz, last 0.14s ago
        msgid:    0, Rate:  1.0 Hz, last 0.16s ago
        msgid:  446, Rate: 25.0 Hz, last 0.00s ago
    FTP enabled: YES, TX enabled: YES
    mode: Onboard
    MAVLink version: 2
    transport protocol: UDP (14580, remote port: 14540)
    Broadcast enabled: NO
    partner IP: 127.0.0.1
    ping statistics:
      last: 0.00 ms
      mean: 0.00 ms
      max: 0.00 ms
      min: 0.00 ms
      dropped packets: 0

Is there a way to increase the rate at which the messages are sent to/received by PX4?

julianoes commented 2 months ago

The lost count might not be accurate. It's using the MAVLink message seq (sequence) counter, and in certain situations this can jump, so it's to be used with caution. However, the fact that it only arrives at 25 Hz is interesting.

Given you're sending this over UDP (presumably localhost?), this should work faster.

Do you mind sharing a code snippet for me to reproduce the issue?

julianoes commented 1 week ago

Closing as there was no follow up.