jeanlemotan / esp32-cam-fpv

esp32 cam digital low latency fpv
MIT License
292 stars 75 forks source link

ground station can only get a part of data #11

Closed Ncerzzk closed 2 years ago

Ncerzzk commented 2 years ago

Hi, Thanks for your share about your work.

I test this projects by using ESP32-CAM and My PC(linux) with net card(AR9271 and RT3070), because I have no RP3 or RP4. I removed the code related to RaspberryPi/Decode/GUI and just test the data transmition.

while I power on the esp32-cam, and run the program, the log shows that I only got a part of the data. For example, 2 part of 1 frame, and could not get a complete video frame.

I) src/main.cpp: 129: OK Video frame 49896, 10 1457 - CRC OK 117. 
(I) src/main.cpp: 129: OK Video frame 49896, 20 1457 - CRC OK 21. 
(I) src/main.cpp: 129: OK Video frame 49897, 4 1457 - CRC OK 49. 
(I) src/main.cpp: 129: OK Video frame 49899, 1 1457 - CRC OK 240. 
(I) src/main.cpp: 129: OK Video frame 49899, 9 1457 - CRC OK 233. 
(I) src/main.cpp: 129: OK Video frame 49900, 7 1457 - CRC OK 217. 
(I) src/main.cpp: 129: OK Video frame 49901, 11 1457 - CRC OK 89. 
(I) src/main.cpp: 129: OK Video frame 49901, 21 1457 - CRC OK 57. 
(I) src/main.cpp: 129: OK Video frame 49902, 17 1457 - CRC OK 140. 
(I) src/main.cpp: 129: OK Video frame 49905, 0 1457 - CRC OK 105. 
(I) src/main.cpp: 129: OK Video frame 49905, 20 1457 - CRC OK 212. 
(I) src/main.cpp: 129: OK Video frame 49907, 2 1457 - CRC OK 129. 
(I) src/main.cpp: 129: OK Video frame 49907, 14 1457 - CRC OK 23. 
(I) src/main.cpp: 129: OK Video frame 49908, 11 1457 - CRC OK 152. 
(I) src/main.cpp: 129: OK Video frame 49909, 11 1457 - CRC OK 142.

the log format is:

LOGI("OK Video frame {}, {} {} - CRC OK {}. ", air2ground_video_packet.frame_index, (int)air2ground_video_packet.part_index, payload_size, crc);

the code is here: https://github.com/Ncerzzk/esp32-cam-fpv/tree/temp

have you met this kind of problem?

jeanlemotan commented 2 years ago

hmm not really. It could be because of a number of causes: the network card in monitor mode cannot keep up with the data rate for example. I wish I could help more but I don't have experience with those network adapters. You should be able to run it on a linuc PC with the same network cards I used on the PI though.

nathanRamaNoodles commented 2 years ago

@Ncerzzk I compiled your branch and I have it working. I originally used a cheap power brick to power the esp32-cam, So I switched to a better power supply and my Kali Linux PC is able to fetch the esp32-cam's feed. However, I am unable to see the video QT window. Perhaps some code needs to be included in the linux port from the raspberry-pi 4 code.

My Specs:

Ncerzzk commented 2 years ago

thank you for your time!

I removed the code about gui/decode in this branch, so it is normal that you can not see qt windows.

I'm using ubuntu on my linux pc, I suspect that ubuntu lack some netcard patches compared to Kali.

anyway, thank you very much, I would continue trying to resolve.

---Original--- From: @.> Date: Sun, Aug 7, 2022 04:44 AM To: @.>; Cc: @.**@.>; Subject: Re: [jeanlemotan/esp32-cam-fpv] ground station can only get a part of data (Issue #11)

@Ncerzzk I compiled your branch and I have it working. I originally used a cheap power brick to power the esp32-cam, So I switched to a better power supply and my Kali Linux PC is able to fetch the esp32-cam's feed. However, I am unable to see the video QT window. Perhaps some code needs to be included in the linux port from the raspberry-pi 4 code.

My Specs:

PC: 64-bit Kali Linux

WiFi adapeter: AR9271 (I am only using one)

esp32-board: ESP32-TTGO camera plus (similar to esp-eye)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Ncerzzk commented 2 years ago

@nathanRamaNoodles Hi, I have tried Kali , while I still could not get a complete video frame.

To prevent misunderstanding,

I compiled your branch and I have it working.

what is your output? (I) src/main.cpp: XXX : OK Video frame XXX, XXX XXX - CRC OK XXX. (my output is this)

or

Received frame XX, XX, size XXX (correct output is this)

I use tcpdump to test my monitor mode, and it shows that my netcard seems could only get data at 1.0 Mb/s

command:sudo tcpdump --monitor-mode -i wlan1

21:21:22.485272 851710041us tsft 1.0 Mb/s 2462 MHz 11b -17dBm signal -17dBm signal antenna 0 11:22:33:44:55:66 (oui Unknown) Unknown SSAP 0xe8 > 11:22:33:44:55:66 (oui Unknown) Unknown DSAP 0xa8 Information, send seq 5, rcv seq 0, Flags [Poll], length 1476
        0x0000:  a9e8 0a01 be05 00be 0500 0000 e303 01fc  ................
        0x0010:  c500 008d adc9 a5f0 a39d c893 767e ee06  ............v~..
...

Is the speed measured by tcpdump correct? if it is correct, then the problem may be in the netcard?

By the way, I have questions on the netcards. If I use netcards made by different vendors, while the chipsets are all AR9271, the speed of the netcard should be the same or not?

nathanRamaNoodles commented 2 years ago

Hi, sorry I was dual booting and had to reinstall kali.

Yes, I am getting only the incorrect output:

(I) src/main.cpp: XXX : OK Video frame XXX, XXX XXX - CRC OK XXX.

And I am also getting 1.0 Mb/s with sudo tcpdump --monitor-mode -i wlan1mon:

tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on wlan1mon, link-type IEEE802_11_RADIO (802.11 plus radiotap header) ...
... 628856331us tsft 1.0 Mb/s 2457 MHz 11b -80dBm signal -80dBm signal antenna 0 Beacon () [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] ...
... 628871278us tsft 1.0 Mb/s 2457 MHz 11b -74dBm signal -74dBm signal antenna 0 Beacon () [1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 Mbit] ...
...
....
.....

The speed limitation may be due to libnl? Because without it I would get: tcpdump: wlan1mon: That device doesn't support monitor mode

Ncerzzk commented 2 years ago

@nathanRamaNoodles Thank you, then our situation are the same.

I found that the problem may be in the air_firmware. the API to set esp32 tx rate seems to change between 4.3RC1 and release version.

So please try that replace esp_wifi_internal_set_fix_rate by esp_wifi_config_80211_tx_rate . I get it work in idf 4.3.3 by doing this change.