Coder Social home page Coder Social logo

Comments (6)

jeanlemotan avatar jeanlemotan commented on September 27, 2024

From what I see, the TX buffer on the esp side is full. Most probably the air data rate cannot keep up with the resolution/FPS and you get a lot of frame drops.
In your log, you can see the TX buffer percentage as 94-97%, which is a lot. It should hang at around 0-20% with occasional spikes.

What data rate are you using?

from esp32-cam-fpv.

Bartvelp avatar Bartvelp commented on September 27, 2024

When logging the rate using:

LOG("WLAN S: %d, R: %d, E: %d, D: %d, %%: %d || FPS: %d, D: %d || D: %d, E: %d, WIFI_RATE: %d\n",
  s_stats.wlan_data_sent, s_stats.wlan_data_received, s_stats.wlan_error_count, s_stats.wlan_received_packets_dropped, s_wlan_outgoing_queue.size() * 100 / s_wlan_outgoing_queue.capacity(),
  (int)s_stats.video_frames, s_stats.video_data, s_stats.sd_data, s_stats.sd_drops, get_wifi_fixed_rate());

It gives: WLAN S: 50184, R: 0, E: 0, D: 0, % : 97 || FPS: 25, D: 629476 || D: 0, E: 0, WIFI_RATE: 13,
13 corresponds to RATE_G_54M_ODFM.

This is confirmed by WireShark:
image

Seems plenty fast to me, weird that the TX buffer is getting filled then.

from esp32-cam-fpv.

jeanlemotan avatar jeanlemotan commented on September 27, 2024

In this last log, it's even worse: It's trying to send ~600K of data per second, and it only manages 50K.
My guess is that due to the very noisy environment, it cannot find enough free air capacity to send the data. AFAIK the esp still checks for other wifi traffic before sending, even in package injection mode.
Try a different channel or modulation. Faster rates might give you better results as they occupy less air time, therefore less chances of collisions.
I also did all my tests at home in a super noisy environment and had to choose a more or less free channel to get anything reliable, or drop the FPS/resolution to reduce the air time as much as possible to get good results.
Try MCS7 for the data rate, at a lower resolution and watch for buffer overflows. You should be able to tune it for good performance.
Note that the firmware doesn't do any sanity checks if you try to fit too much data through the air. There should be some checks added to the ground station when the air rate is too low for the selected resolution/fps combo, but I never got around to adding these.

from esp32-cam-fpv.

Bartvelp avatar Bartvelp commented on September 27, 2024

Your logic makes total sense, but when I run the iperf example, using a softAP I get:
[ 1] 0.0000-60.0055 sec 87.8 MBytes 12.3 Mbits/sec
So that is way more. But when I manually send packets using espnow, I again get max ~80 KB/sec. When running iperf when connected to my regular WiFi I get a bit less performance:
[ 3] 0.0000-59.9971 sec 47.6 MBytes 6.66 Mbits/sec
Still way better than the raw sending. Very weird if you ask me.

from esp32-cam-fpv.

Bartvelp avatar Bartvelp commented on September 27, 2024

I got it working! Turns out I need to touch the backside of the esp32 antenna, and then it starts sending quite well, although still not perfect. You can't really make this stuff up. I'm getting up to 30 FPS but not much beyond, also got really intermittent latency.

from esp32-cam-fpv.

jeanlemotan avatar jeanlemotan commented on September 27, 2024

I think that when you touch the backside, you're 'muting' all other noise in the air, so the ESP cannot receive much else, and it thinks it's quiet out there, therefore sending all of its data.
You could try to put it in a faraday cage (microwave, aluminum foil, smth) and see if that improves performance.

from esp32-cam-fpv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.