Board index FlightGear Development Aircraft Autopilot and route manager

CRJ700 autopilot corrections

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

CRJ700 autopilot corrections

Postby fredsie » Wed Aug 14, 2019 2:23 pm

Hi all

I've been experimenting with the Bombardier autopilot and seem to be doing OK with it. It follows the flight plan really well most of the time, however on passing a waypoint it seems to get a bit frantic in an attempt to accurately capture the exact point, going into extreme banks both ways for a few seconds. This would involve excessive sick bag costs. The 777 autopilot on the other hand seems to approach within a mile or so of a waypoint and then set its sights on the next one, creating a gentle curve towards the next waypoint. Or could it be I'm just going a bit too fast? (300kt at 30000 ft)

Cheers

Fred
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15

Re: CRJ700 autopilot corrections

Postby tdammers » Wed Aug 14, 2019 2:42 pm

Which version of the CRJ are you using? I've done a good bit of work on it, but I don't think those changes have made it into FGADDON (and personally, I'm too lazy to push for that to happen).

The feature you want is called "turn anticipation", a feature I've added to my version; it takes ground speed into account, so it should work fine regardless of altitude and speed (though it does not currently correct for wind, so if you're flying slow in heavy wind, it's going to over- or undershoot a bit). My version also includes some massive improvements of the autopilot and a working yaw damper, both courtesy of Octal from IDG (the main person behind the IDG A320, A330, and PA-28), improved PFD and MFD, fixed elevator trim, proper FADEC throttle controls, OP CLB and OP DSC autopilot modes, and bunch of other fixes.

The updated CRJ700 can be downloaded from here: https://github.com/tdammers/CRJ700-family/. If you're familiar with git, just clone that repo in a convenient location, otherwise, click "clone or download", then "download zip"; unzip in your Aircraft directory and remove the "-master" bit from the directory name.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: CRJ700 autopilot corrections

Postby fredsie » Wed Aug 14, 2019 2:55 pm

Oh right, thanks. Yes, turn anticipation is exactly it.
I confess I'm never sure exactly what version of a plane I have. I'm using FG from the OpenSuse repos which at the moment stands at V 2018.3.2, and the plane is the first listed "Bombardier CRJ700 with tutorials". I'll have a go at replacing it with your github version if I can find where the original resides on my system.

Thanks for the quick response!


Fred
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15

Re: CRJ700 autopilot corrections

Postby tdammers » Wed Aug 14, 2019 3:21 pm

If you download aircraft via the launcher, they come from FGADDON, the "official" collection of aircraft models maintained by the FG team themselves.

If it was already there, then it's also possible OpenSuse shipped them with FG (or with some `flightgear-data` package or sth), in which case it's probably going to be even older.

If you've never installed anything manually (either using git, or by downloading a zip and unpacking it somewhere), then you almost certainly should have one of these two versions.

In order to install aircraft in the correct location, you have two options:

a) Unzip into ~/.fgfs/Aircraft/{aircraft-name}

b) Unzip somewhere else, and add that path to your fgfs launch options (--aircraft-directory=...)

The launcher will install aircraft into ~/.fgfs/Aircraft/org.fgaddon.flightgear.org/Aircraft/{aircraft-name}, but you don't want to put your manually-installed aircraft models there, that directory should be left for the launcher to manage.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: CRJ700 autopilot corrections

Postby fredsie » Wed Aug 14, 2019 3:38 pm

That's really useful information, thanks! Using that, I've managed to find where the version I have resides, and the CHANGELOG is headed version 1.6.0.
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15

Re: CRJ700 autopilot corrections

Postby Octal450 » Wed Aug 14, 2019 8:46 pm

@Tdammers,
In regards to turn anticipation - I'm curious as to what you did. This is the method I use and it works pretty good: https://github.com/Octal450/IT-AUTOFLIG ... t.nas#L400

I tried to find in your code but did not see it - maybe I am blind? :D

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: CRJ700 autopilot corrections

Postby tdammers » Thu Aug 15, 2019 10:07 am

Turn anticipation is done entirely in Nasal.

The approach is quite simple (a bit too simple, actually, but I prefer something that works somewhat OK over something that doesn't work at all): I just regularly check the distance to the next waypoint, whether that waypoint is marked as fly-over, my ground track speed, and the required turn angle to the waypoint after the next one. From those, I can calculate the turn radius (based on ground track speed and standard turn rate), and then using the required turn angle, I can calculate how far from the waypoint I need to initiate the turn. So then I just compare my actual distance to the waypoint to that, and if it's smaller or the same, I just select the next waypoint in the route manager, which causes the autopilot to turn towards that waypoint. Unless it's a fly-over waypoint, that is; in that case, I just leave the route manager alone and wait for it to automatically advance the waypoint as I fly over it.

The logic is, for hysterical raisins (as in, I have been too lazy to refactor this mess) in instrumentation.nas, specifically, here: https://github.com/tdammers/CRJ700-fami ... n.nas#L274.

From a quick glance, yours looks like it uses more or less the same logic, give or take a few hacks to catch edge cases, and different correction factors.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: CRJ700 autopilot corrections

Postby Octal450 » Thu Aug 15, 2019 2:57 pm

Hi,
Ok cool. I also have correction of speed, as at low speed the turns can be tighter than higher speed.

Kind Regards,
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: CRJ700 autopilot corrections

Postby fredsie » Thu Aug 15, 2019 5:36 pm

@tdammers Hi, I unzipped your latest version in .fgfs/Aircraft as you suggested above but when FG starts I see no cockpit and the external view just shows a stick model on the runway. I'm clearly missing something! :D
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15

Re: CRJ700 autopilot corrections

Postby fredsie » Thu Aug 15, 2019 7:28 pm

OK forget that, sorted now.
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15

Re: CRJ700 autopilot corrections

Postby tdammers » Thu Aug 15, 2019 11:51 pm

Octal450 wrote in Thu Aug 15, 2019 2:57 pm:Hi,
Ok cool. I also have correction of speed, as at low speed the turns can be tighter than higher speed.

Kind Regards,
Josh


I'm assuming a constant turn rate (in deg/s), which means the turn radius scales linearly with speed (i.e. at 400kts GS, the turn radius is twice as big as at 200kts GS). Is that what you mean? Or do you actually assume a faster turn *rate* at lower airspeed? (I haven't actually thought about this a lot, the physics might actually work that way, I simply don't know).
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: CRJ700 autopilot corrections

Postby Octal450 » Fri Aug 16, 2019 4:35 am

When you are flying faster, you have turn earlier even for the same radius because the turn rate at Max bank angle is different. Turn rate is much faster at low speed.

See my code.

Kind Regards my friend!
Josh
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5583
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: CRJ700 autopilot corrections

Postby tdammers » Fri Aug 16, 2019 7:43 am

Gotcha.
tdammers
 
Posts: 391
Joined: Wed Dec 13, 2017 11:35 am
Callsign: NL256
IRC name: nl256

Re: CRJ700 autopilot corrections

Postby fredsie » Fri Aug 16, 2019 2:41 pm

Just to say the HNAV is performing beautifully in the latest version of the 700.
Thank you!
fredsie
 
Posts: 50
Joined: Sun Apr 24, 2011 3:55 pm
Location: Liverpool, UK
OS: Linux o/Suse 15


Return to Autopilot and route manager

Who is online

Users browsing this forum: No registered users and 0 guests