c172p-team / c172p

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

Adjusting mixture keyboard sensitivity #623

Closed gilbertohasnofb closed 6 years ago

gilbertohasnofb commented 8 years ago

Reporter by kjd.nc in the forum:

C172p Mixture control is erratic

Hover the mouse over the mixture knob

  • Key 'm' repeatedly (don't hold it down) and watch the mixture % increase

Expected Result: for each keystroke, I expected the mixture to increase by 1% (controls.adjMixture(1)). Actual Result: somewhere between 12 and 25%, it jumps suddenly to, usually 38%. There are several non-incremental jumps.

Same thing happens with 'M' to decrease the mixture. Same kind of thing happens with my custom keyboard binding in effect to controls.adjMixture(5) and -5 instead of 1 and -1. Same thing happens on FG3.6 and on FG3.7, DMG dated 5 December. Same thing happens whether I'm using the laptop keyboard or an external bt keyboard. MacOS 10.11.2, MacBook Pro.

I haven't found any other aircraft whose mixture control advertised the current setting. If someone would like me to try one in particular, I'll be happy to download that model.

In reality it isn't erratic, but the behaviour isn't the best either. Pressing m increases the mixture by 0.00825 and then FG rounds it when hoovering (the opposite is true for M). This means that some numbers may be skipped, while others may appear twice. It's nitpicking, but it costs nothing to make the value 0.01.

gilbertohasnofb commented 8 years ago

@onox what do you think?

onox commented 8 years ago

Where do you see that number 0.00825?

gilbertohasnofb commented 8 years ago

Sorry, I was not very clear. It's the property controls/engines/current-engine/mixture, which ranges between 0.0 and 1.0. Set it to 0.0 then press m once, and it will increase by that value. But actually you must hit the key very quickly, anything longer will output something larger than 0.00825. So indeed it's very erratic as the user reported.

onox commented 8 years ago

Can you ask that user what controls.adjMixture(1) does for other aircraft?

gilbertohasnofb commented 8 years ago

Lines 222-227 from our engine.nas:

controls.adjMixture = func {
    var delta = arg[0] * controls.THROTTLE_RATE * getprop("/sim/time/delta-realtime-sec");
    var old_value = getprop("/controls/engines/current-engine/mixture");
    var new_value = std.max(0.0, std.min(old_value + delta, 1.0));
    setprop("/controls/engines/current-engine/mixture", new_value);
};
onox commented 8 years ago

I'm interested in knowing whether he always gets the same increment if repeats the experiment multiple times.

Also, in the c172p you get increments of 1 or 2 %, not 12 to 25 % when you press the m key.

onox commented 8 years ago

@gilbertohasnofb Here's the truth: Nasal/controls.nas in FGDATA uses THROTTLE_RATE and /sim/time/delta-realtime-sec for adjMixture. That file also defines adjThrottle, but in keyboard.xml it actually uses incThrottle, which does not use that /sim/time/delta-realtime-sec property, but instead always increments/decrements by 0.01.

onox commented 8 years ago

So if that user says that m key is erratic, it should be erratic for all airplanes.

gilbertohasnofb commented 8 years ago

I see. So is there a way to make at least our plane non-erratic from our side or would that require a modification to FGDATA?

onox commented 8 years ago

Well, first I want to know from that user if the m key is "erratic" for all this airplanes, because it should if the code uses controls.adjMixture.

gilbertohasnofb commented 8 years ago

I see, I will ask him.

onox commented 8 years ago

Second, we have to ask ourselves what kind of behavior we want. Do we want a consistent time between 0 % and 100 %, or do we want consistent increments, which means that the duration from 0 to 100 % will depend on the frame rate.

onox commented 8 years ago

If you're tuning the mixture/throttle while in flight you probably want consistent increments, but if you quickly need full throttle (when going around for example) then I would see we need consistent time.

onox commented 8 years ago

@gilbertohasnofb His propeller pitch (n/N) should be "erratic" as well.

gilbertohasnofb commented 8 years ago

Ok, I will inform him of these things and ask for tests.

gilbertohasnofb commented 8 years ago

Second, we have to ask ourselves what kind of behavior we want. Do we want a consistent time between 0 % and 100 %, or do we want consistent increments, which means that the duration from 0 to 100 % will depend on the frame rate.

The problem of that is if the changes aren't consistent, fine tuning becomes impossible. But that said, who needs to adjust mixture to 1% of precision anyway?

gilbertohasnofb commented 8 years ago

By the way, I forgot to add the link to the forum in case anyone is interested: http://forum.flightgear.org/viewtopic.php?f=68&t=28257

gilbertohasnofb commented 8 years ago

The user informed us that he isn't aware of large skips in mixture with other planes as most do not have tooltips, and he is going to watch that property I mentioned before and test other planes.

kjd-nc commented 8 years ago

Thanks for your help, Gilberto. I found the logging setting to capture the /controls/engines/engine/mixture value in the .csv log file, so I can check out some other aircraft that way. I just tried it again, using the C172 in FG36 with the default mixture resolution (adjMixture(+/-1)) and this time, the biggest jump I saw was from 42% to 48% in a single keystroke. I was probably tapping my key more slowly this evening than I was this morning.

I don't know what the frame rate on my mac is -- I've seen some mention of displaying it, but I haven't been able to find it this evening. If you'll advise how I can watch that, I'll enable it.

Kevin

onox commented 8 years ago

I don't know what the frame rate on my mac is -- I've seen some mention of displaying it, but I haven't been able to find it this evening.

Go to "Debug" and then click on "Cycle On-Screen Statistics". Press F10 to hide the menu bar. The frame rate is shown in the top left corner.

kjd-nc commented 8 years ago

On that flight, while sitting on the tarmac, which was where I was when I was testing the mixture behavior, I was getting between 20 and 30 FPS. Once I began flying, I normally was between 50 and 65, although sometimes it would get down into the 10's or 20's, at which point the sim did indeed get choppy.

If the answer to this issue is that it's an artifact of the real-time behavior of the control, I'm OK with that. I don't expect to be adjusting many controls by hair's breadths, especially not in a situation where I'd need high real-time performance.

gilbertohasnofb commented 8 years ago

@kjd-nc but can you tell if those large skips happen when the sim get choppy? If yes, then that may explain the problem.

gilbertohasnofb commented 8 years ago

@kjd-nc I am closing this issue given what we wrote in the forum:

If you do happen to see it again, let us know and this will be reopened.

onox commented 8 years ago

I thought I had written here that I get different time durations (from 0 to 100 %) depending on FPS, which isn't what I expected. Can anyone reproduce this?

gilbertohasnofb commented 8 years ago

I must have missed that, @onox. But how do you test that?

onox commented 8 years ago

Use a stopwatch or your phone to measure the time it takes to go from 0 to 100 % :smile:

gilbertohasnofb commented 8 years ago

Oh, so the difference is that huge! :fearful:

onox commented 8 years ago

You have already done the measurements?!

onox commented 8 years ago

I mean you measure the time it takes while at 10 FPS and while at 40 FPS for example. Going from 0 to 100 while at 10 FPS is much faster here.

gilbertohasnofb commented 8 years ago

You have already done the measurements?!

Nope, but if you can spot it with all the imprecision of a stopwatch then it must be huge, else that's just experimental error (time it takes to press the buttons, your reflex to react, etc.).

I am doing tests now and I will let you know.

gilbertohasnofb commented 8 years ago

My results, three tries for each situation:

@35 fps:

avg: 3"82

@20 fps:

avg: 2"59

It's indeed a huge difference, at slower fps I get like 30% or more response!

onox commented 8 years ago

Yes, that's what I get too. I'll have to think about whether I can do something about this.

gilbertohasnofb commented 8 years ago

Hmm....

onox commented 8 years ago

I plan to change the behavior as follows:

  1. If you press m/M or 9/3/page_up/page_down you increase/decrease mixture or throttle by 1 %.
  2. If you keep the key pressed then after a very short duration (a bit longer than the time you need to press and release a key) it starts to continuously increasing/decreasing at a rate of, let's say, 3 seconds for 0 to 100 %.
  3. I'll reduce the step for the cabin heat/air knobs from 10 % to 5 % per mouse wheel.
kjd-nc commented 8 years ago

So if I need to lean out to, say, 70%, then I would press and hold M until my EGT peaks, and then enrich just a little? Will the EGT gauge respond quickly enough to keep pace with the press-and-hold rate?

onox commented 8 years ago

Will the EGT gauge respond quickly enough to keep pace with the press-and-hold rate?

That question is not really relevant to this issue. What I intend to change is to give you the ability to get precise increments of the mixture when you give a single key press.

(I would hold m to get to 70 %, then release and give separate key presses until EGT peak.)

kjd-nc commented 8 years ago

Perhaps I'm misunderstanding how the pilot is supposed to set the mixture. Does he look it up in a table in the POH? I'd read that the way it was done was to lean it until EGT peaks, then set a little rich from there. If the latter is the case, then I won't know whether I need to be at 70% or at 20% until the needle tells me. If you know from the POH that 70% is the correct setting for these conditions, then I agree, the responsiveness of the gauge is not relevant.

If the gauge lags one second behind the knob, then by the time the needle shows peak, the knob will be at 20%, and I'll need to hit 'm' 50 times to get back to the proper setting. I'd think we'd want to change the full-range scale from 3 seconds to maybe 5 or maybe 7, to allow you to stop closer to the correct value.

If there is such a lag, then perhaps 5 or 7 seconds would be a better value for the full 100% range.

onox commented 8 years ago

If you set the mixture to 20 % the engine dies. Before takeoff you set it to rich. After takeoff, and depending on altitude, you gradually lean it (by watching the EGT).

kjd-nc commented 8 years ago

Is the intent to use press-and-hold to "gradually lean [mixture] by watching the EGT", or to use single keystrokes? If you'll press-and-hold, then it ought to be gradual enough that one can react to the EGT needle.

We might be thinking the same thing, just using awkward words to describe it. One should not accidentally kill the engine by press-and-hold while waiting for the EGT needle to peak.

onox commented 8 years ago

Let me describe how m/M currently work:

  1. If you press m key once, the mixture increase between 1, 2, or 3 %. How much depends on the value of the /sim/time/delta-realtime-sec property.
  2. If you hold m, the mixture keeps increasing as long as you keep that m key pressed. It should go from 0 to 100 % in a fixed amount of time. At least, that's the theory. In reality it depends on the frame rate. See https://github.com/Juanvvc/c172p-detailed/issues/623#issuecomment-164433300

What I want to change is to make sure that for point (2) the duration is fixed, no matter your frame rate. And for point (1) that the increment is guaranteed to be 1 %.

So you hold m to quickly move the mixture from, let's say, 0 %, to, let's say, 70 or 80 %. And for fine-tuning you give separate key presses. (Because these are guaranteed to be 1 % increment steps)

So the issue is about the behavior of the mixture knob/slider itself, not any systems/engines/instruments that are (in)directly affected by it.

kjd-nc commented 8 years ago

OK, I've got that much. Now, after you've held 'm' to go to 100% rich and have climbed up to cruise, now you need to lean it out. Do you press and hold 'M' or do you tap it repeatedly?

wkitty42 commented 8 years ago

i would guess that that depends on how much you need to lean it out... hold it for a second or two and see where you end up and then tap it which ever way you need to go from there...

kjd-nc commented 8 years ago

"that that depends on how much you need to lean it out" How do you know how much? The textbook says, by watching the EGT gauge. This is why I suggested that the time it takes for the knob to move full range ought to be greater than the time it takes for the EGT gauge to respond.

You and I know that one second, or a little more, will be adequate, because we've done it before and we know we want to end up somewhere around 70%. A new sim flier who has actual aircraft experience will likely know the same. A new sim flier who's never had an intro flight won't know that.

A pure novice, upon seeing the instruction to lean the mixture until EGT peaks and then enrich slightly, I think will tap M a few times and notice that the EGT needle barely moves. Then I think he would press and hold M until the needle moves.

To be clear, I agree with the core of this enhancement -- to change the press-and-hold behavior so that the time required to move full-range does not vary by frame rate. The only point I'm debating is the length of time. I agree that for the original proposed scenario, in which the aircraft is cold and dark, mixture is at 0%, and I need to set it to 100% for takeoff, 3 seconds is a much better choice than 5 or 7. But if we go too quickly in the case of leaning out for cruise, the engine will die.

Hm... do we need different time ranges depending on whether the engine is started or not? Maybe the knob moves more slowly when the engine is running? Hm, then it takes longer to lean it out for shutdown. Maybe we kick in the accident-avoidance time range when airspeed > ambient wind, or airspeed > stall * 0.5?

gilbertohasnofb commented 8 years ago

@kjd-nc I honestly do not understand the issue here, for me the EGT gauge seems quite responsive and I find it extremely easy to find it's peak. Maybe you are having some troubles with the leaning technique itself?

kjd-nc commented 8 years ago

I just did the following.

If I press and hold M until the EGT needle starts to move, then it doesn't do too bad at getting me into the ballpark. If, however, I press and hold M until I can see the peak, then every time I overshoot badly enough to kill the engine.

I know this is being too heavy-handed on the mixture, because I've done it before and I know what to expect. A first-time flier won't know that... but he will the second time. Maybe for this reason it's not a significant issue -- yes a novice will likely kill his engine, but that's part of the process of learning how to operate the mixture control.

gilbertohasnofb commented 8 years ago

Take a look at this, it's about a 182 model but the techniques are pretty much the same for the 172 as far as I know. It also explains the two techniques for leaning (best economy and best performance): http://www.gaceflyingclub.com/member%20download/LeaningArticle.pdf

3) Make mixture changes slowly-it makes for more accurate mixture settings

kjd-nc commented 8 years ago

I'm happy to learn more about flying, but as far as this discussion goes, I'm considering the novice sim flier. Do we expect a rookie to read this article before flying the sim?

I'm suggesting that we add a dash of idiot-proofing to avoid discouraging a rookie before he learns the finer points of the aircraft. If the consensus of the group is that either:

onox commented 8 years ago

Do we expect a rookie to read this article before flying the sim?

If you're drunk or if you're a complete idiot, you can still get from A to B (or near B if you're drunk) by using autostart, 100 % throttle and pointing the nose at where you want to go. Is that the optimal way of operating the aircraft? No. So if a rookie wants to learn how to properly fly the aircraft, the rookie needs to read articles and/or the POH. FlightGear is a program that simulates aircraft, so some reading is required if you properly want to operate them.

I'm suggesting that we add a dash of idiot-proofing to avoid discouraging a rookie before he learns the finer points of the aircraft.

If you know you need to monitor the EGT instrument when leaning, you're no longer a rookie :smile:

he won't get discouraged and quit even if he kills his engine learning how to operate the mixture Then I am ok with the three-second range.

If life makes a mistake, it either learns from it and adapts or it doesn't. It's called evolution :stuck_out_tongue_winking_eye: If someone gets discouraged after killing the engine and quits, then don't think I will shed a tear.

onox commented 8 years ago

Anyway, this discussion is getting off-topic.

gilbertohasnofb commented 6 years ago

@onox reading through this I think this is a won't fix, do you agree we can close it?