Board index FlightGear Development Aircraft Autopilot and route manager

FLCH like real planes! ACHIVED READ PAGE 3

Designing a stable autopilot is one of the hardest things. Need help?

FLCH like real planes! ACHIVED READ PAGE 3

Postby Octal450 » Wed May 18, 2016 5:53 am

I am developing a FLCH system that works like real planes, climb thrust (abuot 95% or so) or idle thrust, and then varying pitch trim to adjust speed, gives maximum descent and climb rates for the selected speed. Unfortunately, despite everything I have tried, the system overreacts, and therefor never settles on the selected speed. I could not find this in other planes/wiki.

My current PID controller.

Code: Select all
<!-- IAS FLCH -->

 <!-- Hold speed by varying pitch trim (Two stage cascading controller) -->
 <pid-controller>
    <name>Speed hold (vary pitch trim) Stage #1</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/altitude</prop>
      <value>altitude-with-ias</value>
    </enable>
    <input>
      <prop>/autopilot/internal/lookahead-5-sec-airspeed-kt</prop>
    </input>
    <reference>
      <prop>/autopilot/settings/target-speed-kt</prop>
    </reference>
    <output>
      <prop>/autopilot/settings/target-pitch-deg</prop>
    </output>
    <config>
      <Kp>-1.0</Kp>
      <beta>1.0</beta>
      <alpha>0.1</alpha>
      <gamma>0.0</gamma>
      <Ti>1.0</Ti>
      <Td>0.00001</Td>
      <u_min>-15.0</u_min>
      <u_max>15.0</u_max>
    </config>
  </pid-controller>

 <pid-controller>
    <name>Speed hold (vary pitch trim) Stage #2</name>
    <debug>false</debug>
    <enable>
      <prop>/autopilot/locks/altitude</prop>
      <value>altitude-with-ias</value>
    </enable>
    <input>
      <prop>/orientation/pitch-deg</prop>
    </input>
    <reference>
      <prop>/autopilot/settings/target-pitch-deg</prop>
    </reference>
    <output>
      <prop>/controls/flight/elevator-trim</prop>
    </output>
    <config>
      <Kp>-0.05</Kp>
      <beta>1.0</beta>
      <alpha>0.1</alpha>
      <gamma>0.0</gamma>
      <Ti>1.0</Ti>
      <Td>0.00001</Td>
      <u_min>-1.0</u_min>
      <u_max>1.0</u_max>
    </config>
  </pid-controller>


Any shortcuts available, or just tons and tons of tuning.
Last edited by Octal450 on Wed Jul 20, 2016 3:38 am, edited 1 time in total.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 18, 2016 5:56 am

Take a look in the 757 or 767. I setup a proper FLCH mode for both. I'll probably do it for the MD-11 too when I tune up the AP for the new FDMs.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 6:07 am

@tikibar
If only I was as good at this stuff as you, I really should look into your code more often.

I've only been developing for about 4-5 months.
I guess instrument modeling is still my strong area.

But I do not see the proper FLCH in the 757?
It seems to do the same as ALT, climb at a fixed value. I am trying to have it adjust the pitch to hold a speed when the throttle is at full idle, or full climb power. I have implemented a custom autothrust selection system already, so I need something that will vary the pitch to hold speed.

I see:

Code: Select all
  <pi-simple-controller>
    <name>Altitude Stage 1</name>
    <debug>false</debug>
    <enable>
      <condition>
        <or>
          <equals>
            <property>instrumentation/afds/ap-modes/pitch-mode</property>
            <value>ALT</value>
          </equals>
          <equals>
            <property>instrumentation/afds/ap-modes/pitch-mode</property>
            <value>FLCH SPD</value>
          </equals>
        </or>
      </condition>
    </enable>
    <input>
      <prop>instrumentation/altimeter/indicated-altitude-ft</prop>
    </input>
    <reference>
      <!--prop>/autopilot/settings/target-altitude-ft</prop-->
      <prop>/autopilot/settings/altitude-setting-ft</prop>
    </reference>
    <output>
      <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </output>
    <config>
      <Kp>0.15</Kp>
      <Ki>0.0</Ki>
      <u_min>
        <value>-16.67</value>
      </u_min>
      <u_max>
        <value>16.67</value>
      </u_max>
    </config>
  </pi-simple-controller>

  <pid-controller>
    <name>Altitude Hold (Altimeter based) Stage 2</name>
    <debug>false</debug>
    <enable>
      <condition>
        <or>
          <equals>
            <property>instrumentation/afds/ap-modes/pitch-mode</property>
            <value>ALT</value>
          </equals>
          <equals>
            <property>instrumentation/afds/ap-modes/pitch-mode</property>
            <value>FLCH SPD</value>
          </equals>
        </or>
      </condition>
    </enable>
    <input>
      <prop>/velocities/vertical-speed-fps</prop>
    </input>
    <reference>
      <prop>/autopilot/internal/target-climb-rate-fps</prop>
    </reference>
    <output>
      <prop>/autopilot/internal/target-pitch-deg</prop>
    </output>
    <config>
      <Kp>0.3</Kp>
      <beta>1.0</beta>
      <alpha>0.1</alpha>
      <gamma>0.0</gamma>
      <Ti>10.0</Ti>
      <Td>0.0</Td>
        <u_min>
            <prop>instrumentation/afds/settings/pitch-min</prop>
        </u_min>
        <u_max>
            <prop>instrumentation/afds/settings/pitch-max</prop>
        </u_max>
    </config>
  </pid-controller>


Regards,
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 18, 2016 6:20 am

That's an old version. FLCH is pretty new to the 757.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 6:21 am

@tikibar, OK, I will grab the latest.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 6:30 am

@tikibar
I am in the process of adapting it now.

How is this defined:

Code: Select all
<prop>instrumentation/afds/settings/pitch-min</prop>
<prop>instrumentation/afds/settings/pitch-max</prop>
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 18, 2016 7:05 am

It's hard coded in the AFDS.nas script.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 7:09 am

@Tikibar
Thanks
I assume its one of these?

Code: Select all
        m.pitch_min = m.AFDS_settings.initNode("pitch-min",-10);
        m.pitch_max = m.AFDS_settings.initNode("pitch-max",15);
   m.flch_min = m.AFDS_settings.initNode("flch-min",-16.67);
   m.flch_max = m.AFDS_settings.initNode("flch-max",16.67);
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby legoboyvdlp » Wed May 18, 2016 12:22 pm

The 737-800 probably has the best FLCH implementation in FlightGear. It is rather nice. Grand job, both of you!
User avatar
legoboyvdlp
 
Posts: 7088
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: 2018.3.1
OS: Windows 10 HP

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 4:59 pm

@legoboyvdlp
Yep, but the 737-800 uses Soitanen's proprietary autoflight, and there would be to much work to adapt that, and honestly nothing works really well on that plane yet.

The A340s and MD-88/MD-90 and 717 will get this systems.
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 18, 2016 5:19 pm

It's also slated for the 747-8.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Wed May 18, 2016 5:21 pm

@tikibar
Wonderful
But where these lines correct?

Code: Select all
m.pitch_min = m.AFDS_settings.initNode("pitch-min",-10);
m.pitch_max = m.AFDS_settings.initNode("pitch-max",15);
m.flch_min = m.AFDS_settings.initNode("flch-min",-16.67);
m.flch_max = m.AFDS_settings.initNode("flch-max",16.67);
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Wed May 18, 2016 5:40 pm

Yeah, the pitch-min and pitch-max correspond. flch-min and max are there to help the transition from speed with pitch to ALT and keep it from freaking out.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Re: FLCH like real planes!

Postby Octal450 » Thu May 19, 2016 7:14 pm

I got that part done, the last thing I need is the lookahead for the airspeed. I found the Mach lookahead predictor in 757-autopilot.xml, but could not find the 10 second lookahead for airspeed. Where is this?
Also where is the target pitch converted to elevator trim?
Waste of time. Goodbye forever.
Octal450
 
Posts: 4398
Joined: Tue Oct 06, 2015 12:51 pm

Re: FLCH like real planes!

Postby tikibar » Thu May 19, 2016 8:26 pm

That's in $FG_DATA/Aircraft/Generic/generic-autopilot-helper.xml. If you include this in the -set.xml file (or in 757-main.xml in this case) alongside the custom AP for the aircraft, you get a bunch of helper functions including the airspeed lookahead. It doesn't have a mach predictor, so I took on from the DC-10-30 and modified it.
Boeing 747-8 (rename folder to 747-8i)
Boeing 757-200/300 (rename folder to 757-200)
Boeing 767-300/ER (rename folder to 767-300)
McDonnell Douglas MD-11 (rename folder to MD-11)
User avatar
tikibar
 
Posts: 514
Joined: Mon Mar 05, 2012 6:05 am
Location: Los Angeles
Callsign: CHT0009
OS: Ubuntu 14.04

Next

Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 1 guest