Board index FlightGear Development Aircraft Cockpit development

Garmin 196 – Bad news... (Stuttering Lag)

Discussion about creating 2d and 3d cockpits.

Garmin 196 – Bad news... (Stuttering Lag)

Postby TeXnicer » Tue Apr 28, 2020 9:01 pm

By chance I just figured out that my Garmin 196 (nice GPS device featured in some A/C) causes some heavy lag. There is - of course - the initial lag, when turning on the device. But it seems, that having this device up for some weeks now it is packed with data flightplans n stuff. It looks like there is some malicious memory handling since haveing it turned on causes an intensive stuttering lag every 2-3secs for .5 sec. Independently from all other settings (ALS, Objects, Rendering ...)

So I could really narrow it down to GPS Garmin 196. I only found out today, that other flyers had faced the same problem.

I really would like some external confirmation, workaround/bugfix, or maybe someone looking into it together with me.
User avatar
TeXnicer
 
Posts: 20
Joined: Tue Mar 17, 2015 2:39 pm
Callsign: D-EKSW
IRC name: TeXnicer
Version: 2018.3.2
OS: Debian 10

Re: Garmin 196 – Bad news... (Stuttering Lag)

Postby Johan G » Wed Apr 29, 2020 11:03 am

There was an effort made to reimplement it to use Canvas back in 2014-2015.[1][2] But it seems little have happened since that. I would guess there might be room for optimizations. :wink:

Also updated the wiki page with some links.[3]
___
[1] See the GPSmap196 commit history
[2] See the topic Garmin GPSmap196
[2] See diff.
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Johan G
Moderator
 
Posts: 6202
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Garmin 196 – Bad news... (Stuttering Lag)

Postby stuart » Wed Apr 29, 2020 12:27 pm

Hi TeXnicer,

From the description you provide and the version of FlightGear you are running, I think your diagnosis that there's some bad memory handling is probably right. There is a "garbage collector" in Nasal to clear up no-longer used data in memory for things like the GPS196. Unfortunately this is known to cause stuttering when it runs.

Richard Harrison has been working on a background garbage collector to address this, though that's not without issues itself.

I'd suggest trying the 2020.2 release when it comes up (hopefully end of May) with /sim/nasal-gc-threaded=true. If that removes the stutters, then we at least know where the problem is.

-Stuart
G-MWLX
User avatar
stuart
Moderator
 
Posts: 1588
Joined: Wed Nov 29, 2006 9:56 am
Location: Edinburgh
Callsign: G-MWLX

Re: Garmin 196 – Bad news... (Stuttering Lag)

Postby Hooray » Sun May 03, 2020 10:27 am

No matter if the selected GC mode has an impact or not, the G196 is a comparatively simple device - in fact, much simpler in terms of functionality than some of the airliners that feature multiple MFDs with EICAS/EFIS-functionality, or even the FG1000.

Which is to say that the issue is likely best resolved by troubleshooting it properly, it makes no sense for a single instance of a simple "moving map device" to have more of an impact than a other much more complex devices, using the same Nasal/Canvas based techology stack.

Most stuttering that's been so far reported in the context of Nasal/Canvas based avionics had more to do with improper use of the navdb APIs (excessive queries), or poorly-structured code, i.e. algorithms that would also show in C++ space, despite obviously with a lower impact compared to Nasal, with the most-frequent issue being improper use of timers and listeners (lack of resource management).

This is something that a number of senior core developers have repeatedly reported, and where it would make sense to consider providing dedicated APIs/frameworks to address this underlying issue, which has been long-standing.

In summary, we have some fairly complex avionics built on top of the Nasal/Canvas stack, and they're much more sophisticated than other devices, despite the latter performing often much worse.

For the time being, it's unfortunately true that it takes a fair bit of expertise and background knowledge to structure your Nasal/Canvas code in a proper fashion.

Some senior contributors have come up with helper frameworks that are sooner or later going to be made available in a generic form, e.g. look at Richard's MFD framework, Emesary, the FG10000 or the original MapStructure/ND code.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12090
Joined: Tue Mar 25, 2008 8:40 am


Return to Cockpit development

Who is online

Users browsing this forum: No registered users and 1 guest