This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
numba to speed up the code
#1
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
Reply
#2
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.
Reply
#3
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.
Reply
#4
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.
Reply
#5
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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)