Skip to content

Please, Include Missed Packets per Channel in the Statistics #419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tipoman9 opened this issue Mar 31, 2025 · 7 comments
Open

Please, Include Missed Packets per Channel in the Statistics #419

tipoman9 opened this issue Mar 31, 2025 · 7 comments

Comments

@tipoman9
Copy link
Contributor

tipoman9 commented Mar 31, 2025

Missed packets per channel are the most important metrics for signal quality.
Much more important then RSSI or SNR.
This is the first sign that the link quality is going bad for a channel.
Currently wfb_rx exposes these metrics

{
    "type": "rx",
    "timestamp": 1743453059.1416976,    
    "packets": {
        "all": [990, 91088],
        "dec_err": [0, 936],
        "dec_ok": [990, 90152],
        "fec_rec": [0, 0],
        "lost": [0, 0],
        "bad": [0, 0],
        "out": [398, 36032],
        "out_bytes": [469674, 42121751]
    },
    "session": {},
    "rx_ant_stats": [{
            "ant": 256,                     
            "pkt_recv": 495,
           ...
          
        }, {
            "ant": 0,          
            "pkt_recv": 495,
			...         
        }
    ]
}

Imagine the following scenario.
The Tx sends 500 packets.
Channel 1 receives 495, misses 5 (spread in the first half of the period)
Channel 2 receives 495, misses 5 (spread in the last part of the period)
Since all the missed packets of Channel 1 are received by Channel 2, the aggregator will compensate them and no FEC will be needed, so fec_rec will be 0.
And there is no way to tell from the exported statistics that 5 packets were missed by every channel.

I have implemented this metric in an ugly way, so I don't dare to do a PR with such an implementation:
https://github.com/tipoman9/wfb-ng/blob/731c227e5abd096c083723e3ee60420ce9a674db/src/rx.cpp#L498
But I can't imagine flying without it, since digital signal tend to break suddenly, unlike analogue one.
It would be very nice if you implement this feature the proper way in wfb_rx and export it via the TCP statistics.
Here it is how it looks like in flight

Image

EDIT.
Maybe an easier option would be to add the total amount of aggregated packets before FEC.
If antenna packets are substracted from this metrics, that should give the missed packets per channel.

@svpcom
Copy link
Owner

svpcom commented Apr 2, 2025

Agree. I can easily add number of unique packets from all antennas before FEC. Difference between of them and individual antenna counters will give you all you want

@svpcom
Copy link
Owner

svpcom commented Apr 2, 2025

@tipoman9 done. See example in wfb-cli

svpcom added a commit that referenced this issue Apr 2, 2025
@svpcom
Copy link
Owner

svpcom commented Apr 4, 2025

@tipoman9 Have you tried feature above?

@snokvist
Copy link

snokvist commented Apr 4, 2025

It seems to work! The adapter with "dloss" is my rtl8812bu which i always though was shitty and was losing packets, and this proves it.

Image

{"type": "rx", "timestamp": 1743787812.9160862, "id": "video rx", "tx_wlan": 2, "packets": {"all": [1209, 503769], "all_bytes": [1300383, 543938136], "dec_err": [0, 490], "session": [3, 1264], "data": [1206, 502015], "uniq": [403, 167886], "fec_rec": [0, 712], "lost": [0, 61], "bad": [0, 0], "out": [268, 112640], "out_bytes": [258914, 109708410]}, "session": {"fec_type": "VDM_RS", "fec_k": 8, "fec_n": 12, "epoch": 0}, "rx_ant_stats": [{"ant": 512, "freq": 5825, "mcs": 0, "bw": 20, "pkt_recv": 403, "rssi_min": -28, "rssi_avg": -16, "rssi_max": -13, "snr_min": -28, "snr_avg": -16, "snr_max": -13}, {"ant": 0, "freq": 5825, "mcs": 0, "bw": 20, "pkt_recv": 403, "rssi_min": -28, "rssi_avg": -16, "rssi_max": -13, "snr_min": -28, "snr_avg": -16, "snr_max": -13}, {"ant": 256, "freq": 5825, "mcs": 0, "bw": 20, "pkt_recv": 400, "rssi_min": -41, "rssi_avg": -38, "rssi_max": -38, "snr_min": 0, "snr_avg": 0, "snr_max": 0}]}

@tipoman9
Copy link
Contributor Author

tipoman9 commented Apr 4, 2025

Seems exactly what I asked for, thank you!

Image

Now in order to get the lost packets per channel, it is enough to extract the channels per session : pckt_recv from the aggregated packets from all channels : uniq
So:
[lost_pckts_per_antenna] = [uniq] - [pckt_recv]

EDIT:
Seems you have to take into account also the total amount of lost packets and maybe FEC recovered ones?
So the correct way to get lost packets per channel in case you have lost ones could be :
[lost_pckts_per_antenna] = [uniq] - [pckt_recv] + [lost] + [fec_rec]

@tipoman9
Copy link
Contributor Author

tipoman9 commented Apr 4, 2025

widget_wfb_ng.mp4

This is how the widget for x86 looks like for three ar9271 adapters based on this statistics.
https://github.com/tipoman9/wfb-stabilizer/blob/main/wfb_osd.py

@svpcom
Copy link
Owner

svpcom commented Apr 5, 2025

@tipoman9 My only note that nonzero fec_r is not only when packet was lost, but also when you have packets reordering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants