Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nd): wind and speed display update rate for more frequent updates #9829

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bulenteroglu
Copy link
Contributor

@bulenteroglu bulenteroglu commented Feb 5, 2025

Fixes #[issue_no]

Summary of Changes

Increased event subscription frequency from 2Hz to 10Hz for wind/speed updates

Video Demo

Demo of braking
https://youtu.be/HNmfSFqwQlA

Demo of taking off
https://youtu.be/2K3j6WIwcJw

References

A380 VIDEO
https://youtu.be/hDh_9MEz-hg?si=lJ4N-CDYFLmz8xo1&t=93

A320 VIDEOS
https://youtu.be/TEi-WX08ov8?si=xCeeyAiIY2FiGs_7&t=36
https://youtu.be/WF7XWAUmOKY?si=SozzSBCR8cKFhM7_&t=539

Look at the ND and watch the wind direction and speed values change

Additional context

Discord username (if different from GitHub): senolitam

Testing instructions

A32NX & A380X

  • During flight:

  • Observe wind direction and speed values on Navigation Display (ND)

  • Values should update more frequently compared to previous behaviour

  • During landing/braking:

  • Monitor ground speed values

  • Speed changes should be more responsive and less delayed during braking

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo, flybywire-aircraft-a380-842 (4K) or flybywire-aircraft-a380-842 (8K) download link at the bottom of the page

@bulenteroglu bulenteroglu changed the title Fix wind and speed display update rate for more frequent updates fix(nd): wind and speed display update rate for more frequent updates Feb 5, 2025
@@ -532,7 +532,7 @@ class SpeedIndicator extends DisplayComponent<{ bus: EventBus }> {

sub
.on('groundSpeed')
.atFrequency(2)
.atFrequency(10)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question to the maintainers, I had a gander around the codebase to see other values being used with atFrequency - I went with 10, it does the job but also wanted to make sure this value is sensible

Copy link
Member

@lukecologne lukecologne Feb 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just looked it up and it seems the wind speed and direction are indeed transmitted every 100ms, so 10Hz is correct. Ground speed and true heading is transmitted every 40ms, and true airspeed every 125ms.
Although this is done at the level of the transmitting unit (i.e. IR/ADR) in the real aircraft

@flogross89
Copy link
Contributor

flogross89 commented Feb 5, 2025

Before changing this, we should really separate the high-frequency SVG parts from the lower frequency SVG parts, meaning the wind indicator (or the complete info section at the top) should get its own <svg> tag. Otherwise this would lead to considerable performance degradation

@flogross89 flogross89 closed this Feb 5, 2025
@flogross89 flogross89 reopened this Feb 5, 2025
@flogross89
Copy link
Contributor

Sorry, clicked "Close with comment" instead of just "Comment" :)

@bulenteroglu
Copy link
Contributor Author

Before changing this, we should really separate the high-frequency SVG parts from the lower frequency SVG parts, meaning the wind indicator (or the complete info section at the top) should get its own <svg> tag. Otherwise this would lead to considerable performance degradation

Can I get a bit more info on this? Just so I can get started if its a "small" task.

@flogross89
Copy link
Contributor

@bulenteroglu Sure!
Currently, <WindIndicator> and <SpeedIndicator> (fbw-common\src\systems\instruments\src\ND\ND.tsx, lines 428-429) are both part of one SVG element spanning all ND elements, when the ND is displayed. The SVG element for that is defined in line 371 (on current master). One of the elements inside the SVG changing is leading to the whole SVG being redrawn (I'm fuzzy on the details, but that's how I understand it). So with your PR, the whole ND SVG would be redrawn 10 times per second, which degrades performance.

In the end we should have separate SVG element for the Wind and SpeedIndicator, and leave the rest of the ND as is for now. Look at line 352, it's done similarly there.

@lukecologne
Copy link
Member

lukecologne commented Feb 7, 2025

Would it actually redraw at that frequency? Because the values are rounded, I would expect a significantly slower redraw rate (unless the values are actually changing very quickly, which I'd say is rare)

@flogross89
Copy link
Contributor

Would it actually redraw at that frequency? Because the values are rounded, I would expect a significantly slower redraw rate (unless the values are actually changing very quickly, which I'd say is rare)

I wouldn't expect it to be much lower, as we can see in the videos above the wind direction changes quite a lot relative to the aircraft, even more so if it's gusty. It's still a change we need to do in our instruments, so better start doing it now :)

@tracernz
Copy link
Member

tracernz commented Feb 9, 2025

In the end we should have separate SVG element for the Wind and SpeedIndicator, and leave the rest of the ND as is for now. Look at line 352, it's done similarly there.

If we are doing that it would be best practice to just do them in HTML for much better perf. SVGs should generally be static only for best perf in Coherent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🟡 Code Review: Ready for Review
Development

Successfully merging this pull request may close these issues.

4 participants