Posts: 9
Threads: 3
Joined: May 2019
Reputation:
0
On youtube i see some video,s about numba a jit compiler that can speed up the python code a lot.
is it possible to use it.
i tried to test it but my python skills are not the best.
the display from my tinypilot and also the function buttons are a bit slow to react.
maybe this will help
Posts: 2,324
Threads: 21
Joined: Jun 2016
Reputation:
72
Do you mean in manual control mode? How slow to react?
At first boot there might be more delay because other services are booting in the background?
There are 2 different sets of functions you could be using. One to interface with the display and another without. Did you try both and compare the reaction times? I have optimized manual control, and it is improved since earlier versions. Which image are you running?
I am not sure compiling pypilot would be the answer here as the control loops execute in 50ms, so compiling might reduce cpu usage, but without identifying exactly where the lag occurs it is unclear if it would benefit.
Posts: 9
Threads: 3
Joined: May 2019
Reputation:
0
The version i used was a lot older.
the reaction of the display and the buttons was not very quick.
i will try the latest version ,which seems to be a lot more responsive
numba seems to work best for calculations and numbers.
i tried to use it on my ryzen pc to speed up web.py but i did not see any improvements.
latency stays the same.
would like to test it on tinypilot but i dont no how to add numpy and to change the .py files on tinypilot.
Posts: 2,324
Threads: 21
Joined: Jun 2016
Reputation:
72
Yes, it is not going to help with the key press latency.
As it is, the path (assuming RF remote control but gpio input is similar)
1) RF receiver into atmega328 (few milliseconds)
2) raspberry reads from atmega328 via spi (very fast, but because of polling, potentially using an additional gpio interrupt pin could shave 20-30ms)
3) process reading spi, either sends message directly to process controlling servo, or sends message to another process which sends a message to the pypilot server process which sends a message to the servo. Both methods are implemented and surprisingly there is little difference (I cannot notice it)
4) The process controlling the servo should poll on this socket, so it will wake up if any message is received and immediately command the servo. This could take additional 10-20ms for the motor to actually receive voltage and depending on the slew speed (acceleration) and actual drive including backlash in the linkage, additional delays
Total latency should be < 100ms
Older versions of pypilot were much slower 200-300ms.
Could it be further optimized: yes. Maybe to < 50ms, but the difference would be harder to notice.
Posts: 72
Threads: 4
Joined: Sep 2020
Reputation:
2
2024-07-04, 07:03 PM
(This post was last modified: 2024-07-07, 08:49 PM by Jean-Marc Douroux.)
The last image used with a pi zero and your hat with the atmega328 to decode the radio remote control receiver give me complete satisfaction in terms of speed and power consumption.
I am convinced that what you offer in store is ultimately the best especially if you use a pi zero. Even with skills and resources, it is almost impossible to do better than what you do in terms of code, ergonomics, electronics, EMC and consumption.
Thanks a lot Sean