c172p-team / c172p

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

Rudder Trim #1217

Closed legoboyvdlp closed 5 years ago

legoboyvdlp commented 5 years ago

The POH of a 1982 Model P which I have suggests rudder trim is an option, apart from the manual rudder trim tab that can only be moved on the ground:

image

I am not certain if the cockpit control moves the manual tab (i.e. should adjust the permanent rudder trim factor we have) or is separate (should be SUMMED to the permanent rudder trim factor)

The manual tab is this part: image

According to Figure 7-1, the rudder trim control is a wheel exactly like the elevator trim, but mounted below the elevator trim at 90 degrees.

This feature is probably not common, but is definitely an option.

wlbragg commented 5 years ago

Yes, I think you can add the rudder trim into the same function as the interpolated rudder-trim-knob.

wlbragg commented 5 years ago

This is what I had in mind

<fcs_function name="ruddertrim2 trem">
    <function>
        <sum>
            <input>controls/flight/rudder-trim</input>
            <table>
                <independentVar lookup="row">controls/flight/rudder-trim-knob</independentVar>
                <tableData>
                    -6.8   -0.05
                     0      0
                     6.8    0.05
                </tableData>
            </table>
        </sum>
    </function>
</fcs_function>
wlbragg commented 5 years ago

I may be using the wrong rudder-trim property as your example suggests.

dany93 commented 5 years ago

Currently, the controls/flight/rudder-trim is the one which is preset at 0.02 in the c172-set.xml file (line 585). What I call the 'first term'. That is, the 'mechanics' tab, set on the ground.

wlbragg commented 5 years ago

OK, so my example above should work correctly?

wlbragg commented 5 years ago

The feel of the rudder trim knob is pretty good at 100 steps. It could potentially be reduced some if others think it is not sensitive enough. Dragging could be a little better and also the mouse up/down or mouse scroll could be slightly faster. If we can do the conversion from rudder-trim-knob 6.8 to rudder-trim value in the FDM like the examples, then we can tune the knob animation however we want.

wlbragg commented 5 years ago

After further testing of the animation, I wouldn't go lower than 50 steps. It a little faster to the limits yet the steps are still not too noticeable. But 100 is smoother and I think matched the elevator trim feel the best.

wlbragg commented 5 years ago

Hum, controls/flight/rudder-trim is not used anywhere in our FDM. Is it a tied property directly to FG source?

wlbragg commented 5 years ago

It must be as it does change the final rudder position.

legoboyvdlp commented 5 years ago

Looks like you did my job for me :grin:

I take it nothing was commited with regards to the FDM? If so I will implement this tomorrow and commit.

wlbragg commented 5 years ago

:fearful: That was not my intention, more out of curiosity than anything. No, nothing is committed yet. I've been trying to put it all together in the FDM unsuccessfully. I'm sure you will be able to figure it out though I did notice though that it looks like the property controls/flight/rudder-trim is being calculated in the FG source, rolled into

<aerosurface_scale name="Rudder Control">
                <input>fcs/yaw-trim-sum</input>
                <gain>0.01745</gain>
                <range>
                    <min>-16</min>
                    <max>16</max>
                </range>
                <output>fcs/rudder-pos-rad</output>
            </aerosurface_scale>

So somehow you have tie only the new table date into this function. I think controls/flight/rudder-trim is already included and thus does not need to be added into the new function.

legoboyvdlp commented 5 years ago

Thanks for the help :smiley:

Should I do this on the frost-and-fog branch? It's not... really to do with frost and fog, but I understand working across branches in Blender is definitely not desirable.

dany93 commented 5 years ago

Observe (variation with rudder-trim between -1 and +1, rather 0.2 to 0.5, and sum with rudder setting):

controls/...
flight/rudder-trim,
fdm/jsbsim/fcs/...
yaw-trim-cmd-norm
yaw-trim-sum
rudder-control
rudder-pos-deg
rudder-pos-rad
rudder-position-normalized

What I think is to be done: (c172p.xml, lines 813...) Guessed per observation, not tested.

            <summer name="Yaw Trim Sum">
                <input>fcs/rudder-cmd-norm-filtered</input>
                <input>fcs/yaw-trim-cmd-norm</input>
                <input>fcs/yaw-trim-cockpit</input>
                <clipto>
                    <min>-1</min>
                    <max>1</max>
                </clipto>
            </summer>

fcs/yaw-trim-cmd-norm is equal to controls/flight/rudder-trim, (mechanics stab). Preset to 0.02 In c172p-set.xml. fcs/yaw-trim-cockpit is your cockpit setting contribution. Its max amplitude is to be determined (up to 0.05? up to 0.1?).

wlbragg commented 5 years ago

@legoboyvdip no, go ahead and make a new PR and branch. This will be a new blender file.

wlbragg commented 5 years ago

Unrelated issue. I think we have a problem with the autopilot. My elevator trim starts slowly changing from its initial setting to .23 as soon as I turn on the autopilot.

dany93 commented 5 years ago

Are you sure that it is a problem? The autopilot uses the elevator trim (and the elevator value) to hold the altitude. (EDITED, my mistake) 0.23 is the approximate value for the elevator trim at cruise (about 115 - 120 kt). Try another velocity (lower velocity) and observe the values set by the autopilot. Elevator trim 0 is for low velocity, it gives approximately the climbing just after takeoff.

wlbragg commented 5 years ago

OK, maybe not a problem then. I wasn't sure how it worked. Can you use only heading ctrl and no altitude control? It seems even if I have "Alt" off VS is displayed and the trim dial still moves to add trim.

legoboyvdlp commented 5 years ago

I think the KAP140 holds VS anytime the autopilot is on and no other alt mode is selected?

wlbragg commented 5 years ago

OK, thanks!

legoboyvdlp commented 5 years ago

To confirm, how much should the knob adjust the trim?

+- 0.005 either way?

(0.015 - 0.025)?

wlbragg commented 5 years ago

I tested it at -.05 to .05 and it wasn't too extreme. I think it is going to be at least .05 if not .1

wlbragg commented 5 years ago

So you may want to start with .05.

wlbragg commented 5 years ago

@legoboyvdlp I basically ended up with this entire issue finished locally. You want me to go ahead and make a branch and PR for it? Then all you have to do is test, test, and test some more? It just ended up that way as I was working on the mesh and GUI for it.

legoboyvdlp commented 5 years ago

Sure, that's fine :smiley:

wlbragg commented 5 years ago

Is the rudder trim supposed to be persistent?

dany93 commented 5 years ago

Why not as long as you don't change it ? (or I've not understand well?)

wlbragg commented 5 years ago

Two things... 1) If you select not to use the rudder trim option in the GUI then the combined summer for rudder trim should be set to the default without the trim option, ie: the fcs/yaw-trim-cockpit property needs to be set to 0. I forgot to take care of this. 2) If you use rudder trim option then whatever setting you have it set to when exiting the sim should either be persistent or not?

wlbragg commented 5 years ago

Note to myself: the rudder trim hover tool tip is currently not updating on the fly, see method employed by elevator trim as it is working correctly.

dany93 commented 5 years ago

If you use rudder trim option then whatever setting you have it set to when exiting the sim should either be persistent or not?

In reality, everything let me think it should be persistent. It is a mechanical setting. In the sim, it is your choice.

wlbragg commented 5 years ago

OK, I redid the logic for the rudder trim knob and I think it is much better now, both functionality and feel. It is setup like the elevator trim. If you select "Save state of aircraft between sessions" and you leave the "Show rudder trim option" selected, then the rudder trim setting is persistent and the rudder trim knob is visible upon the next startup. If you don't select "Save state of aircraft between sessions" and you leave the "Show rudder trim option" selected, then rudder trim setting is reset to 0 and the rudder trim knob is visible upon the next startup. Finally if you leave the "Show rudder trim option" un-selected, then rudder trim setting is reset to 0 and next start up the rudder trim in not visible. Also now the rudder trim knob has a visible range from -.18 to .18 and is really smooth scrolling. For now the -.18 to .18 still converts to -.05 to .05.

gilbertohasnofb commented 5 years ago

@wlbragg your temporary texture looks really good actually, I will have very little work on this one! The only annoying thing is that you need the panel background texture around the plaque with the text, which means that each livery will need that being redone and will need a new file. Let me propose a different approach then, one adding no new files: what if we add the new textures to panel.png and use some of the background already there? E.g., the new textures are in the red area and you could use the purple area to map for the plastic mount around the rudder trim:

image

If you think that could work then I can push it already now for the 4X-CHV panel and, once this texture is stable, I would sync with the other liveries. If that works for you then just please clarify to me once again to what branch should I push this to.

And one more closing thought: once this feature is ready, let's please merge all these PRs before doing any further work.

wlbragg commented 5 years ago

I'm not at home right now so I can't really respond reliably right now. I think what your asking for is fine as I originally was going to use the original textures.

gilbertohasnofb commented 5 years ago

@wlbragg Great, let me know and I can push the texture for you.

wlbragg commented 5 years ago

@gilbertohasnofb if you can use this UV layout to fit the label into, then I think this will work.Make sure the black extends all the way to or past the edge.

I can resize the knob and knob metal slider part as you need for the texture. But the label needs to fit in the layout fairly precisely.

uv-rudder-trim

wlbragg commented 5 years ago

@gilbertohasnofb I don't know that we will be happy with the resolution of the base background?

trim

This is basically doing what you asked. I mapped the background to that area above the elevator trim.

gilbertohasnofb commented 5 years ago

@wlbragg yeah, that is not looking too good. I will then still use panel.png but I will create a new patch of the leather texture for that part. Could you revert the 3D model as to what you had before then? I see that you simplified a bit the format of the rudder trim black label thing:

image

So try this new texture, I am pushing now. These are the locations:

image

gilbertohasnofb commented 5 years ago

Once you mapped it and you are satisfied, I will sync the textures and colour the leather bit accordingly.

wlbragg commented 5 years ago

Arg, this is being difficult. How about this, can you make the label fit like this?

uv-rudder-trim uv-rudder-trim1

gilbertohasnofb commented 5 years ago

Arg, this is being difficult. How about this, can you make the label fit like this?

I think we are nearly there, just one more iteration and we will get this done. I think I can squeeze the texture where you recommend it, let me give it a try and push a new version.