Hi,
i want to send the control commanders from PC (roll,pitch,yaw and thrust) to Crazyflie, because of the long solution time of nmpc in PC. So is the latency measurement and compensation very necessary. I have seen that someone in forum have done this task, but still dont know how to make it. Can anyone give me some advices?
Thanks a lot in advance for any help
Baosai
Latency measurement between PC and Crazyflie
Re: Latency measurement between PC and Crazyflie
We have added this in an experimental branch here: https://github.com/bitcraze/crazyflie-l ... y#L82-L113. The measured (roundtrip) latency is around 4ms on our systems, so for your control system you can expect about 2ms of latency.
The idea of the test is to send packets to the CRTP Echo port and measure the time between sending a packet and receiving its echo (roundtrip time). Note that there is a large variance in this latency, because packets can get dropped, scheduler variance (on the Crazyflie and PC side), etc.
The idea of the test is to send packets to the CRTP Echo port and measure the time between sending a packet and receiving its echo (roundtrip time). Note that there is a large variance in this latency, because packets can get dropped, scheduler variance (on the Crazyflie and PC side), etc.
Re: Latency measurement between PC and Crazyflie
Thanks a lot for your help.
After testing, my latency is very high, I don't know which factors lead to the high latency. I use the virtual system, maybe it is the reason. Do you know what other reasons can als cause a high latency?
Here are my results:
After testing, my latency is very high, I don't know which factors lead to the high latency. I use the virtual system, maybe it is the reason. Do you know what other reasons can als cause a high latency?
Here are my results:
15:3 ()
Latency for radio://0/80/2M/E7E7E7E7E7 (packet size 28 B): 40.20 ms
F15:3 ()
Latency for radio://0/80/2M/E7E7E7E7E7 (packet size 4 B): 40.38 ms
FF
======================================================================
FAIL: test_latency_radio_s28 (__main__.TestLink)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/wang/projects/crazyflie-lib-python/sys_test/single_cf_grounded/test_link.py", line 54, in test_latency_radio_s28
self.assertLess(result, 8)
AssertionError: 40.199995040893555 not less than 8
======================================================================
FAIL: test_latency_radio_s4 (__main__.TestLink)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/wang/projects/crazyflie-lib-python/sys_test/single_cf_grounded/test_link.py", line 50, in test_latency_radio_s4
self.assertLess(result, 8)
AssertionError: 40.37642478942871 not less than 8
======================================================================
FAIL: test_scan (__main__.TestLink)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/wang/projects/crazyflie-lib-python/sys_test/single_cf_grounded/test_link.py", line 43, in test_scan
self.assertEqual(len(uris), 2)
AssertionError: 3 != 2
----------------------------------------------------------------------
Ran 3 tests in 71.958s
FAILED (failures=3)
Re: Latency measurement between PC and Crazyflie
The VM will add some latency. I tried using the latest VM in GNOME Boxes (https://wiki.gnome.org/Apps/Boxes) and it made me fail the tests.
Locally on my machine I get 4.77 ms for test_latency_radio_s28 and 2.99 ms for test_latency_radio_s4.
On the VM I get 15.14 ms for s28 and 14.98 ms for s4.
Which software are you using to run the VM?
Regards
Jonas
Locally on my machine I get 4.77 ms for test_latency_radio_s28 and 2.99 ms for test_latency_radio_s4.
On the VM I get 15.14 ms for s28 and 14.98 ms for s4.
Which software are you using to run the VM?
Regards
Jonas
Re: Latency measurement between PC and Crazyflie
I tested in Virtualbox as well and got around 25 ms latency for both tests.
Re: Latency measurement between PC and Crazyflie
thank you for your feedback!
I use Virtualbox, perhaps as you said, virtual machine cause more latency. I will try it with a new local machine and give a feedback after that.
Regards
Baosai
I use Virtualbox, perhaps as you said, virtual machine cause more latency. I will try it with a new local machine and give a feedback after that.
Regards
Baosai
-
- Beginner
- Posts: 1
- Joined: Tue Jun 15, 2021 1:40 pm
Re: Latency measurement between PC and Crazyflie
Thanks a lot for your help. today gold rate in hyderabad