esp-now
esp-now copied to clipboard
esp_now latency (AEGHB-603)
I am sending multiple values to a slave esp using esp_now broadcast. I am sending points at a frequency of 1 every 30ms and above. For the first few points the slave receives the message within 5 to 7ms. but for certain subsequent points it goes upto to 50ms and even 100ms
Point | SentTime | ReceivedTime | ExecutedTime | SlaveReceivedTime | SlaveExecutedTime | CommunicationTime | TotalExecutionTime | SlaveCommunicationTime | SlaveTotalExecutionTime |
---|---|---|---|---|---|---|---|---|---|
5 | 1711798622.65379 | 1711798622.66174 | 1711798622.66286 | 1711798622.67827 | 1711798622.67946 | 7.95 | 9.07 | 15.41 | 16.6 |
6 | 1711798622.69424 | 1711798622.70244 | 1711798622.70363 | 1711798622.72855 | 1711798622.7297 | 8.2 | 9.39 | 24.93 | 26.07 |
7 | 1711798622.73481 | 1711798622.74294 | 1711798622.74411 | 1711798622.78723 | 1711798622.78854 | 8.13 | 9.3 | 43.13 | 44.43 |
8 | 1711798622.77513 | 1711798622.78358 | 1711798622.78472 | 1711798622.83769 | 1711798622.83887 | 8.46 | 9.59 | 52.97 | 54.16 |
9 | 1711798622.81556 | 1711798622.82401 | 1711798622.82515 | 1711798622.88931 | 1711798622.8906 | 8.45 | 9.59 | 64.15 | 65.45 |
10 | 1711798622.85593 | 1711798622.86431 | 1711798622.86551 | 1711798622.94036 | 1711798622.94153 | 8.38 | 9.57 | 74.86 | 76.03 |
11 | 1711798622.89636 | 1711798622.90404 | 1711798622.90528 | 1711798622.99113 | 1711798622.99247 | 7.69 | 8.92 | 85.86 | 87.19 |
12 | 1711798622.9367 | 1711798622.945 | 1711798622.94616 | 1711798623.04216 | 1711798623.04331 | 8.31 | 9.46 | 96.0 | 97.16 |
13 | 1711798622.97704 | 1711798622.98467 | 1711798622.98596 | 1711798623.09191 | 1711798623.09301 | 7.63 | 8.92 | 105.96 | 107.06 |
14 | 1711798623.01738 | 1711798623.02585 | 1711798623.02706 | 1711798623.14438 | 1711798623.14561 | 8.47 | 9.68 | 117.32 | 118.55 |
15 | 1711798623.05784 | 1711798623.06586 | 1711798623.06703 | 1711798623.19467 | 1711798623.1958 | 8.02 | 9.19 | 127.64 | 128.77 |
Above is a sample of the values The max latency is gong upto 200ms and avg of 50 ms over 37 points sent. The data packets are trajectory points that need to be input to motors Count : 32 POINT: positions: [0.1438207544378186, 0.1438207544378186, 0.22379780136537714] velocities: [0.25470507451224855, 0.25470507451224855, 0.2014506547443208] accelerations: [-1.907522980622658, -1.907522980622658, -0.8210376281913943] effort: [1.0] time_from_start: secs: 2 nsecs: 775355899 Their size is less than 100bytes per single message. I am broadcasting them through - esp_err_t result = esp_now_send(0, (uint8_t *)point, sizeof(trajPoint)); where trajpoint is the message - typedef struct trajPoint { char mastercmd[4]; float pos[3]; float velo[3]; float accel[3]; float count; } single_point;
What could be causing this latency in between? Is there a threshold for difference between intermediate points?
EDIT2 I figured out another thing, if the time difference between successive points is less than 20ms, thats when this delay/buffer overflow starts occuring. Whenever time difference between two points is more than 20ms, it sends each point at 5 to 6 ms range -
points sent @0.03 secs
Point | SentTime | ReceivedTime | ExecutedTime | SlaveReceivedTime | SlaveExecutedTime | CommunicationTime | TotalExecutionTime | SlaveCommunicationTime | SlaveTotalExecutionTime |
---|---|---|---|---|---|---|---|---|---|
0 | 1711955168.43399 | 1711955168.44746 | 1711955168.44866 | 1711955168.4542 | 1711955168.4553 | 13.47 | 14.67 | 5.53 | 6.64 |
1 | 1711955168.46448 | 1711955168.47901 | 1711955168.48011 | 1711955168.48454 | 1711955168.48568 | 14.52 | 15.62 | 4.43 | 5.57 |
2 | 1711955168.49504 | 1711955168.50925 | 1711955168.51047 | 1711955168.51594 | 1711955168.51707 | 14.21 | 15.43 | 5.46 | 6.59 |
3 | 1711955168.52538 | 1711955168.53109 | 1711955168.53229 | 1711955168.54092 | 1711955168.542 | 5.71 | 6.91 | 8.63 | 9.71 |
4 | 1711955168.55576 | 1711955168.56162 | 1711955168.56282 | 1711955168.57009 | 1711955168.57123 | 5.86 | 7.05 | 7.28 | 8.41 |
points sent @0.02 secs -
Point | SentTime | ReceivedTime | ExecutedTime | SlaveReceivedTime | SlaveExecutedTime | CommunicationTime | TotalExecutionTime | SlaveCommunicationTime | SlaveTotalExecutionTime |
---|---|---|---|---|---|---|---|---|---|
0 | 1711955028.20987 | 1711955028.22388 | 1711955028.22511 | 1711955028.23112 | 1711955028.23227 | 14 | 15.24 | 6 | 7.16 |
1 | 1711955028.23026 | 1711955028.23497 | 1711955028.23617 | 1711955028.25614 | 1711955028.25728 | 4.7 | 5.9 | 19.97 | 21.11 |
2 | 1711955028.2507 | 1711955028.2558 | 1711955028.25693 | 1711955028.2778 | 1711955028.27893 | 5.1 | 6.23 | 20.87 | 22 |
3 | 1711955028.27102 | 1711955028.27754 | 1711955028.27866 | 1711955028.30291 | 1711955028.30414 | 6.52 | 7.64 | 24.26 | 25.48 |
4 | 1711955028.29132 | 1711955028.29831 | 1711955028.29945 | 1711955028.32478 | 1711955028.32589 | 6.98 | 8.12 | 25.33 | 26.44 |
5 | 1711955028.31172 | 1711955028.31905 | 1711955028.32019 | 1711955028.34978 | 1711955028.35095 | 7.33 | 8.48 | 29.59 | 30.76 |
@programmeddeath1 Please see the test report as the attachment. ESP-NOW Test Report.pdf
Here is my setup. Hope this helps. https://github.com/nanshenwei/espnowSpeedTest.git
@programmeddeath1 Closing this issue since there has been no update on this. Please feel free to reopen if required.