# 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.