c172p-team / c172p

A high detailed version of the Cessna 172P aircraft for FlightGear
GNU General Public License v2.0
81 stars 43 forks source link

Autopilot alt preselect beep is disturbing on takeoff #239

Closed tigert closed 9 years ago

tigert commented 9 years ago

The kap140 alt preselector is afaik set to 0ft by default. This has the side effect that when you pass 1000ft on takeoff ypu get the alert of leaving altitude (the beeper you wonder what the heck it is??) :)

We need to check the behavior of the kap140 in this case - my memory says it has a persistent memory and people usually set something like 10000ft there to keep it quiet for usual flights as most of the time the AP is off on training flights.

However I can check the manual for the correct behavior and will get back to this :)

tigert commented 9 years ago

The thing with KAP140 altitude alerter is that it works even when the autopilot is not engaged, as long as the circuit breaker is on, and thus the unit gets power, and it can be used as a handy safeguard for keeping an eye on your altitude, because it will beep if you drift 200ft high or low. This is good and useful for cross country flying, but it can be disturbing when you do initial school flights or just want to fly around the airport or in the traffic pattern. And in this case it is disturbing for new Flightgear users in the to-be-default-aircraft since it just beeps and you don't know what is going on.

What usually happens in practice, is that for the flights when you do not use the autopilot or do not need the alerter, you just set the alerter to something like 5000 or 10000 feet so it is "out of the way" and never beeps in practice.

The manual (https://www.bendixking.com/HWL/media/PDF/PilotsGuides/PG-KAP140.pdf) does not make much comments about the persistence of the altitude preselect value, but I think it is persistent and survives through power off. A friend I asked also thinks this is the case.

Looks like the KAP140 logic is shared Nasal code in fgdata in Aircraft/Generic/kap140.nas, and it is being used by a bunch of aircraft, which is a good thing. Looks like the altitude alert/preselect value is set through /autopilot/KAP140/settings/target-alt-ft but this seems to be handled only one way (if you set it to 5000ft in properties, looks like the KAP140 user interface does not update to match, and it keeps its own internal state, and thus the value gets set to whatever the KAP140 code has stored internally when you touch the altitude knobs.

I think this needs to be dealt on the mailing list, as it is not exactly a c172p-detailed issue.

I think we need to do two things: first, make the setting persistent for each kap140-equipped aircraft, and make sure the initial first-time-ever value for the alerter is something like 5000 feet, so that it does not start beeping when you first try to get familiar with FlightGear and how to fly the aircraft. This change likely should be done in the KAP140 instrument itself, and thus not in C172P-detailed, or any other aircraft. The setting just needs to be exposed so that each aircraft can store its own persistent value.

(As a side thought, we should create most of the basic general aircraft instruments and avionics as shared like the KAP140, so making new aircraft would be simpler when you can just pick the common instruments and avionics from the shared set, and improvements to those would benefit everyone) - and your cockpit would be at least flyable without too much hassle with basic instrumentation.)

gilbertohasnofb commented 9 years ago

Oh, so this is the beep that has been annoying me for so long time!

I think this needs to be dealt on the mailing list, as it is not exactly a c172p-detailed issue.

That sounds like the best route, would you write them yourself describing what you wrote above?

wkitty42 commented 9 years ago

i'm not sure i understand this... i took off earlier from KPGA near the grand canyon... when i went to adjust, i think i was already in the air, when i finally got to 5000 or so the alarm was sounding... apparently because i was approaching 5000 on the AP and i was at 3000 or so... maybe i'm not understanding the AP altitude thing??

gilbertohasnofb commented 9 years ago

@tigert wrote:

I think this needs to be dealt on the mailing list, as it is not exactly a c172p-detailed issue.

Since this seems to be more work than we can do in a single day (including to discuss this in the list), maybe we should move this to the 3.8 milestone, what do you think, @onox?

onox commented 9 years ago

Let me check if I can still fix it.

gilbertohasnofb commented 9 years ago

Sure!

onox commented 9 years ago

@gilbertohasnofb I have a fix: if the autopilot tries to set the value to 0, I set it back to 20_000 ft. So if the user really wants 0 ft, then 20 ft should be selected.

gilbertohasnofb commented 9 years ago

@onox Sounds good to me. When you create a PR I will check it.

onox commented 9 years ago

Maybe it's better to set it 99980. Then you can quickly go to 00080 if you use shift.

onox commented 9 years ago

I think I'll fix that knob right away, currently I have to use shift instead of rotating outer knob.

onox commented 9 years ago

@gilbertohasnofb I have a fix. The code in Aircraft/Generic/kap140.nas is quite buggy, you can actually make the altitude preselect < 0 or >= 100_000 and there's code duplication. So perhaps we should rewrite it in 3.8 and maybe use <statemachine> stuff.

gilbertohasnofb commented 9 years ago

@onox so let me just see if I understand, you have a fix right now and on top of that you would like later to rewrite this nasal file, right? So should I open an issue for that so we don't forget?

onox commented 9 years ago

No need for an issue right now. Don't know whether I will actually rewrite it.

gilbertohasnofb commented 9 years ago

Ok.