# What algorithms are used to correct the flight-path?

As a launch vehicle begins to veer slightly off course during a launch, what sort of algorithms are used to determine how far off the vehicle's trajectory is pointing from the intended trajectory and what thrust vector adjustments should be made? In my head I imagine you would use data from sensors to determine the thrust vector, which ideally would have a 0° angle from the intended or planned trajectory.

UPDATE

Great answers so far. Does anyone have specific examples of which control systems are used in modern day launch systems?

• Powered Explicit Guidance algorithms come in many forms... – Deer Hunter Aug 27 '14 at 18:06
• It’s not really a specific algorithm as much as an entire field of study: controls. – Adam Wuerl Sep 4 '14 at 5:58

## 3 Answers

Another common technique is what is called a Kalman Filter.

A simple PID controller has a controllable output, a sensor, and a feedback loop. The standard example is a car's cruise control: the output is the amount of fuel sent to the engine. The sensor is the speedometer. The speedometer's measurement is compared to the desired speed, and the output is adjusted. This allows the car to adjust the amount of gas as the car goes up and down hills.

While this works well for many devices, more complicated systems have a number of controllable outputs, and must also deal with noisy sensor inputs. This is where the Kalman filter (and it's many derivatives) comes into play. It is often used for guidance systems.

The basic idea is that the Kalman filter keeps track of the state of the system, has a model of how the system works, and makes predictions based on this model. The predicted output can then be compared to new sensor readings, and the state knowledge is updated.

So if our car was actually a self driving car, we could use a Kalman filter to help it navigate. The filter starts with a known state of the car: stopped, wheel straight, pointing north, and at lat X and long Y. To reach a new destination, the filter can generate inputs (throttle and wheel angle), make predictions based on the physics model of the car (if I turn the wheel 90 degrees at highway speeds bad things happen), take sensor inputs (compass, speedometer, mileage gauge), and finally see if those predictions are reasonably close to the sensed environment. Repeat.

• Kalman filters are an optimal estimator, not a controller. Could you edit your answer to make it more clear. Kalman Filters alone are not used to generate control inputs; that is done by some sort of controller. Also I don't know of any launch vehicles that use PID control as its non-optimal. Flight controllers have to use some sort of Model Predictive Control (MPC) because fuel is limited. Your current answer doesn't really answer the "what algorithms are used question". – Knudsen Number Apr 9 at 22:05

I'd like to add a little to Superdesk's answer about the Kalman filter. Superdesk gives a great practical description; I'd like to add a more theoretical characterisation: the way I like to think about the Kalman filter. It also leads to an interesting bit of historical trivia about the Kalman filter that I don't think many people know.

The classical Kalman filter assumes that the observations of the parameters of the system model described in Superdesk's answer belong to a Gaussian random process. The aim of the Kalman filter is to estimate the parameters of these hidden Markov processes and to update the parameter estimates with their maximum likelihood values (i.e. the values that maximize the a prior probability of observing what is actually observed) with each new measurement.

Now imagine you have a model of a process - a driving car as in Superdesk's answer. You could simply take the car's whole sensor output history at each sensor as well as your model and brute force compute the parameters that give the maximum likelihood. You'd be doing the same thing as the Kalman filter, but this is NOT the Kalman filter. You'd also be doing a huge amount of number crunching, with an increasing workload at each step as your histories get longer and longer. It would be an impractical approach, especially in the early Apollo missions!

No, the point of the Kalman filter as opposed to general, brute force maximum likelihood estimation is that, as each new measurement comes in, the parameters of the (assumed) Gaussian probability distribution functions are updated by simple recurrence relationships that make use of former parameter estimates of these parameters and the new observation ALONE. You don't have to go back and get all the old observational data and do a maximum likelihood estimate from the newly augmented full dataset from scratch. So the Kalman filter is a maximum likelihood estimator, but it achieves this with vastly less computation than brute force maximum likelihood estimation.

Indeed, the Kalman filter was invented to drastically reduce HAND statistical calculations. For, even though we credit Rudolf Kalman with its invention, it was in fact invented by the great mathematician Carl Friedrich Gauss and first published by him in 1809, 150 years before Kalman. Gauss used the Kalman filter to simplify hand calculations needed to find optimal estimates of planetary orbits from astronomical observations. You can see that a simple recursive algorithm involving only the parameter estimates and most recent data would make hand calculation practicable: brute force maximum likelihood estimation would have been impossible. Kalman was unaware of Gauss's work, and indeed his method of proof that the simple algorithm is indeed maximum likelihood was quite different.

Kalman actually only found respect and credit for his work when he proposed it to Stanley_F._Schmidt and the latter led to the Kalman filter's adoption as a key path estimator during the Apollo missions.

There's a whole bunch of theoretical and practical study of this kind of problem. The most important algorithm is called the PID controller.