-
Notifications
You must be signed in to change notification settings - Fork 107
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
Lag in mqtt/ethernet communication #58
Comments
This can likely be improved by software means but I doubt this is the proper place you'd receive the needed attention. Better check the communities with the MQQT or ESP32 libraries that you use. There should be something like TCP_NODELAY in the mqqt options or maybe you can try UDP instead. "The esp32 DOIT kit which runs WROOM-32", well ESP32-EVB also runs the same module (either ESP32-WROOM-32E or ESP32-WROOM-32UE depending if it has antenna).
Why? Which interface is easier to process and has less overhead? Ethernet requires huge software stack and UART is much simpler... |
I understand it has less overhead, but mqtt and ethernet are said to be faster based on all reference content available online. And it seems true too, since at control cycles of 0.04, mqtt takes around 4ms avg for round trip which is way less than usb serial's best time(which is around 8 to 10ms avg). This lag is when messages are getting piled up at a rate of 10ms(cc- 0.01) and there is a constant or increasing delay in their subsequent messages. I will try with nodelay and UDP once and check. I'll have to check with the expressif communities, the mqtt and library communities are quite inactive. Can I be sure that this is not a cpu processing issue? That at frequencies of 1kHz its not getting throttled? Thanks for your response! |
I am using the olimex esp32-evb-ind to execute the position,velocity and acceleration of a robotic arm. The path is generated on a cpu and the coordinates are then sent to the esp32 over ethernet cable.
When sending data over a control cycle of 0.04 (1 point generated every 0.04s or 40ms). The communication time from the cpu to esp32 is avg around 4ms (RTT) ie 2ms for communication
<style type="text/css"></style>
But if i reducee the control cycle to below 0.03, eg at 0.01, there seems to be significant lag and pile-up of messages causing constant lag
<style type="text/css"></style>
I tried controlling the background processes by creating the mqtt callback task to pin to a core using xTaskCreatePinnedToCore. Such that it was run on core 0 as well as core 1, but the lag seems to remain.
Also the lag seems to be more on control cycle of 0.02 and 0.03 - <style type="text/css"></style>
I tried changing the message data size, sending in json format or as encoded byte format, but there seems to be almost no difference in the processing time.
Is this a limitation with the cpu processing capabilities of the esp32 that its not able to process points at such high frequencies.
The esp32 DOIT kit which runs WROOM-32 is able to achieve faster times with uart at a baud rate of 4000000. It seems counterintuitive that uart is faster here than ethernet or mqtt over LAN.
I have connected the esp32 over a link-local only lan setup and no router, the ping times are around 0.3ms.
The text was updated successfully, but these errors were encountered: