Rear Wheel Steer Controller
Please enjoy the 2-minute summary gallery below, or scroll further to explore my work in greater detail
Project Background
This page details the progress of my personal 2020 Winter project. While it is incredibly unfortunate that the UK has fallen victim to a new variant of the Coronavirus, the new national lockdown has given me plenty of time at home to sharpen my tools and learn new skills!
I have always been interested in the opportunities brought by electrification to improve vehicle performance through active vehicle dynamics control, and really just control systems in general. I believe my Controls course at Clemson University did a fine job of teaching the fundamental tenets of linear system control, but the concepts were only presented in a theoretical setting, and I found trouble retaining any valuable insight without seeing a practical application.
This project represents my attempt to address these gaps in my knowledge. What better way to reinforce my learning than by applying it to vehicle dynamics? With that in mind, it's important to remember the context when considering the scope I decided to take with this project. The primary goal, first and foremost, was to improve my fundamental understanding of control systems - and hopefully I could improve vehicle performance somewhere along the way!
The TU Graz 2018 challenger, "Giulia", was the first Formula Student car I saw with rear wheel steering, and very much served as an inspiration to this project.
Summary of Methodology
The vehicle used for this project was based on the 2020 Clemson FSAE car. For the first phase, I represented the vehicle as a simple linear two degree of freedom bicycle model. This would be inadequate for real-life implementation, but is perfect for taking a crash course in control system basics, and asking questions like "What is a lead compensator, and when would you use one?" Before jumping into optimization, I focused on design explorations to capture significant trends and insights. From there, I performed sensitivity analyses to evaluate the robustness of different control strategies to changes in parameters such as vehicle balance or tire cornering stiffness. Only when that was complete did I piece together my first "optimal" controller.
Once I felt comfortable with the basics, I graduated back to a full non-linear vehicle model. For this step, I essentially replicated the model I used for my differential project, but in Simulink. This ended up being great practice in syncing MATLAB with Simulink to automate the analysis process, which was a great set of skills to add to my toolbox. Once I had a more realistic model, the first focus was to recognize how control schemes would have to change to adapt to nonlinearity and tire saturation. Next I analyzed specific vehicle maneuvers, such as ramp-steer and sine+dwell inputs, to explore the versatility required for a real-life implementation. Lastly, I played around with more optimization, as well as exploring broader questions about what optimal vehicle control should look like. This is a really open-ended question that goes beyond the scope of this project, but was certainly interesting to investigate, even if on a surface level.
The 2020 Clemson FSAE car, Tiger22
Part 1: Linear Bicycle Model
Starting with a linear bicycle model enabled me to leverage the full MATLAB capability of transfer function analysis, enabling fast and efficient design explorations. I modelled the vehicle using a state space representation, with outputs yaw and sideslip velocity as a function of inputs front and rear steer angle.
One important detail I wanted to account for immediately was the effect of actuator dynamics on the response of the rear steering angle. Even though the focus was more on learning controls fundamentals and less on absolute modelling perfection, assuming instant steer response was far too unrealistic to leave unaccounted for. I searched through several research papers and other online resources, and none I found would divulge the way they modelled the actuator dynamics in their models. With nothing else to go off of, I decided to represent the actuator using a first order plant with a time constant of 0.1 seconds. By no means a perfect representation, but at least something a little more realistic to move forward with.
Next I had to select a variable to control. With a single input (being the rear steer angle) control system, I could only select one output to control, between the options of lateral acceleration, sideslip angle, and yaw velocity. Each has it's merits - lateral acceleration is the purest indicator of vehicle performance, sideslip is an important factor in the qualitative driving experience, and yaw velocity has the largest impact on the trajectory of the vehicle. Since yaw and sideslip are the more direct quantities derived from the bicycle model, and my interest is in controlling path heading and maneuverability, I decided to control yaw velocity for this project.
Proportional Control
The first controller I played with was a proportional feedback controller, where the rear steering angle adjusts proportionally to the error between the observed and desired yaw rate. The effects of a proportional controller are pretty well known; increasing the control can minimize steady state error and improve response time, at the expense of overshoot and oscillation. This effect was outlined in a basic parameter sweep shown below.
The following plots compare different proportional control values (Kp) and the effect on vehicle yaw response. The two left-most plots describe the response to an instantaneous step-steer input, and the response/overshoot relationship s easily apparent. The two middle plots describe the frequency response of yaw velocity to steer input. This outlines another key influence of proportional control, where Kp values above 0.3 created significant overshoot near on-center frequencies. At higher frequencies, the yaw/steer phase difference was also significantly larger. Both of these could harm driver confidence and keep them from exploiting the full performance of the car. The right-most plots show the open loop frequency response, which describes the behavior of the controller and vehicle to a given yaw-demand without any feedback. While there is not much insight at the moment, the open-loop gain and phase margins provide critical information about the total system stability which will come into play later on.
For the vehicle above, the yaw-generation capacity of the car is perfectly matched to the target yaw rate, which is calculated using the ackermann gain of the steering angle. In reality, modelling imperfections will mean that true vehicle performance will not match theoretical, and it is important to be able to account for error with a robust controller. To highlight this effect, I ran the same analysis but with the front tire cornering stiffness reduced by 2.5%. The results are plotted below. Now, having a higher Kp value is more important if the goal is to minimize steady state error. This can be seen in the steady state values on the left-most plots, where the vehicle adopts a steady state rear steer angle in order to account for the vehicle performance error. The tradeoffs in determining the optimal Kp value are now more complicated than in the previous example.
Vehicle response to varying levels of proportional control (Kp).
Vehicle response to varying levels of proportional control (Kp), with yaw-error introduced.
Relaxation Length
Tire relaxation length is something that I had previously not taken the time to model in past simulations. In essence, when a slip angle is imparted on a tire, it exhibits a transient response before it reaches a steady state lateral force. This is often quantified as the "relaxation length", or the distance the tire rolls before steady state is achieved. Relaxation length is subsequently modelled as a first order distance constant, which can be translated into a time constant when the vehicle velocity is accounted for. The result is lateral force as a first order response to slip angle. This also implies that relaxation length has a greater effect at low speeds, because there is a greater time lag before the relaxation length is traversed.
Since time lags can have a huge effect on responsiveness and performance, not to mention become the deciding factor between stability and instability, I figured now was the best time to incorporate relaxation lengths into my models and explore its effects. The first image below compares the step response of the car at various velocities (still using the bicycle model), with the change in color representing an increasing relaxation length. The results show relaxation having a significant effect on vehicle behavior, causing slower initial response as well as increased overshoot. As predicted, these effects diminish at higher speeds.
Comparing the effect of tire relaxation length on vehicle step response.
The next plot represents the same vehicle at the same velocity from the original proportional control sweep, with the only difference being the inclusion of tire relaxation length of 1 foot. This is about the average relaxation length for the Hoosier R25B tire we run, though it varies with load and other operating conditions. Compared to the first plot, there is a dramatic increase in overshoot and overlap, especially for high Kp values. This highlights the importance of accounting for relaxation length to create a realistic and robust vehicle controller.
Proportional controller (Kp) sweep with relaxation length incorporated into the vehicle model.
Loop Shaping
* The majority of this portion was informed by Karl Astrom and Richard Murray, in their book titled "Feedback Systems: An Introduction for Scientists and Engineers".
At this point, my first thought was to continue onto integral and derivative control, to complete the PID exploration. But before going down that path, I wanted to find a way to structure my process beyond simply "playing around" with values, or blindly relying on an optimizer to do the work for me. I turned to control theory, asking questions like "what are some performance indicators of interest, and what are target characteristics I should shoot for?"
This is when I learned about Loop Shaping, which is a collection of general principles to guide the design of closed loop control systems. Loop Shaping focuses on the formulation and evaluation of 6 key transfer functions, known as the "Gang of 6". Each transfer function represents a key element of controller performance, which is summarized below:
The Gang of 6
1) Sensitivity Function: The sensitivity of the measured yaw output to measurement noise
2) Complementary Sensitivity Function: The sensitivity of the control signal to a load disturbance
3) Load Sensitivity Function: The sensitivity of measured yaw output to a load disturbance
4) Noise Sensitivity Function: Sensitivity of the control signal to measurement noise
5) Primary Transfer Function: Describes the yaw response to a front steer input.
6) Controller Transfer Function: Describes the rear steer response to a front steer input
Loop shaping focuses on the frequency response behavior of these transfer functions, and each has it's own target characteristics based on the general requirements of control systems. I worked my way through these performance indicators, and selected the ones I felt were most relevant to my project and the expected requirements of a real-world rear steer controller. These are summarized in the table below:
Primary performance goals for the rear steer controller.
Lead/Lag Compensators
At this point I deviated away from my original plan to explore derivative and integral control, though I did play around with it a bit. There will be more PID control later in part 2. Since Loop Shaping was focused on frequency response, it made more sense to work with controllers that are defined and understood in a frequency response context. Lead and Lag compensators are often used in control systems to either boost or reduce the phase in a specific frequency range, giving me much more direct control over the key metrics described in the table above. Lead/lag compensators can also be used to boost or attenuate gain, though that is not the primary purpose.
As is usual, I started with parameter sweeps to build up my intuitive understanding of their primary effects. The plots below mirror the same vehicle used in the earlier plots. In this example, the vehicle has no steady state yaw error, and a lead compensator is applied at 5 Hz. Since a lead compensator is defined by a zero and a pole with a correction factor to achieve unity gain, the b/a ratio simply describes the ratio of the pole to the zero.
Exploring the effect of a lead compensator at 5 Hz.
The plot that caught my attention the most was the yaw gain frequency response plot (top-middle). If the right pole-zero ratio was selected, the gain could be held at near 1 for a much wider frequency range, significantly increasing the bandwidth of the vehicle (a.k.a. yaw responsiveness) without introducing overshoot. In addition, increasing the pole-zero ratio can reduce phasing from a sinusoidal steer input. However, raising it too much would slow overall response time, as seen in the step response plots.
The higher frequency the lead compensator is placed at, the more reduced its effects are on the vehicle step response and bandwidth frequency range. However, if the lead compensator is placed too low, its frequency range will overlap with the natural yaw frequency of the vehicle, and the subsequent interference can cause some erratic step response behavior. This is illustrated in the example below, where the compensator is moved to 2 Hz.
Exploring the effect of a lead compensator at 2 Hz.
I did also briefly explore lag compensators, but they typically created a forced yaw overshoot and did not really bring about any desirable frequency response behavior. See the plots below. However, I kept the lag compensator in my back pocket for potential future use. In situations where a lead compensator is used to boost phase, but then the increased gain causes problems at higher frequencies, it could be cancelled out by an adjacent lag compensator.
Exploring the effect of a lag compensator at 5 Hz.
Lastly, I reintroduced the cornering stiffness decrease to bring about a steady state yaw error for the controller to manage, with the results pictured below. This highlights a new downside of the lead compensator in its potential to hurt steady state error. This would have to be compensated for with increased proportional control, which can be harder to manage in more complex steering maneuvers. I also repeated the above comparisons for various other Kp values, but all of the plots here use Kp = 0.5 to maintain a like-for-like comparison.
Evaluating the lag compensator when steady state yaw error is present.
Final Parameter Sweeps
With many key controller parameters and their effects visualized, it was time to carry out a broader design exploration, and make some design decisions. I did this by creating generalized analysis plots of the most sensitive performance indicators listed earlier as a function of various controller parameters. An example is pictured below. For the next few paragraphs, I will break down each plot and it's significance to vehicle performance, and discuss the subsequent controller design considerations.
The plot below features the vehicle travelling at 40 ft/s, with a constant proportional controller of Kp = 0.5 and various lead compensators applied. The steady state yaw gain is 10% off of the linear control target. For each subplot, the compensation frequency is represented on the x axis, with the pole:zero ratio on the y axis. This allows me to create a 'control map' and get a bigger picture view of design trends. I am able to repeat these plots at varying velocities and Kp values to complete a full exploration.
For each individual subplot, I will show two examples, both at 40 ft/s, with Kp values of 0.2 and 0.5, respectively.
An example of the design exploration plots I generated for this exercise.
The first performance indicator we will look at is yaw overshoot in a step response. As mentioned earlier, one tradeoff to consider when selecting a proportional controller is to balance fast response time with small overshoot. This is exemplified below, where the Kp = 0.5 controller has greater overshoot across the board than it's Kp = 0.2 counterpart. The plots also show that this can be mitigated using the design of the lag compensator, either by decreasing the compensation frequency or, to a lesser extent, increasing the pole to zero ratio. In this case, the target area of the map that we want to target is the blue.
Step response max overshoot performance comparison
To stay on the overshoot vs response time tradeoff, let's look at yaw rise time next, or the time required for the vehicle to achieve 63% of its steady state yaw value. In this case, the target range is again to be in the blue area of the map, which is almost exactly inverted from the ones above. It is again apparent that a higher Kp value can lead to faster response, as well as reducing the pole:zero ratio.
Step response yaw rise time performance comparison
For the last of the step response metrics, we will look at steady state error. For this example, a static yaw gain error of 10% may be extreme for a linear vehicle model, but it is an attempt to look ahead to the nonlinear analysis, when tire saturation will similarly lead to large yaw errors (if a linear reference target continues to be employed). The general principle that increasing proportional control reduces steady state error is present, and the plots make it clear that the pole-zero ratio can also have a significant effect. Once again, since the goal here is to minimize the error, the target area on the map is the blue zones.
Step response error performance comparison
Next let's move into the frequency response domain. Bandwidth is the frequency range where the gain of the system stays above 3 dB, or roughly 0.707. Since gain is the ratio of actual to demanded yaw amplitude, you generally want to stay as close to 1 as possible, for as long as possible. In essence, the bandwidth describes the operating range in which the system will remain responsive to user inputs. Bandwidth is something I also explored in my differential project.
For a high performance vehicle, we want bandwidth to be as large as possible to maintain maximum responsiveness. This time, the target map area is the yellow zone. Unsurprisingly, increasing proportional control will increase overall bandwidth by creating more extreme responses to error. In this case, the pole to zero ratio is also a significant contributor to the bandwidth, but as you approach a b/a value of zero the sensitivity increases drastically. This is something to be wary of; vehicle modelling is never perfect, and when correlation is not present it is very risky to tune your vehicle to a very narrow operating band.
Frequency response bandwidth performance comparison
Another important frequency response metric is the maximum yaw gain across the frequency range evaluated. Ideally, this would stay as close to one as possible, or near the light blue to green zone on the map. This is evidently a very narrow window to shoot for this time. Another thing to notice is the total color range of the map, which shows an error swing of -20% to +30%. This is because a poorly tuned controller can amplify yaw errors near on-center steering frequencies, or fail to make up for a static yaw error. This is one of the most sensitive metrics of the ones being explored. It is also one of the most critical, because during complicated steering maneuvers it is essential that the output of the car behavior matches the expected input from the driver.
Frequency response bandwidth performance comparison
There is a clear tradeoff here between yaw overshoot and total yaw bandwidth. A deeper look reveals a hidden danger to prioritizing bandwidth over all else. This is illustrated in the plot below, which shows an extreme example with aggressive proportional control. The bandwidth, highlighted in green, is very high, but it is only so because the entire amplitude curve has been shifted upwards, resulting in extreme overshoot (red) for a large frequency range. This is not a desirable tradeoff to make.
An extreme example of the cost of blindly prioritizing bandwidth.
Now let's move on to the open loop dynamics of the controller. This is often used as a proxy to evaluate the closed loop stability of the system via the gain and phase margin. In essence, if the controller phasing is beyond 180 degrees while the gain is above 0 dB, divergent instability is achieved and the system will begin to oscillate at exponentially increasing amplitudes. The gain and phase margins are found by finding a crossover frequency where either gain or phase crosses its respective threshold, and seeing how close the other is to crossing its own.
Even if a system is perfectly stable across its full operating range, real-life disturbances can be difficult to predict and can tip the system just past the threshold into instability. In theory, one wants the gain and phase margins to be as large as possible, creating ultimate stability. In practice, there is a such thing as overkill, and generally there is a minimum threshold that above which you'll be fine. This depends on the application, but typically a phase margin of around 30-60 degrees and a gain margin of 2-10 dB is considered acceptable.
Open loop gain margin comparison
Open loop phase margin comparison
From the plots above, it would appear that achieving an adequate gain and phase margin is pretty easy. But there are two reasons to be cautious. Firstly, considering we are using a simple bicycle model, a car with sufficient understeer will have an inherent stability that one would have to go out of their way to try and destroy. In a nonlinear vehicle with tire saturation, achieving stability across all operating conditions will be much more difficult.
The second consideration is that sometimes looking at the margin values alone in isolation can be misleading. Pictured below is a bode plot for the static vehicle with no rear steer controller, for the sake of illustration. As the plot says, the gain margin is infinite because the phase never crosses -180 degrees. But a visual inspection quickly shows that the phase asymptotically approaches -180 at high frequencies, meaning that a road disturbance could suddenly shift the phase under -180, creating a finite gain margin. If you are not careful, a stable system could be thrust into instability in a situation like this.
An illustration of why gain margin can't always be taken at face value.
For these reasons, gain and phase margin are not always a complete indicator of closed loop system stability. This is why, when I move to nonlinear analysis, I will use a different metric to define stability, which you will see more on later.
For one last plot, we will explore the frequency response of the controller itself, and evaluate it's sensitivity to noise in the yaw measurement. This will manifest itself as noise in the yaw error signal, which directly translates to controller behavior. There are two reasons to manage this. Firstly, you don't want measurement noise to cause uncontrolled oscillations in vehicle behavior, as that will hurt performance and driver confidence. Secondly, noise is a high frequency phenomenon, so an actuator that is sensitive to noise will be subject to high frequency oscillations. If this is not properly damped out or attenuated, this can lead to premature actuator wear. For these reasons, it is important to keep noise sensitivity to a minimum (aka in the blue area of the maps below).
Open loop noise sensitivity comparison
Speed Sensitivity Analysis
Once trends in the performance indicators had been evaluated, my last step was to carry out the same analysis at different vehicle speeds. As vehicle speed increases, yaw gain and damping naturally decrease (at least before downforce is taken into consideration). At the same time, tire relaxation effects diminish. For this reason, the proper tuner parameters may change with velocity. The plots below reflect the same ones discussed above, comparing the same vehicle travelling at 30 and 70 ft/s, respectively.
Summary analysis performed at 30 ft/s
Summary analysis performed at 70 ft/s
Summarizing Thoughts
Through my design exploration, a few distinct design tradeoffs emerged. In the region generally defined by high proportional control Kp, low compensation frequency, and low pole to zero ratio, you can enjoy the benefits of fast response, low error, and high bandwidth. This comes at the expense of overall stability, noise sensitivity, and overshoot. I am overgeneralizing a bit here, but overall this highlights the classic tradeoff between speed and performance vs control and stability.
Low values of Kp yield a controller that is very easy to keep in a stable and predictable range. However, there is a hard ceiling on the response and steady state performance that can be achieved. On the other hand, it is possible to use a high Kp value that can achieve much higher performance while still maintaining comparable stability and control to a lower Kp controller. However, this requires much more careful and sensitive fine tuning of the lead compensator.
Having tested a range of Kp values from 0.1 to 1.0, and speeds from 30 to 70 ft/s, there is a key range where a decent balance can be struck between the performance indicators of interest. This lies in a Kp value between 0.3 and 0.5, a compensation frequency between 3 and 5 Hz, and a pole to zero ratio between 2 and 4. If you look back at the plots above, however, you'll see that almost all the performance indicators are at their highest sensivity to a change in parameters in that range. In practice, this means that trying to fine tune your controller and achieve predictable results in real life can be an elusive target. It would be wise to pick one side of the performance/stability spectrum to lean towards in order to stay in an area of predictable behavior.
As far as speed sensitivity goes, I found that simply scaling Kp to account for the changes in yaw gain for a given velocity did an adequate job of maintaining consistent control characteristics. This may not prove to be the case once I move to the nonlinear model.
And that wraps up my linear analysis! Now that I have a better grasps on some control systems basics, it is time to graduate to a more complex and realistic car model.
Part 2: Non-linear Simulink Model
Now it is time to move on to a non-linear analysis, and the second phase of this project. At this point, choosing a scope for the remainder of my work became a much more challenging open-ended question. As a result, the work I completed was not as linear as in the previous section. But here I will present my results in the following categories:
1) Details about the vehicle model used
2) Discussion of control objectives pursued
3) Description of vehicle maneuvers used for analysis
4) Discussion of control concepts evaluated
5) Performance indicators and optimization strategy
6) Final results
Vehicle Model
For my nonlinear analysis, I used the vehicle model from my differential analysis project. You can read more about that model here, but in essence it is a 7 degree of freedom nonlinear two-track model accounting for yaw, sideslip, longitudinal velocity, and individual wheel speeds. Roll and kinematics are excluded, but lateral load transfer distribution is a tunable parameter. For this project, I left out the differential model, because I didn't want torque split to act as a confounding variable. Instead, this vehicle is treated as having an open differential. I also upgraded the model to account for tire relaxation length via the same mechanisms as the linear model (using a first order distance constant).
Since I was working with nonlinear control, MATLAB's built in transfer function tools were no longer sufficient, and it was time to move my vehicle model into Simulink. This ended up being a good exercise for my Simulink skills, as I had to learn how to pass variables and call Simulink models from the MATLAB workspace to improve efficiency and enable parameter sweeps.
Control Objectives
With a more complex vehicle model, especially with tire saturation taken into account, deciding on a control ideology was a challenging question. With the linear bicycle model, it was simple to just create a linear reference model to pursue. Now we have a vehicle that behaves nonlinearly, and there are broader questions about what behavior is best for the car-driver interaction. On the one hand, keeping vehicle response as linear as possible for as long as possible seems like an obvious goal. But the gradual onset of understeer is a very important indicator to drivers that they are approaching the limit.
When I carried out initial research for this project, I completed a brief literature review to see how others approached this challenge. Some research papers took the straightforward method of pursuing a pure linear reference model. Others tried to specifically tune the onset of understeer with a target understeer curve. Below is an example from the work of Canale et al. Notice they are extending the linear range of the vehicle, while still allowing for a steady onset of understeer at the limit.
Example of plot from a different research paper, comparing the static understeer curve to a modified target curve.
Source: Canale, M., et al. “Robust Vehicle Yaw Control Using Active Differential and Internal Model Control Techniques.” 2006 American Control Conference, 2006, doi:10.1109/acc.2006.1657574.
Other papers worked to actually modify the turn radius gain for different velocities; for example, tuning the controller at low speeds to enable artificially tight turn radiuses. A common application of this method was for luxury performance vehicles or autonomous vehicles to aid in parking situations, but it would also serve a Formula Student vehicle well on the tight autocross courses it is designed for.
For the moment, I decided that I was spending too much time worrying about this question. "How the ideal vehicle ought to behave" is certainly a topic I want to explore further, but it outside the scope of this project. At this point, my goal is to, for a given target behavior, understand the control system techniques that would be required to achieve said behavior. So with that in mind, the simple route forward was to use a simple linear reference model with a fixed understeer gradient, with the control objective to maintain linear response for as long as possible. This is displayed in the plot below, where the lateral acceleration versus steer angle curves are compared for various speeds from the Simulink model. The grey line indicates the cornering limit for a given speed, and it's intersection with the purple reference line will indicate the steer angle where peak lateral acceleration will be expected. In the future, I definitely plan on exploring more open ended questions about ideal vehicle control. And the insights I gain with this project will serve me well when I decide to go there.
Lateral acceleration vs steer angle for the Clemson FSAE car, evaluated at various speeds.
Given the target vehicle behavior, the controller performance objectives remain similar to the performance indicators discussed in the linear section. I will go into further detail in the "Performance Indicators and Optimization Results" section.
Vehicle Maneuvers
For this part of the project, I used 4 primary simulations to evaluate the performance of a given controller, each of which I will briefly discuss below. The following examples will demonstrate controllers already refined by the tuning process, which I will discuss in the next section.
When tuning the linear bicycle model, the yaw demand reference was simply a linear multiplication of the steering input. Most of the papers that I read that utilized model pursuit control, however, utilized a first order reference model, simulating a realistic lag in the target behavior to a steering input. I was initially surprised by this - why not aim for the absolute fastest response possible? I very quickly learned that having a realistic plant to follow brought improvements to controller performance, because the controller was not trying to keep up with an unrealistic target. For all of the maneuvers discussed henceforth, the yaw reference used is a first order plant derived from the linear bicycle model via the equations below:
Source: Veldhuizen, T.J. “Yaw Rate Feedback by Active Rear Wheel Steering.” Thesis / Dissertation ETD, 2007.
H represents the steady state gain of the plant, defined by the velocity (V), wheelbase (l), and understeer gradient (nu). When nu = 0 the gain is equal to the geometric Ackermann gain, and the second term in the denominator essentially corrects for the understeer gradient. Tau is the first order time constant of the plant, and is defined by the yaw inertia (I), front axle to cg distance (a), front cornering stiffness (Cf), and H.
The first maneuver analyzed was the step steer, as many of the relevant metrics from the linear analysis still hold here. In order to evaluate the robustness of the controller, step steer simulations were carried out for the full range of lateral acceleration capacity, to ensure the controller worked well in the linear and nonlinear operating regimes, as well as at limit cornering. For the linear model, I was using a pure step input. However, with this more complex linear model, it was very hard for the controller to cope with such an immediate and instantaneous change in error. It was difficult avoid extreme overshoot after the initial rise time, since the controller was compensating an instantaneous yaw command. I ultimately replaced the step input with a ramp input, using a ramp time of 0.25 seconds. After all, this was a more accurate representation of what a real steering input would look like, and the controller performed significantly better.
Below is an example of a ramp steer simulation, comparing the performance of the vehicle with and without the controller. The steer input and first order reference are included for comparison, as well as the rear steer angle response for visualization. Yaw responses are normalized to the steady state value, and rear steer is normalized as a ratio of the front steer angle applied.
Ramp steer simulation example.
The next maneuver I analyzed was the sine with dwell steer input. This is a standard SAE test maneuver, where a sinusoidal steering input at a frequency of 0.7 Hz is applied. However, before a full cycle is completed, the steer angle "dwells" at the maximum value for 0.5 seconds before returning to center. This maneuver mimics a panicked driver avoiding an obstacle, and is specifically formulated to exploit any weaknesses in a car's stability or control. The steering input is recreated below:
Standardized sine+dwell steering input.
Another example result is displayed below, with the same data included as the ramp steer. The steer input, however, is left out to remove clutter. Results are normalized the same as previously. Just like the ramp steer, the test was repeated for the full possible range of steer angles.
Sine with dwell simulation example.
The next test was to try and recreate the frequency response analysis from the linear exploration. Since transfer function analysis is not possible with a nonlinear system, a time-based frequency response simulation had to be carried out and post-processed. This was recreated with a chirp steering signal, with the frequency slowly ramping up to a maximum of 6 Hz over a span of almost 40 seconds.
Chirp steer signal.
Using a fast fourier transform, I could characterize the output signals in the frequency domain in order to re-create the bode plots generated in the linear analysis. Once again, this test was repeated for various steering amplitudes to capture the full range of tire behavior. Even though frequency response theory is technically reserved to linear systems, this still provides valuable insight into the behavior and stability of the system. If the vehicle can withstand a chirp test at maximum lateral acceleration, chances are it can maintain stability throughout any other driving maneuver it will encounter.
The plot below compares the frequency response of the vehicle at three different steer angle amplitudes to the first order reference response, along with a vehicle without a controller. The curve marked "linear range" was collected for a small steering angle where the tire cornering stiffness stays relatively consistent. The same can be said for the curve marked "nonlinear range". The "saturation range" label indicates the steering angle amplitude is at the peak lateral acceleration capacity of the vehicle, meaning the tires are well and truly saturated. The curves are a little scraggly near the high frequencies due to imperfect windowing, but they are clear enough to understand what's going on.
Chirp test example.
The bode plot below is for the same test, but run without the controller.
Chirp test example without a controller.
Finally, the last maneuver is a replication of the open loop stability evaluation. This was created using the same methods as the bode plots above, except this time the chirp sequence reaches a maximum frequency of 60 Hz over a period of 800 seconds. After processing the data, instead of generating bode plots I created a Nyquist plot to evaluate closed loop stability. A Nyquist plot is essentially communicating the same information, using polar coordinates to map gain and phase onto the same plot. This is a great way to visualize closed loop stability, because when the open loop transfer function achieves a value of -1, the denominator of the closed loop transfer function goes to zero and the system becomes unstable. A Nyquist plot, therefore, can be used to evaluate closed loop stability based on how close the plot gets to the point [-1,0] (or how many times it encircles that point). A complete Nyquist plot is generated using a frequency range of +/- infinity, but that was not practical with Simulink. After testing several frequency ranges, I found that anything above 60 Hz was adequate in insight but brought diminishing returns in the construction of a complete plot.
During the linear frequency analysis, I discussed the potential danger of blindly accepting gain and phase margin values without interrogating the results. Rather than evaluating two isolated crossover frequencies, a Nyquist plot can show you how close you get to [-1,0] through the entire frequency range of operation. Instead of choosing a minimum gain and phase margin, you can define the radius of a circle enclosing [-1,0] to act as a safe stability threshold. This is illustrated in the example below, with the red circle representing the bounds of acceptability.
Open-loop Nyquist plot example.
Controller Design
Now that I've shown you a bunch of pretty plots with well-behaved controllers, I will walk you through some of the key characteristics of the controller, and how I got to the final values. The full Simulink block diagram of the controller is pictured below, but I will walk you through each specific component and explain its contribution.
Final controller block diagram.
Proportional Control
Based on the linear controller results, I started with a Kp value of 0.5. I expected that this value would have to drop, and initially I was proved right. Kp = 0.5 worked well for the step and sine maneuvers, but was too volatile in the chirp test. With the nonlinear tire model, control inputs that were too extreme would run the risk of prematurely sending the rear tires into saturation, damaging overall stability and control.
Surprisingly, however, as I continued to refine the controller I found myself being able to steadily increase the proportional gain. Additions to the controller like the extra integrator and the feed-forward derivative control (discussed below), enabled me to get away with greater proportional control, but even then the other measures had been so beneficial that often times there was negligible benefit to going beyond Kp = 0.35.
Gain Correction Factor
One of the first ideas I tried was to use a "gain correction factor". A controller with static parameters works on the assumption that the vehicle parameters remain constant, and this is no longer the case with a nonlinear vehicle model. If the rear tires saturate, for example, a given control signal input would not give the same predicted yaw correction output. Especially as the vehicle approaches maximum cornering, I reasoned that the gain of the controller should be adjusting to account for the saturation of the tires.
I decided to address this by creating a "vehicle state estimator" block in Simulink. Taking in the car's longitudinal, lateral and sideslip velocity, along with the front and rear steer angles, the block calculates the load and slip angle at each tire and uses that to estimate the instantaneous cornering stiffness of the front and rear axle. From there, the canonical bicycle model equations can be used to calculate the instantaneous steer-to-yaw gain for the rear axle. That value is compared to the static gain value to create a correction factor to apply to the steer signal. The block diagram for the gain correction is illustrated below:
Gain correction portion of the controller block diagram.
The "Correction factor ceiling" block places an upper limit on the gain correction factor. Otherwise, if the rear axle approaches a cornering stiffness of zero, the gain correction will approach infinity and the system will tear itself apart. This introduces another tunable parameter to manage in the controller. An example of the gain correction factor in real time during the sine with dwell maneuver is displayed below.
The gain correction factor in action.
Surprisingly, however, this was not as helpful as I would have expected. Under the ramp and sine/dwell maneuvers, the yaw response was not significantly different. Moreover, at high steer amplitudes, the frequency response performance actually worsened when the compensator was in place. For example, take the comparison of the yaw phase difference in the plot below. The controller without the compensator is able to match the reference target much more closely.
Comparing the phase performance with and without the gain compensator.
Upon closer inspection, the reason why I had to install a correction factor ceiling is the same reason the compensator was limited in it's usefulness. The gain compensator is a naturally unstable function. As rear cornering stiffness decreases, gain compensation increases, which increases rear steer angle demand, which in turn increases slip angles and further decreases cornering stiffness. This becomes an issue either near the saturation point of the rear tires or at very high frequencies demanding high yaw accelerations. This can also be highlighted using the same chirp maneuver. The plot below compares the rear steering trace through the entirety of the maneuver, and it is clear to see that the compensator creates more extreme and aggressive controller behavior as it tries to chase it's tail around the cornering stiffness fall-off. Because of this, I ended up generally leaving the DC compensator out of my controller.
Comparing the phase performance with and without the gain compensator.
Extra Integrator
Now this is one that I have to share credit for, since I did not come up with it on my own. The lovely people at the Technical University of Eindhoven who designed a rear steer controller for a Citroen CX used a large integrator in their controller to catch any remaining steady state yaw error (find their paper here). This has many benefits:
First, it relieves the burden off of P and I in a PID controller to eliminate steady state error. Having a sufficiently large proportional control P is important for fast response, but an aggressive PID integrator can cause 'wind-up', where a steadily increasing error integral can drive to controller to a sustained overshoot. There is also an extra benefit of including an integrator independently further downstream in the block diagram. Since integration naturally filters noise out of a signal, this helped "calm down" the controller during complex maneuvers such as the sine with dwell test. The extra integrator, however, will also induce a phase lag at lower frequencies, which can hurt the closed loop stability of the system. This would have to be counteracted by including a lead compensator to boost the phase of that frequency range back up.
The plots below show an example demonstrating the usefulness of the integrator. First is a zoomed-in view of the ramp-steer test results, where both the independent and PID integrator are tuned to have a similar steady state response.
Comparison of steady state error between different integration methods.
The exact same controllers were then compared in the sine with dwell maneuver. The results are pictured below. The independent integrator is less susceptible to windup, and overall is able to track the yaw target much more effectively.
Comparison of the two integrators in a sine with dwell maneuver.
Integrator and Derivative Control
Up until this point, I had primarily been using the "P" in PID control, with my proportional controller Kp value. In the section above, I discussed the use of an independent integrator to replace I. As I continued tuning the nonlinear model, the importance of a derivative controller to catch "irregular" steering inputs became apparent.
A common understanding around derivative control is that it is useful for smoothing out oscillations by introducing damping into the system. This can be seen in the set of plots below, comparing the sine and dwell maneuver with increasing levels of derivative control. On the left hand column is the yaw error signal, which makes the visualization of signal tracking accuracy a little easier, and on the right is the rear steer signal, to visualize the controller response.
Derivative control parameter sweep for a sine with dwell maneuver.
Increasing derivative control helps reduce the amplitude of oscillation, as well as decrease overall error. However, the frequency of control signal oscillation increases dramatically. These small, rapid oscillations will wear out the actuator and steering components over the car's period of operation, and may create feelings of unease of the driver notices these oscillations. This can be helped by applying a first order filter to the derivative term, as shown below, but this comes with diminishing returns.
Demonstrating the effect of increasing derivative filtering in a sine with dwell maneuver.
The areas where the controller was struggling the most was wherever there was a sudden change of direction in steering angle. This is exactly where the derivative controller would be at its most significant, but I could not create a strong enough response to a reference signal change without having to deal with the oscillation issues above. What I needed was a way for the controller to anticipate the future vehicle behavior demand and respond earlier, in order to avoid this extreme overshoot + overcompensation behavior. The next two methods I discuss were my attempts to address this problem.
Feed-Forward Derivative Control
Instead of a control response that is proportional to the derivative of the error signal, I tested a control response that is proportional to the derivative of the reference signal itself. This component therefore is more in line with a feed-forward controller, so I call it the Feed-Forward Derivative Control, denoted by KD. By essentially responding to the derivative of the steering angle instead of the error, KD is anticipating what the yaw demand will be ahead of time, and can adjust accordingly.
Initially I created this to try and relieve the burden of the PID derivative controller in responding to a direction change, as a way to reduce overshoot and oscillation. In the process, I discovered a neat feature unique to KD. Unlike a PID controller, that needs to always act against the direction of the error, I could make KD whatever sign I liked. If KD is negative, the controller responds to a steer input by momentarily steering the rear wheels in the opposite direction. This delays the onset of slip angle build-up on the rear axle, which enables a faster (but less stable) yaw response. If KD is positive, then the opposite happens, and the rear tires initiate a yaw balancing moment faster to create a slower (and more stable) yaw response.
The results can be seen clearly in the figure below: KD is essentially translating the yaw response forward or backward in time. This became a very effective (and equally sensitive) tool to fine-tune path tracking for sudden direction changes.
Demonstration of the effect of the KD in anticipating yaw demand.
KD has a significant effect on the frequency response behavior of the system as well, as demonstrated by the bode plot comparison below. KD can be used to effectively shift both gain and phase plots up and down to a relatively uniform degree.
Frequency response comparison of the controller with varying KD values.
Part of this comes from the effect that KD has on the rear steer signal generated at high frequencies. At high frequencies, the controller may generate dramatic response signals in an attempt to keep up with the rapid steering oscillation. A positive KD value can be used to keep this effect in check by artificially damping the rear steer response. This is shown in the plot below, which was generated from the same data used for the comparison made above. Reducing these high frequency oscillations may also help reduce actuator wear in the long-term.
Frequency response of the rear wheel steer angle with varying KD values.
Feed-Forward Direct Control
Example feed-forward calibration curve.
I also experimented with a traditional feed-forward controller based on the front steer angle. Theoretically, this should be more powerful than the KD controller, because it is the ultimate predictor of where the vehicle is expected to be in the future! Many papers that I read used a combined feed-back and feed-forward controller to control the rear wheels, and the reasoning is well founded. Typically, when designing a control system you have to compromise between path following and disturbance rejection - it is hard to achieve both with the same controller parameters. But with two controllers, you can fine tune the feed-forward controller specifically for path following, reserving the feedback controller for path rejection. This would constitute a much idealized control system.
I attempted this by generating a curve like the one below, to determine the rear steer angle required as a function of the front steer angle for steady state cornering.
I then divided the rear steer curve by the front steer angle, before fitting a 4-degree polynomial to the curve and inserting that into my Simulink model as shown below. That way, the signal is generated by multiplying by the front steer angle, and a steer angle of zero will always create a feed-forward signal of zero.
Sadly, this did not end up working nearly as well as the KD controller, for two key reasons. The first of which is evident in the plot below; steering the rear wheels in sync with the fronts, to their desired steady state value, only exacerbated the yaw overshoot inherent in the system. This mean that the feed-forward and feed-back controllers would constantly be fighting each other and cancelling out. The second reason is that the KD controller only kicked in when it was necessary (during a direction change), while this controller was applied immediately and constantly in effect, which impedes on the other control parameters at work.
Evaluation of a feed-forward controller in isolation.
Lead Compensator
The lead compensator continued to be a significant contributor to the rear steer controller, but for very different reasons. In the linear model exploration, the lead compensator served the dual purpose of tuning the bandwidth while reducing steady state error. This is because a lead compensator creates a gain boost directly after the compensation frequency that asymptotically approaches the pole:zero ratio. For the nonlinear model, this error-reduction was already being taken care of by other features including, significantly, the independent integrator. This left the lead compensator with the sole purpose of creating a lead boost to account for the integrator. This was still incredibly essential, as without compensation the presence of a large integrator would blow up the system. The lead compensator thus served a critical role by enabling me to run a much larger integrator than I could otherwise get away with.
Low-Pass Filter
The last component in the controller is a low-pass filter. The filter is placed at 60 Hz, well above any of the frequencies naturally experience in the system during a typical driving maneuver. This serves no performance purpose, and exists to attenuate any measurement noise to reduce long term actuator wear.
Performance Objectives
Now that I have walked you through the basic components in my controller, I will discuss the key performance indicators I used to decide on a final controller configuration. Not all can be perfectly satisfied at once, so compromise was involved in the process. The following indicators fit within the previously discussed target of maintaining linear yaw response in as broad a window as possible.
The first objective for the controller was to match the desired yaw signal in all maneuvers as well as possible. An objective way to evaluate this would be to take the integral of the absolute value of the error signal, but there was a subjective aspect to the evaluation as well. I wanted to visually inspect the data traces and make sure there was no irregular behavior in the yaw or steer response. For example, a controller may achieve near-perfect signal tracking by using extreme high frequency oscillations (see the derivative comparison earlier above), which would wear out the actuator faster.
The second goal was to maximize the open loop performance of the controller. This meant achieving a high bandwidth while maintaining a minimum stability margin. Instead of using the gain and phase margin, I defined the stability margin by how close the open-loop Nyquist plot got to the point (-1,0).
Deciding on a performance goal for the closed-loop frequency response was a harder decision. Initially, I wanted to maximize the yaw bandwidth, similarly to my linear analysis. As I researched reports on driver-vehicle interactions, I realized that this may not be as desirable a goal as I previously thought. For any steering input frequencies higher than the on-center frequency range, the driver is likely making fast corrections, and maximizing yaw response for that input may not actually be preferable. Besides that, as a driver becomes more familiar with the vehicle, their steering inputs will transition from closed loop towards open loop, further diminishing the need for high bandwidth.
A different frequency response metric that has ample evidence supporting it's importance, is the phase difference between yaw and lateral acceleration response, which I will call the RAY function (for R minus AY). This is an important driver interaction metric because many studies have correlated it with driver feedback regarding "responsiveness". While yaw velocity defines steady state lateral acceleration, there is a transient contribution from the derivative of the sideslip velocity. This manifests as a sideslip angle response to a steer input, which is believed to be responsible for the "turn-in" feeling of the vehicle. The plot below shows the RAY function for a linear second-order vehicle model.
Example of the RAY phase difference on a passenger vehicle.
Source: Cobb, William. General Motors, 1993, pp. 20–20, Cornering Compliance Based Chassis Synthesis in the Frequency Domain.
If many people in the industry agree on the importance of the RAY function in characterizing driver-vehicle interaction, they do not necessarily agree on what the ideal behavior looks like. A 1987 study carried out by Mazda directly correlated vehicle control systems that minimized the phase lag across the frequency range to having the most favorable subjective driver evaluations. Conversely, another SAE study found that it was more important to keep a consistent lag time, regardless of frequency. A case could be made for both. On the one hand it would make sense for yaw and lateral acceleration to be perfectly in phase. On the other hand, having a consistent phase lag time could create a favorable "tip-in" sensation for the driver, as well as maintain consistent behavior regardless of input frequency.
With no outstanding evidence to sway between the two ideologies, I went with the latter. The RAY function for a first order vehicle model naturally follows a downward slope, which amounts to a consistent lag time when accounting for the increasing frequency. This means the first order target response signal would need no modification. All else being equal, the first order reference model is most likely to match a driver's "intuition" of how a vehicle will behave to a steering input, and therefore the burden of evidence is on the other method to prove itself as an optimal solution. This would, however, be a topic that I would love to research further in the future.
With all of that in mind, I decided that my frequency response performance goal would be to match the gain and phase of the un-modified first order reference model as well as possible, in both the linear and nonlinear range of the tires.
Design and Optimization Strategy
In summary, my performance objectives were to:
1) Minimize path tracking error without excessive actuator oscillation.
2) Maximize open-loop bandwidth within a minimum stability margin.
3) Match both linear and nonlinear response to the first order frequency response signal as closely as possible.
I ultimately designed a set of controller parameters for 4 vehicle speeds. First, I manually tuned the controller to qualitatively achieve the best performance possible. I then used those parameters as the initial point for a batch of optimizations using MATLAB's fmincon. I ran three separate optimization objectives:
1) Minimize the integral of the absolute yaw error signal during a sine with dwell maneuver, with a penalty function weighted against a rear steer signal with large time-derivatives.
2) Minimize the sum of the integrals of the absolute yaw gain and phase error between the controller and the first order reference, with a penalty function weighted against a difference between the linear and non-linear response.
3) Maximize the open-loop frequency response bandwidth, while maintaining a maximum sensitivity function gain of 6 dB (equivalent to 0.5 distance from (-1,0) on a Nyquist plot).
Each optimization was carried out separately, leaving me with three optimized parameter outputs. I then re-ran all of them through all maneuvers, compared results, and made manual adjustments to arrive at a final controller that combined the best characteristics of all three.
Optimization Results.
Pictured below is the example results for the final controller optimized for a vehicle speed of 40 ft/s, which is representative of results across the entire speed range. Below the plots is a table summarizing the final parameters for each velocity. In a real-life implementation, an on-board controller could interpolate between these values based on the instantaneous vehicle velocity.
Final controller configuration example in a ramp steer maneuver.
Final controller configuration example in a sine with dwell maneuver.
Final controller configuration example in a chirp steer maneuver.
Open loop frequency response characterization of the final controller configuration.
Summary table with key controller parameters and characteristics.
Key Observations
Since each optimizer was pursuing a unique objective, the output parameters naturally had differences. One of the largest differences was in the use of the PID derivative control (D). Increasing D significantly improved bandwidth and frequency response performance. This makes intuitive sense because as the input frequency increases, the error derivative grows faster than its proportion or integral, making D the most powerful tool for the controller to “keep up” with the signal. On the other hand, the sine with dwell optimization converged to a low D value, which was necessary to reduce the oscillations of the actuator. Given the practical need to reduce high frequency oscillations and extend actuator life, I kept a low D value in the final controller at a minor expense to frequency response performance.
On the flip side, path-tracking optimization converged to very powerful integrators to minimize steady state error. In the frequency domain, this integration significantly reduced the bandwidth performance of the controller. This applied to both the PID and independent integrator, where the frequency response optimizers converged to values 5 times lower than the path-following optimizer. Ultimately, a weak integrator was able to achieve 95% of the error performance of a strong integrator, while vastly improving open loop performance, so I stayed with smaller integration values.
To my surprise, I was able to create a controller with consistent performance across multiple speeds without having to drastically change many controller parameters. It largely depended on which direction I wanted to take with the controller. If my priority was path tracking accuracy, I could steadily increase the proportional control and integration with higher speed to improve performance. For frequency response on the other hand, it was best to keep the integration as low as possible, and P around a steady 0.3, regardless of speed. Once I found a sweet spot for the lag compensation (F and M) and both derivative terms (D and KD), I found I did not have to change them with speed.
The only exception was at V = 30 ft/s, where I had to include a large I value in order to calm down the frequency response due to the greater yaw velocity oscillation amplitudes. The reduced bandwidth performance reflects this.
The primary purpose of this project was for me to get more acquainted with the basic principles of control systems by implementing them in a realistic application. I believe this was a complete success. I feel much more comfortable with the effects and considerations behind various controller parameters beyond basic PID control. Along the way, I have gained practical insight into tradeoffs between path-tracking vs frequency response performance, performance vs robustness, and considerations surrounding real-world implementation.
The open-ended part of this project pertained to questions regarding what the ideal vehicle behavior should look like. While this was outside of the scope of the project purpose, it is impossible to separate the performance of a control system from deciding the behavior it is supposed to emulate. Defining and targeting driver-vehicle interactions is a rabbit-hole that I wanted to avoid falling too deep into, so the behavior targets I set were reasonable and well-informed without spending excessive time trying to exploit this area of development.
That being said, dipping my toes in the proverbial waters of driver-vehicle interactions has very much awoken my fascination into this realm of quantifying the subjective in vehicle dynamics development, and it is very much something I plan on exploring further in a different project.
I would love to revisit this in the future with greater focus on driver-vehicle interactions and how that would change the design of the controller. I would like to explore a variety of different directions, such as:
-
Tuning the steady state steer vs lateral acceleration curve to control the onset of limit understeer.
-
Using sideslip as the control variable, to minimize vehicle slip angle during cornering maneuvers.
-
Exploiting the rear steer angle to shorten the virtual wheelbase during low-speed cornering maneuvers.
-
Placing more focus on optimizing the phase difference between yaw and lateral acceleration.
-
Optimizing for robustness and including impulse signals to evaluate disturbance rejections.
-
Incorporating more complex vehicle maneuvers, with combined steering and acceleration.