Jump to content
  • Advertisement
Sign in to follow this  
FFMG

Autopilot tuning - rate of climb logic/algorithm/PID

This topic is 3586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am trying to write an autopilot to handle my rate of climb/decent and my heading. Using a simple PID controller I was able to take care of my heading. I was hoping to do the same with climbing but unfortunately it is not as straight forward. The two problems I have are: 1- Changing the elevator usually causes a delayed response, the change I make now might be good enough to achieve the expected rate of climb but that will only be reflected later. 2- In most aircraft you need to follow a very specific climb rate in feet per minute, (fpm), rather than aiming for a certain altitude. For example, if I am a 1000 ft and I want to climb to 10000ft at 1000fpm. It is not just a simple matter of reaching the final altitude itself. Currently I update all the values every 500ms, (but I can set it to any value). So maybe I could use my previous rate of climb, my previous elevator position and my new rate of climb to calculate what my final 'best' elevator position might be, (the elevator position are between -100% and 100%), and recalculate those values all the time until I reach the expected rate of climb. How would you solve the problem above to set the elevator so that I don't over/under shoot the target altitude and rate of climb but rather 'smoothly' get to it? How do real life autopilot ensure that the rate of climb is spot/on? Thanks FFMG

Share this post


Link to post
Share on other sites
Advertisement
Hi,

I've done some experiments on similar things, and this usually works for me (adapted to your case):

Calculate the desired rate of climb by taking the altitude error (target altitude - current altitude) and divide by the time you want it to use to correct the error. (Faster time will give you faster response but will lead to overshoot/oscilations. You will have to tweak this value.)

This will give you your target rate of climb. If you have a maximum rate of climb, clamp to this value.

By doing this, the target rate of climb will decrease when you get close to your target altitude.

Share this post


Link to post
Share on other sites
Thanks for the reply, but my question was more about how to hold a good climb rate.

For example if I want to climb at 1000fpm then I would apply some pressure on the elevator.
That would result in some rate of climb, but the result is not immediate.
So how do I know when to stop using the elevator?

From a math point of view there must be a formula to calculate the 'ideal' setting to have a good rate of climb/descent.

If my current elevator setting is at 0%, (level flight), and my climb rate is 0fpm.
I then change my elevator to 1%, that causes the rate to change to climb to 1fpm, 2fpm, 3fpm until eventually reaching 100fpm.

Is there no way of calculating the final 100fpm given the very first and second rates of climb?
Using the same logic I could then settle at and final rate of climb.

Maybe something like that would work?

Thanks

F.

Share this post


Link to post
Share on other sites
Real autopilots that I have dealt with (just a couple) do more of a "bounce" kind of thing... when it gets too high, go the other way, and eventually it evens out.

ALSO: There usually isn't a "rate of climb" function... it's usually altitude hold, airspeed hold, or attitude hold.

Share this post


Link to post
Share on other sites
Quote:
Original post by smitty1276
Real autopilots that I have dealt with (just a couple) do more of a "bounce" kind of thing... when it gets too high, go the other way, and eventually it evens out.


What do you mean by "bounce"?

Quote:
Original post by smitty1276
ALSO: There usually isn't a "rate of climb" function... it's usually altitude hold, airspeed hold, or attitude hold.


Really? the couple of AP have looked at, (from Cessnas to Boeings), all have a vertical speed setting as well.
So you choose your altitude _and_ your vertical speed.

Most of the advanced AP that I know off give a very smooth climb rate and settle at a right altitude within a few hundred feet.
In fact they are so accurate they can land the plane for you :).

F.



Share this post


Link to post
Share on other sites
Quote:
Original post by FFMG
What do you mean by "bounce"?


First of all, I've been drinking heavily tonight, so I apologize. :-)

Actually, it just dawned on me that I was dealing with a simulation, and the autopilot was not a big priority on that sim, so the implementation may have been hacky... let's ignore my previous comment about "bouncy".

Quote:
Original post by FFMG
Really? the couple of AP have looked at, (from Cessnas to Boeings), all have a vertical speed setting as well.
My experience is concerning fighter aircraft (in simulation), so maybe they don't have some of those nicer functions. If you set an altitude, you would get a smooth rate of climb and
it would settle in at the correct altitude, but I don't recall a rate of climb setting on those.


Share this post


Link to post
Share on other sites
Quote:
1- Changing the elevator usually causes a delayed response, the change I make now might be good enough to achieve the expected rate of climb but that will only be reflected later.


The delayed response from the elevator is typically well-established, and can be taken into account by the augmented control system that exists between the hardware and the autopilot. The time constant for the elevator itself will be fairly small for most systems compared to the movement of the airplane, so I wouldn't worry about this too much.

Quote:
2- In most aircraft you need to follow a very specific climb rate in feet per minute, (fpm), rather than aiming for a certain altitude.


Consider the following phases of a climb:
- From a level flight path, the aircraft establishes the desired altitude.
- The aircraft begins to change pitch in order to match the desired rate of ascent / descent. Call this rate P_r (pitch rate).
- The aircraft establishes the desired pitch angle (A_p) and ascends / descends towards the desired altitude.
- The aircraft approaches the desired altitude within a known margin, at which point P_r is reversed, although this time it is scaled in proportion to the difference between current and desired elevation.
- A pitch angle reaches zero. Small angle adjustments, with large time constants (heavily damped) to avoid overshooting, are made by a separate or reduced control system.

The two keys to the above algorithm are:
- P_r, which is unique to a given airplane and is determined by airplane performance ability and the maximum allowable moment arm about the pitch axis. (If you're in a commercial airliner, P_r should be small, since you can only change angle so fast while keeping your passengers comfortable.) A_p is determined by P_r (ie, how fast will you be able to pull out of a steep climb?).
- In the fourth phase, note that the control system attempts to predict when it should start pulling out of the climb. You can do this by:
a) extrapolating the current time-to-altitude from the rate of descent and attempting to solve the resulting differential equation (keep in mind that your rate of decent changes as you pull out of your climb / descent)
b) pick a set distance (say, any altitude within 500 feet of the desired altitude) and trust your corrections in phase 5 to compensate for any difference

One thing that a realistic simulation or control system must take into account is the fact that A_p and P_r will change as a function of altitude - your elevator will apply a different moment at the same angle, depending on the surrounding air pressure.

Good luck!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!