PID for fixed distance
조회 수: 7(최근 30일)
Hello everyone, I attach here my model of a car moving towards that must maintain a fixed distance of 100m from the car in front of it. I have drawn all the schemes which seem to be correct. I have a signal reference that must be followed with a constant error, but I'm not able to understand why I have divergence between the reference signal and the actual position of my vehicle, whichever value of the gains I use, from the smallest to the largest.
I really hope someone could help me. Thank you very much!
Sam Chak 2022년 11월 9일
I think your control design part is okay. But the divergence issue is probably related to the way you setup the simulation (Error – 100). Thus, I have made a super simple model (ignoring the aerodynamics and frictions) in this example.
The Auto-Cruise Control Car should follow the Reference, which is the trajectory of the "Car-in-front – 100".
% Super Simple Car motion model
J = 1000;
s = tf('s');
Gp = minreal(1/(J*s^2))
% Super Simple PID Controller
Gc = pid(0, 0, 500, 0.5)
Gcl = minreal(feedback(Gc*Gp, 1))
Amp = 50;
Tp = 300; % 1 cycle period
Tf = 300; % final time simulation (5 minutes)
Ts = 0.1; % sampling time interval
[u, t] = gensig('sine', Tp, Tf, Ts); % standard sine wave generation
Car = Amp*u + 150; % Car in front of your vehicle
Ref = Car - 100; % Reference for Auto-Cruise Control Car
y = lsim(Gcl, Ref, t);
plot(t, Car, t, y, 'linewidth', 1.5), grid on, xlabel('t'), ylabel('Position of Vehicles')
legend('Car-in-front', 'Auto-Cruiser', 'location', 'best', 'FontSize', 14)
error = Car - y; % relative distance of Car-in-front ahead of your vehicle
plot(t, error, 'linewidth', 1.5), grid on, xlabel('t, sec'), ylabel('Relative Distance, m')
title('ACC Car attempts to maintain a relative distance of 100 m')
By the way, in your 1st question, have you identified the cause of the problem (fuzzy controller) based on the given advice?
You can update the progress, or close it if your problem solved. Thanks.