Board index FlightGear Development

Phi Radiostack does not get updated properly  Topic is solved

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Phi Radiostack does not get updated properly

Postby sweiland » Thu May 13, 2021 2:57 pm

Has anyone noticed that the Phi (Flightgear User Interface) Radiostack widget does not get notified properly? When I change a radio frequency in Flightgear (via the Radio Frequencies window to be opened via F12) only approximately one in four times the frequency in the widget gets changed. I see this behaviour in versions 2020.3.8 and 2020.4.0 on Linux Mint. For other widgets this might not be an issue as they get updated quite often.

If I take a look with wireshark on the network traffic I see that changes do not get send promptly from Flightgear to the browser. The browser is started on the same system as the Flightgear executable.

I've done quite some searching in the sources of Flightgear, but I'm not able to find where this sending of changes does happen. Does anyone know? So that I could try to find the root cause of this issue.

regards, Siebren.
sweiland
 
Posts: 2
Joined: Thu May 13, 2021 2:50 pm

Re: Phi Radiostack does not get updated properly

Postby ludomotico » Thu May 13, 2021 3:38 pm

This issue has puzzled me for years. It is not only the radio stack, it is any property that changes: sometimes, phi does not notify the change. As you say, it is only noticeable in properties that do not change often, such as the radio frequencies. But you'll find the same issue with selected radials, for example.

Supposedly, when a property changes, the phi interface informs to anyone that registered an alarm. The fact is it doesn't always happen, as you noticed. It doesn't matter in, say, the ASI because airspeed changes tens of times per second and missing one of these changes is not important. But miss a change in the selected radial, or frequency, and you are out of sync.

I suspect there is race condition in the listeners of the property tree: if you register any function waiting for changes, sometimes you won't get the change notification. This happens in the telnet and web (phi) interfaces, but not in the Nasal listeners or we would heard about this issue long ago. For this reason, I believe it is a race condition between the thread of the property tree and any other threads (telnet, web) registering listeners.

I didn't find any solution to this, apart from using web panels and other external interfaces as the only user interfaces: if you use an external interface (web panel, Arduino), do not use anything else. If an Arduino controls the radio stack, do not use anything else to control the radio stack. If you change (for example) the selected radials in flightgear, it is not guaranteed that this change will be propagated to any external interface that uses listeners.
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: Phi Radiostack does not get updated properly

Postby slawekmikula » Fri May 14, 2021 7:46 am

It's because (somewhat) that property changes are not updated more frequently. There is a rather exemplary fix here: https://sourceforge.net/u/slawekmikula/ ... anup/tree/ commit : https://sourceforge.net/u/slawekmikula/ ... ad325b238/ This along with some work on the phi interface in my forks on the phi branch. With this change the UI works OK. It's not a very good change because websocket communication is multiplied by 5. Only proof of concept.
slawekmikula
 
Posts: 128
Joined: Sun Feb 19, 2017 10:31 am

Re: Phi Radiostack does not get updated properly

Postby ludomotico » Fri May 14, 2021 10:37 am

slawekmikula, this is very good news.

If I understood correctly, the issue is that the the phi interface only checks changes 20 times a second, and you propose checking 100 times a second. If I understood your code, you change the default value for property "/sim/http/property-websocket/update-interval-secs", and I believe this is something that can be done in the launcher. No need to change anything in the source code, doesn't it?
User avatar
ludomotico
 
Posts: 1269
Joined: Tue Apr 24, 2012 2:01 pm
Version: nightly
OS: Windows 10

Re: Phi Radiostack does not get updated properly  

Postby sweiland » Fri May 14, 2021 11:17 am

Tested this and yes, change can be done in the launcher by adding:

--prop:/sim/http/property-websocket/update-interval-secs=0.01

to the Additional Settings. On my system this fixes the problem. Next to changing the frequency in flightgear, changing the frequency in the Phi interface now works also correctly.

This looks like a workaround, as changes should always make it into the Phi interface. But I guess that's the way this mechanism is set up. I'd rather see this fix being part of the standard, as without this fix the Phi interface does not work correctly. It does not seem to influence the framerate badly.

Thanks a lot for the above answers.
sweiland
 
Posts: 2
Joined: Thu May 13, 2021 2:50 pm

Re: Phi Radiostack does not get updated properly

Postby callahanp » Fri Sep 15, 2023 2:14 pm

callahanp
 
Posts: 15
Joined: Sat May 11, 2013 3:40 am
Callsign: pac1


Return to Development

Who is online

Users browsing this forum: No registered users and 5 guests