I had a lot of fun trying to figure out how to model the vehicle dynamics and tire properties of my RC car. Here is my full list of references.
- Race Car Vehicle Dynamics by William F. Milliken and Douglas L.Milliken
- Vehicle Dynamics: Theory and Applications, Vol 1,2,3 by Reza N. Jazar
- Vehicle Dynamics and Control by Rajesh Rajamani
- Go-kart dynamics and minimum time maneuvering in dry/wet conditions: MSc thesis by Yury Arenaccio-Khlebov (Now a F1 engineer at Toro Rosso)
- UCB's BARC Lab Github Repo Wiki
As you can see, I had a lot of fun going through the theoretical details of vehicle dynamics modelling. Let's get started. Let's get it! In the end, I decided to use a 5-dof Dynamic Bicycle Model for my project. This means I consider longitudinal, lateral, yaw, rear wheel rotational x2 motions as my degrees of freedom. I am effectively ignoring pitch and roll coupling effects, and I am hoping I can get away with it. The idea is to use this model with a linear tire model using slip ratios and cornering stiffness coefficients to model how the RC car will behave given two inputs with a current vehicle state.
Inputs: Old_Vehicle_State, Throttle_PWM, Steer_PWM. Outputs: New_Vehicle_State.
The problem with linear tire modelling to find forces acting upon the wheels is that the assumption does not hold at the limit of tire grip. The solution? Use a Quasi-steady-state model with transient dynamics OR use neural networks with a relu activation function for nonlinearities. Obviously neural networks is easier to work with so I decided to go with neural networks and sacrifice observability of the system. In return, I decided to gather BIG data to ensure that the neural networks handled the nonlinear forces for diverse conditions. To sum up, this is the game plan: do a comparison study of different modelling techniques. Below are the 3 models I plan to try out. I will use the Optitrack motion capture system (courtesy of the Lemur lab) to get the system state along with my IR wheel encoder for the rear wheel speed.
- 5 Dof Dynamic Bicycle Model + Linear Tire Model through System I.D.
- 5 Dof Dynamic Bicycle Model + Non Linear Tire Model through System I.D. and Neural Networks (I dub the idea "Deep-System Identification")
- Non linear V.D./Tire Model blended together with Neural Networks
My guess is that if I collect enough data and make the neural networks deep enough, candidate number three will perform the best in terms of accuracy and deployment time. I think the added benefit is that a GPU can parallel process the neural networks for faster computing. The best I can do with a model using Dof models is stick to local body coordinates instead of global coordinates to off-load computing power.
Now here I will go on a tangent and talk about how some engineers feel "uncomfortable" with black box neural network modelling for vehicle dynamics. They feel uncomfortable because its not "explainable/observable," but who needs explaining if its faster and safer for real world applications? Tell me about it. Anyway........the following is my procedure for the experiment.
- Find steer angle as a direct function of steering pwm signals and find the cornering stiffness constant of the tires by holding the car in a constant speed (hold the throttle_pwm fixed) and going around in different circle sizes.
- Do a straight line constant velocity test to find the correlation between the front and rear cornering stiffness. I assume that cornering stiffness directly correlates with the width of the tires (roughly) and I want to validate this assumption.
- Do a straight line acceleration test to double check the cornering stiffness constant.
- Map out the relationship between wheel speed and throttle pwm signaling.
- Find out the moment of inertia in the z-axis using the cornering stiffness constants.
- Do mulitple laps on a full circuit with various vehicle inputs to validate the system and to make sure that there is enough data for NN modelling.
- Train the neural network to compare it against the hybrid model and classical v.d. model
- Be a boss and brag about it at the group meeting.
Next blog will be the actual python script which will calculate the new state from the old state and user inputs. Sad news: I am probably going to ditch my fpv setup. I do not want to create a cornering stiffness coefficent graph based on vehicle load, and the hdmi transmitter is too heavy to ignore as added weight. I also probably need to get lighter body shells than the ones I 3D printed. Hopefully a rally car style body can accommodate an Rpi3 and a mobile phone power bank. Stay tuned!