Board index FlightGear Development Aircraft

Unable to modify view point in C172P

Questions and discussion about creating aircraft. Flight dynamics, 3d models, cockpits, systems, animation, textures.

Unable to modify view point in C172P

Postby pablc » Sun Jul 19, 2020 2:51 pm

Hi all! I am trying to modify the Pilot's view position on the Cessna C172P to better fit my monitor, but I am struggling to get FG to read the properties. I found a few pages to follow such as this one: http://wiki.flightgear.org/Howto:Config ... FlightGear, and I had a look at the configuration XMLs.

In-sim, I can modify the property values of sim/current-view (through "/") and it works. It is when I try to make them persistent through XML files that I can't make them work.

I first wanted to keep my personal config on a separate XML, so that I could pass it through "--config=<my_file.xml>". I wrote one with the following code:

<PropertyList>
<sim>
<view>
<config>
<y-offset-m type="double">0.33</y-offset-m>
<z-offset-m type="double">0.42</z-offset-m>
</config>
</view>
</sim>
</PropertyList>

to no avail. Then, I tried to modify c172p-views.xml with my values, and it still doesn't work.

Anyone knows what is the best way to configure a view for personal use?
pablc
 
Posts: 7
Joined: Fri May 15, 2020 6:07 pm

Re: Unable to modify view point in C172P

Postby wlbragg » Sun Jul 19, 2020 8:27 pm

Depending on how far your trying to adjust it. It has a built in persistent seat positioning routine. Use alt+keypad and arrow keys. It will save your setting across sessions.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5594
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Unable to modify view point in C172P

Postby pablc » Thu Jul 23, 2020 11:10 pm

Thanks! That works up to a point (although it is restricted) but for now it is fine.

I can change the point of view in other aircrafts through the config file: I am currently doing that on the Twin Otter and the Citation II, just not in the C172P. Is this intentional behaviour?
pablc
 
Posts: 7
Joined: Fri May 15, 2020 6:07 pm

Re: Unable to modify view point in C172P

Postby wlbragg » Fri Jul 24, 2020 12:01 am

You should be able to define a.custom view same as any other view that has been defined.

I guess I would need a little more information as to what's not working and how your defining and selecting your custom view.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5594
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Unable to modify view point in C172P

Postby pablc » Sat Jul 25, 2020 2:14 pm

Thanks a lot for the help, and thank you for keeping the C172P alive. I never get tired of flying it :)

I am not defining a new custom view; I am trying to modify the properties in the default (Cockpit) view. For that, I have a small config file with the contents I mentioned in my first post, and I load that file through --config=<myfile.xml>. The Cockpit view seems to be configured through property sim/view. I am using this approach successfully on the Twin Otter and the Citation II: the view is changed according to my new values (I have different files for each plane).

What is not working: when I load my config file, the C172P ignores it, and the view is set up in exactly the same way as I left it in my previous session. Instead, I was expecting to see the cockpit view adjusted to the properties I set in my config file, just like it works in other planes.

You said that the C172P "has a built in persistent seat positioning routine". Could this mean I can't use the config file on the C172P to modify the existing Cockpit view? Does the positioning routine restore the state of the cockpit view from the previous session, instead of looking at the config file? Correct me if I am wrong, I haven't looked at the code.

I will also try your approach of setting a separate custom view.
pablc
 
Posts: 7
Joined: Fri May 15, 2020 6:07 pm

Re: Unable to modify view point in C172P

Postby wkitty42 » Sat Jul 25, 2020 2:35 pm

yes, it means that you cannot use the --config method to set the view position in the c172p...

what happens is that your config gets loaded and when the c172p loads, it loads the saved session data from last time as you found... so set the seat position in the craft and exit properly... then it will load your position the next time...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 6490
Joined: Fri Feb 20, 2015 3:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 14.04.5

Re: Unable to modify view point in C172P

Postby wlbragg » Sat Jul 25, 2020 4:30 pm

what happens is that your config gets loaded and when the c172p loads, it loads the saved session data from last time as you found...

I think that is correct, it's been awhile since I looked at that code. Maybe we should add the option to make it persistent so those that want to use a separate configuration file can?

What axis are you limited on that you want a greater range for?

You could change the allowed range of adjustment in the user defined seat adjustments in c172p-keyboard.xml, starting at about lines 195.
They look like this...
Code: Select all
                <command>property-adjust</command>
                <property>sim/current-view/y-offset-m</property>
                <step type="double">-0.005</step>
                <min type="double">0.15</min>
                <max type="double">0.25</max>

OR

You can comment out the persistence of the user defined seat position at or about lines 317-321 in the aircraft data section in c172p-main.xml.

Comment out these lines...
Code: Select all
            <path>/sim/current-view/user/x-offset-m</path>
            <path>/sim/current-view/user/y-offset-m</path>
            <path>/sim/current-view/user/z-offset-m</path>
            <path>/sim/current-view/user/pitch-offset-deg</path>
            <path>/sim/current-view/user/default-field-of-view-deg</path>


You may have to also comment out the initialization code in c172p.nas starting at about line 677.
Code: Select all
 # set user defined pilot view or initialize it
    settimer(func {
        if (getprop("sim/current-view/user/x-offset-m") != nil){
            setprop("sim/current-view/x-offset-m", getprop("sim/current-view/user/x-offset-m"));
        } else {
            setprop("sim/current-view/user/x-offset-m", getprop("sim/view/config/x-offset-m"));
        }
        if (getprop("sim/current-view/user/y-offset-m") != nil){
            setprop("sim/current-view/y-offset-m", getprop("sim/current-view/user/y-offset-m"));
        } else {
            setprop("sim/current-view/user/y-offset-m", getprop("sim/view/config/y-offset-m"));
        }
        if (getprop("sim/current-view/user/z-offset-m") != nil){
            setprop("sim/current-view/z-offset-m", getprop("sim/current-view/user/z-offset-m"));
        } else {
            setprop("sim/current-view/user/z-offset-m", getprop("sim/view/config/z-offset-m"));
        }
        if (getprop("sim/current-view/user/default-field-of-view-deg") != nil){
            setprop("sim/current-view/field-of-view", getprop("sim/current-view/user/default-field-of-view-deg"));
        } else {
            setprop("sim/current-view/user/default-field-of-view-deg", getprop("sim/view/config/default-field-of-view-deg"));
        }
        if (getprop("sim/current-view/user/pitch-offset-deg") != nil){
            setprop("sim/current-view/pitch-offset-deg", getprop("sim/current-view/user/pitch-offset-deg"));
        } else {
            setprop("sim/current-view/user/pitch-offset-deg", getprop("sim/view/config/pitch-offset-deg"));
        }
    }, 1);
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5594
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480

Re: Unable to modify view point in C172P

Postby pablc » Sun Jul 26, 2020 1:49 pm

Bingo. I modified the adjustment ranges and now I adjusted my "seat position" to my likings. I just added +0.05 to the z-offset-m ranges and set the stepping to 0.02 to give me a more fine-grain adjustment :)

Being able to set the view through a config file would be a nice-to-have, especially when my next pull of the fgdata repo gets rid of my changes to the keyboard shortcuts (although even that has an easy solution on my side, just rebase my patch after pulling). This said, I am very happy to change my view through the seat adjustment controls instead of a config file. It feels more realistic, even when it has limits (again, just like the real thing). I was just a bit confused as to why the config was not working, whether I was doing something wrong or it was just not the way to do it on the C172P. It's all clear now. Thanks both for your time!
pablc
 
Posts: 7
Joined: Fri May 15, 2020 6:07 pm

Re: Unable to modify view point in C172P

Postby wlbragg » Sun Jul 26, 2020 4:32 pm

If you thing the range is still realistic and the finer stepping is more useful, I'll push those changes to the dev repository version and they will come out in a future release. That is why it was put in there, we just wanted to at least attempt to limit it to something we felt was actually within real mechanical limits of what that seat might be able to do. Nobody ever used any math or schematics to judge the possible range by so it was a guess right from the start.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
Intel i5 3570K AMDRX480
User avatar
wlbragg
 
Posts: 5594
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/AMDRX480


Return to Aircraft

Who is online

Users browsing this forum: mhab and 6 guests