1
0
mirror of https://gitlab.com/lander-team/lander-cpp.git synced 2025-07-25 23:51:35 +00:00

changed all LQR references to PID

This commit is contained in:
2021-10-14 18:02:01 -07:00
parent ee9fa3a3d1
commit a452b30fae
5 changed files with 33 additions and 93 deletions

View File

@@ -36,7 +36,7 @@ S = icare(A, B, Q, R);
K = Rinv * B' * S;
%% Outputs
% Copy results in command window to LQRcalc function in C++
% Copy results in command window to PIDcalc function in C++
fprintf("double K11 = %3.5f;\n", K(1, 1))
fprintf("double K12 = %3.5f;\n", K(1, 2))
fprintf("double K13 = %3.5f;\n", K(1, 3))

View File

@@ -27,8 +27,8 @@ rolldot = T(:, 16);
Servo1 = T(:, 17);
Servo2 = T(:, 18);
LQRx = T(:, 20);
LQRy = T(:, 21);
PIDx = T(:, 20);
PIDy = T(:, 21);
% Acceleration
subplot(3, 1, 1)
@@ -99,15 +99,15 @@ figure(4)
% Servo 1 Position
subplot(2, 1, 1)
plot(t, LQRx)
title('LQRx vs Time')
plot(t, PIDx)
title('PIDx vs Time')
xlabel('Time (ms)')
ylabel('LQRx')
ylabel('PIDx')
% Servo 2 Position
subplot(2, 1, 2)
plot(t, LQRy)
title('LQRy vs Time')
plot(t, PIDy)
title('PIDy vs Time')
xlabel('Time (ms)')
ylabel('LQRy')
ylabel('PIDy')
%saveas(gcf,'outputs/Servo Position vs Time.png')