PID for fixed distance

7 views (last 30 days)
Andrea Tonelli
Andrea Tonelli on 8 Nov 2022
Commented: Andrea Tonelli on 9 Nov 2022
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!

Answers (1)

Sam Chak
Sam Chak on 9 Nov 2022
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))
Gp = 0.001 ----- s^2 Continuous-time transfer function.
% Super Simple PID Controller
Gc = pid(0, 0, 500, 0.5)
Gc = s Kp + Kd * -------- Tf*s+1 with Kp = 0, Kd = 500, Tf = 0.5 Continuous-time PDF controller in parallel form.
Gcl = minreal(feedback(Gc*Gp, 1))
Gcl = 1 ------------- s^2 + 2 s + 1 Continuous-time transfer function.
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.
  3 Comments
Andrea Tonelli
Andrea Tonelli on 9 Nov 2022
Still nothing changes. I will try to work on the gains.

Sign in to comment.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by