dddomodossola / PFD

Apache License 2.0
0 stars 1 forks source link

Severe performance reduction in today's version. #7

Closed AndKe closed 3 years ago

AndKe commented 3 years ago

@dddomodossola The current version looks nice. On google glass, however, the spinbboxes cover a part of the PFD/Speed tape. Also, the delay is easily accumulated to +10 or more seconds. I may scroll thru any value of 1..20 in 5 seconds. , the glass may update "5" after three seconds, get to "10" in ten seconds, then apparently never finish.

I am not familiar with the way the updates works/what and how things are sent, but I suspect the relocation of the spinboxes may be causing this issue.

dddomodossola commented 3 years ago

@AndKe Yestarday I pushed different changes. Some of them were affected by bad performances. The latest version should be acceptable. Are you sure you tested the latest version?

Furthermore, are you running the program from an IDE or directly from python? When running with IDEs the performances are really bad because of debugging.

dddomodossola commented 3 years ago

On google glass, however, the spinbboxes cover a part of the PFD/Speed tape.

Consider that such spinboxes are only required now for testing and will be removed later.

dddomodossola commented 3 years ago

@AndKe Performances are now better, you can test it ;-) And there is a wide margin of possible improvements.

AndKe commented 3 years ago

Screenshot from 2021-02-04 16-45-17

I started and changed the values, then the that page load in google glass. It does load in a timely fashion, nothing unusual about the load time, but then I changed (slowly) the roll - and as you can see, even 10 seconds after, it is showing the original position. Occasinally, the communication will time out (animated cube seen for less than a second) - then the picture is current when it instantly appears, but no change is reflected on the glass. The device gets unusually hot.

The errors below is not something I have not seen earlier, it is just bit more often now. IP 192.168.1.22 is the google glass

/home/andre/prog/PycharmProjects/PFD/venv/bin/python /home/andre/prog/PycharmProjects/PFD/PFD.py
remi.server      INFO     Started httpserver http://0.0.0.0:8081/
remi.request     INFO     built UI (path=/)
127.0.0.1 - - [04/Feb/2021 16:37:52] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [04/Feb/2021 16:37:52] "GET /res:style.css HTTP/1.1" 200 -
remi.server.ws   INFO     connection established: ('127.0.0.1', 35268)
remi.server.ws   INFO     handshake complete
127.0.0.1 - - [04/Feb/2021 16:37:52] "GET /res:font.woff2 HTTP/1.1" 200 -
192.168.1.22 - - [04/Feb/2021 16:39:26] "GET / HTTP/1.1" 200 -
192.168.1.22 - - [04/Feb/2021 16:39:26] "GET /res:style.css HTTP/1.1" 200 -
remi.server.ws   INFO     connection established: ('192.168.1.22', 50711)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range
192.168.1.22 - - [04/Feb/2021 16:43:31] "GET / HTTP/1.1" 200 -
remi.server.ws   INFO     connection established: ('192.168.1.22', 43201)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range
remi.server.ws   INFO     connection established: ('192.168.1.22', 43203)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range
remi.server.ws   INFO     connection established: ('192.168.1.22', 43204)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range
remi.server.ws   INFO     connection established: ('192.168.1.22', 43205)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range
remi.server.ws   INFO     connection established: ('192.168.1.22', 43206)
remi.server.ws   INFO     handshake complete
remi.server.ws   ERROR    Error managing incoming websocket message
Traceback (most recent call last):
  File "/home/andre/prog/PycharmProjects/PFD/venv/lib/python3.8/site-packages/remi/server.py", line 165, in read_next_message
    length = self.bytetonum(length[1]) & 127
IndexError: index out of range

can there be some kind of race condition between the spinboxes that overlay the PFD?

dddomodossola commented 3 years ago

@AndKe I suppose it is caused by the refresh interval that I changed recently

dddomodossola commented 3 years ago

@AndKe I changed the refresh interval as default. Please try the latest version. Some questions:

  1. Is your local network slow? Of course performances are strictly related to this.
  2. Does it works with a good refresh performances on your PC?
AndKe commented 3 years ago
  1. no, most things are on the cabled ethernet, and the wifi is good - I live in an area with little 2.4/5.8Ghz activity
  2. PC is always fine, but it's hugely overpowered for this task so I doubt I would see any effect there. will try very soon
AndKe commented 3 years ago

@dddomodossola You are right, the 10ms update interval was too much for the glasses I guess. removing the update_interval made it behave normally. I also tried 10hz refresh which works well too.

Dodumentation does not say what is the default when this setting is omitted. "update_interval: GUI update interval in seconds. If zero, the update happens at each change. If zero, the App.idle method is not called."

If I set it to 0.1 , it will update at 10hz, the question is: are the updates transmitted and the screen refreshed fully, or are just changed elements redrawn, or is the update just skipped if no data changed since last time ?

dddomodossola commented 3 years ago

Only changed elements are redrawn, and update is skipped in case of no changes (but idle loop is executed however if update_interval >0)

AndKe commented 3 years ago

This may be a good time to facilitate an important part: To start another thread that can fetch telemetry data, decode it, adapt/process it, then set proper PFD variables. I can provide the code to produce some sample-data. such thread would need only to write variables to PFD, but some mechanism may be needed in order have PFD avoid variables that are being updated, a semaphore?

This would also remove the need for the sliders, and we could get closer to the native resolution of the glass.