A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles
Abstract
:1. Introduction
2. Construction of Longitudinal PID Controller for a Vehicle
2.1. Longitudinal Dynamics Modeling of the Vehicle
- (1)
- Driving Force : The driving force is provided by the engine or motor and transmitted to the wheels through the drivetrain.is the driving force on the front wheels, and is the driving force on the rear wheels.
- (2)
- Aerodynamic Drag : This is proportional to the square of the vehicle’s speed, and typically expressed as
- (3)
- Rolling Resistance : The friction force between the tires and the road, expressed as
- (4)
- Braking Force : Generated by the braking system, controlling the deceleration of the vehicle.The longitudinal dynamics model of the autonomous vehicle is expressed as
2.2. PID Control
2.3. PID Controller Construction
3. PID Controller Parameter Optimization
3.1. Basic Principles of Genetic Algorithm
- Initialize Population: Randomly generate a set of possible solutions, with each individual representing one solution.
- Fitness Evaluation: Use a fitness function to evaluate the quality of each individual.
- Selection: Select the better individuals as parents based on their fitness, with higher chances for superior individuals to be chosen.
- Crossover: Perform crossover operations between parent individuals to generate new individuals, combining genes from both parents.
- Mutation: Randomly mutate some individuals to increase population diversity.
- Iteration: Repeat the above steps to create a new population until the optimization conditions are met.
- Output: The algorithm ultimately outputs the individual with the highest fitness as the optimal solution.
3.2. Optimization Algorithm Design
- is the objective function, which represents the total error to be minimized;
- is the actual speed at time ;
- is the desired speed at time ;
- is the total time duration considered.
- Initialize the PID controller parameters and generate the initial population.
- Input the PID controller parameters into the controller and simulate the longitudinal motion control process by controlling the vehicle’s speed.
- Evaluate the performance of the current controller based on the error between the actual vehicle speed and the target speed.
- Check if the error meets the termination condition. If it does, stop the optimization process and output the controller parameters. If not, proceed to the next step.
- Select the better individuals based on the fitness function, with superior individuals having a higher chance of advancing to the next generation.
- Perform crossover operations on the selected individuals to combine gene information from the parents, generating new individuals.
- Apply gene mutation to the individuals in the population to increase diversity and help escape local optima.
- Generate a new population consisting of multiple individuals, each representing a possible set of PID parameters, and reinput them into the PID controller.
4. Simulation Results and Discussion
4.1. Experiment Design
- 0–6 s: The vehicle accelerates from 0 km/h to 40 km/h, simulating the start-up acceleration process.
- 6–9 s: The vehicle maintains a constant speed of 40 km/h for 3 s.
- 9–15 s: The vehicle accelerates from 40 km/h to 80 km/h over 6 s, simulating the second phase of acceleration.
- 15–21 s: The vehicle maintains a constant speed of 80 km/h for 6 s.
- 21–24 s: The vehicle accelerates from 80 km/h to 100 km/h over 3 s, simulating the final phase of acceleration.
- 24–27 s: The vehicle maintains a constant speed of 100 km/h for 3 s.
- After 27 s: The vehicle begins to decelerate gradually from 100 km/h to 0 km/h, simulating the complete acceleration–deceleration process.
4.2. Error Analysis
4.3. Experimental Results Analysis
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
Appendix A
Algorithm A1. PID Parameter Optimization Based on Genetic Algorithm |
% Genetic Algorithm-based PID Parameter Optimization (Minimize Speed Error) % Objective: Optimize PID parameters Kp, Ki, Kd % Clear workspace clear; clc; % Set Genetic Algorithm parameters pop_size = 50; % Population size max_gen = 5; % Maximum generations pc = 0.7; % Crossover probability pm = 0.01; % Mutation probability bounds = [1 200; % Range of Kp 0 10; % Range of Ki 0 10]; % Range of Kd % Initialize population pop = init_population(pop_size, bounds); % Set target speed (can be a constant value or based on model settings) target_speed = 30; % Assume target speed is 30 m/s % Main Genetic Algorithm loop for gen = 1:max_gen % Calculate fitness fitness = zeros(pop_size, 1); for i = 1:pop_size params = pop(i, :); fitness(i) = fitness_function(params, target_speed); % Evaluate individual end % Select individuals selected_pop = selection(pop, fitness); % Crossover operation new_pop = crossover(selected_pop, pc, bounds); % Mutation operation new_pop = mutation(new_pop, pm, bounds); % Update population pop = new_pop; % Output best fitness of current generation [best_fitness, best_index] = min(fitness); best_params = pop(best_index, :); fprintf(‘Generation: %d, Best Fitness: %.4f, Best Parameters: [Kp = %.4f, Ki = %.4f, Kd = %.4f]\n’, … gen, best_fitness, best_params (1), best_params (2), best_params (3)); end % Output final result fprintf(‘Optimization complete, Best PID Parameters: Kp = %.4f, Ki = %.4f, Kd = %.4f\n’, … best_params (1), best_params (2), best_params (3)); %% Initialize Population Function function pop = init_population(pop_size, bounds) num_params = size(bounds, 1); pop = zeros(pop_size, num_params); for i = 1:pop_size for j = 1:num_params pop(i, j) = bounds(j, 1) + rand × (bounds(j, 2) − bounds(j, 1)); end end end %% Fitness Function (Objective Function − Minimize Speed Error) function fitness = fitness_function(params, target_speed) Kp = params (1); Ki = params (2); Kd = params (3); % Set PID controller parameters assignin(‘base’, ‘Kp’, Kp); assignin(‘base’, ‘Ki’, Ki); assignin(‘base’, ‘Kd’, Kd); % Run Simulink model and get simulation results simOut = sim(‘vehicl_model_0910_2019b’, … ‘SimulationMode’, ‘normal’, … ‘SaveOutput’, ‘on’, … ‘SrcWorkspace’, ‘current’); % Extract vehicle speed and time data from simOut speed = simOut.vehicle_speed; % Extract vehicle speed time = simOut.tout; % Extract time data % Calculate speed error speed_error = target_speed − speed; % Calculate Integral of Absolute Error (IAE) as fitness function IAE = sum(abs(speed_error) .× diff([0; time])); % Fitness function (smaller IAE is better) fitness = IAE; end %% Selection Function (Roulette Wheel Selection) function selected_pop = selection(pop, fitness) pop_size = size(pop, 1); fitness_inv = 1./fitness; % Inverse fitness prob = fitness_inv/sum(fitness_inv); % Selection probability cum_prob = cumsum(prob); % Cumulative probability selected_pop = zeros(size(pop)); for i = 1:pop_size r = rand; idx = find(cum_prob >= r, 1, ‘first’); selected_pop(i, :) = pop(idx, :); end end %% Crossover Function function new_pop = crossover(pop, pc, bounds) pop_size = size(pop, 1); num_params = size(pop, 2); new_pop = pop; for i = 1:2:pop_size if rand < pc % Randomly select crossover point crossover_point = randi([1 num_params-1]); % Crossover operation new_pop(i, crossover_point + 1:end) = pop(i + 1, crossover_point + 1:end); new_pop(i + 1, crossover_point + 1:end) = pop(i, crossover_point + 1:end); end end end %% Mutation Function function mutated_pop = mutation(pop, pm, bounds) pop_size = size(pop, 1); num_params = size(pop, 2); mutated_pop = pop; for i = 1:pop_size for j = 1:num_params if rand < pm mutated_pop(i, j) = bounds(j, 1) + rand × (bounds(j, 2) − bounds(j, 1)); end end end end |
References
- Varma, B.; Swamy, N.; Mukherjee, S. Trajectory Tracking of Autonomous Vehicles using Different Control Techniques (PID vs. LQR vs. MPC). In Proceedings of the 2020 International Conference on Smart Technologies in Computing, Electrical and Electronics (ICSTCEE), Bengaluru, India, 9–10 October 2020. [Google Scholar]
- Liu, X.; Liang, J.; Fu, J. A dynamic trajectory planning method for lane-changing maneuver of connected and automated vehicles. Proc. Inst. Mech. Eng. Part D J. Automob. Eng. 2021, 235, 1808–1824. [Google Scholar] [CrossRef]
- Liu, Y.; Jiang, J. Optimum path-tracking control for inverse problem of vehicle handling dynamics. J. Mech. Sci. Technol. 2016, 30, 3433–3440. [Google Scholar] [CrossRef]
- Pang, H.; Liu, N.; Hu, C.; Xu, Z. A practical trajectory tracking control of autonomous vehicles using linear time-varying MPC method. Proc. Inst. Mech. Eng. Part D J. Automob. Eng. 2022, 236, 709–723. [Google Scholar] [CrossRef]
- Wang, Z.; Wei, C. Human-centred risk-potential-based trajectory planning of autonomous vehicles. Proc. Inst. Mech. Eng. Part D J. Automob. Eng. 2022, 237, 393–409. [Google Scholar] [CrossRef]
- Yin, J.-K.; Fu, W.-P. Framework of integrating trajectory replanning with tracking for self-driving cars. J. Mech. Sci. Technol. 2021, 35, 5655–5663. [Google Scholar] [CrossRef]
- Zhang, C.; Wang, C.; Wei, Y.; Wang, J. Neural network adaptive position tracking control of underactuated autonomous surface vehicle. J. Mech. Sci. Technol. 2020, 34, 855–865. [Google Scholar] [CrossRef]
- Calzolari, D.; Schürmann, B.; Althoff, M. Comparison of trajectory tracking controllers for autonomous vehicles. In Proceedings of the 2017 IEEE 20th International Conference on Intelligent Transportation Systems (ITSC), Yokohama, Japan, 16–19 October 2017. [Google Scholar]
- Zhu, Q.; Luo, Z.; Jiang, T.; Lu, Z.; Xia, M.; Hong, Y. Design and Motion Control of Six-Wheel Multi-Mode Mobile Robot. Trans. Chin. Soc. Agric. Mach. 2024, 1–8. [Google Scholar]
- Feng, G.; Zhao, D.; Li, S. Research on Air Spring Modeling and Active Suspension Control for Electric Vehicles Based on Fractional Order. Automot. Eng. 2024, 46, 1282–1293+1301. [Google Scholar]
- Li, J.; Pan, S.; Lou, J.; Li, Y.; Xu, Y. Application of Fuzzy PID Variable Structure Adaptive Algorithm in Vector Control of Steering Motor for Unmanned Vehicle. J. Electr. Mach. Control 2024, 28, 152–159. [Google Scholar]
- Wu, J.; Zhang, H. Fuzzy PID Control of Magnetorheological Brake with Dual-Coil Optimized by Genetic Algorithm. Automot. Eng. 2024, 46, 526–535. [Google Scholar]
- Lü, H.; Wang, X.; Xie, B.; Li, Q. Research on In-Place Steering Mechanism and Control Method of Distributed Electric Drive Vehicles. China J. Highw. Transp. 2024, 37, 231–244. [Google Scholar]
- Xiao, L.; Ma, L.; Huang, X. Intelligent fractional-order integral sliding mode control for PMSM based on an improved cascade observer. Front. Inform. Technol. Electron. Eng. 2022, 23, 328–338. [Google Scholar] [CrossRef]
- Lu, Y.; He, Y.; Tian, H.; Jiang, K.; Yang, D. Research on Longitudinal Acceleration Planning Method of Adaptive Cruise Control System for Mass Production. Automot. Eng. 2023, 45, 1803–1814. [Google Scholar]
- Li, Z.; Wang, X.; Jia, A. Fuzzy Adaptive PID Control of Cruise Ramjet-Extended Range Guided Projectile. Electro-Opt. Control 2023, 30, 22–28. [Google Scholar]
- Liu, S.; Yang, J.; Qin, Y.; Qi, H.; Shao, F. Robust Control Method for the Running Speed of Permanent Magnet Maglev Train Virtual Coupling. Rare Earths 2024, 45, 76–86. [Google Scholar]
- Yang, M.; Tian, J. Research on Adaptive Cruise Control of Pure Electric Vehicles. J. Chongqing Univ. Technol. (Nat. Sci.) 2023, 37, 19–26. [Google Scholar]
- Zhao, S.; Zhang, L.; Gan, Y.; Chen, W. Research on Hierarchical Control of Adaptive Cruise Control for Intelligent Electric Vehicles. J. Chongqing Jiaotong Univ. (Nat. Sci. Ed.) 2023, 42, 135–142. [Google Scholar]
- Ou, J.; Huang, D.; Lin, J.; Yang, E.; Han, X. Multi-Mode Adaptive Cruise Control Strategy with Emergency Braking Function. J. Chongqing Univ. Technol. (Nat. Sci.) 2023, 37, 57–68. [Google Scholar]
- Deng, L.; Lü, D. PID Parameter Tuning of Underwater Robot Motion Attitude Control Based on Genetic Algorithm. Manuf. Autom. 2023, 45, 177–179+206. [Google Scholar]
- Tao, J.; Lu, W.L.; Xiong, H. Improved Genetic Algorithm for PID Parameter Auto-Tuning. Ind. Instrum. Autom. Devices 2004, 2, 30–32. [Google Scholar]
- Liu, S.; Dan, Z.; Lian, B.; Xu, J.; Cao, H. PSO-PID Control Optimization Method for Interferometric Closed-Loop Fiber Optic Gyroscope. Infrared Laser Eng. 2024, 53, 250–261. [Google Scholar]
- Wu, Q.; Zhou, S.; Wang, X. Research on Improved Particle Swarm Optimization BP Neural Network PID Control Strategy for Ball Screw Feed System. J. Xi’an Jiaotong Univ. 2024, 58, 24–33. [Google Scholar]
- Editorial Department of China Journal of Highway and Transport. Summary of Academic Research on Automotive Engineering in China, 2023. China J. Highw. Transp. 2023, 36, 1–192. [Google Scholar]
- Wu, L. Design of Ship Turbine Speed Regulation System Combining Genetic Algorithm and PID Control. Ship Sci. Technol. 2021, 43, 100–102. [Google Scholar]
Mass | 1723 kg |
Drag Coefficient | 0.3 |
Vehicle Frontal Area | 2.5 m2 |
Air Density | 1.225 kg/m3 |
Rolling Resistance Coefficient | 0.015 |
Gravitational Acceleration | 9.8 m/s2 |
Road Adhesion Coefficient | Maximum Value (m/s) | Average Value (m/s) | Standard Deviation (m/s) |
---|---|---|---|
0.5 | 0.222 | 0.063 | 0.124 |
0.6 | 0.180 | 0.056 | 0.099 |
0.8 | 0.179 | 0.056 | 0.098 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Chen, J.; Tian, G. A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles. Appl. Sci. 2024, 14, 10209. https://doi.org/10.3390/app142210209
Chen J, Tian G. A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles. Applied Sciences. 2024; 14(22):10209. https://doi.org/10.3390/app142210209
Chicago/Turabian StyleChen, Jianqiao, and Guofu Tian. 2024. "A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles" Applied Sciences 14, no. 22: 10209. https://doi.org/10.3390/app142210209
APA StyleChen, J., & Tian, G. (2024). A Tuning Method for Speed Tracking Controller Parameters of Autonomous Vehicles. Applied Sciences, 14(22), 10209. https://doi.org/10.3390/app142210209