From 59345992dbf2f3377fd3010b51f95f3ae138aee9 Mon Sep 17 00:00:00 2001 From: bpmcgeeney Date: Thu, 14 Oct 2021 18:25:33 -0700 Subject: [PATCH] Adding back PID gains since they didn't survive the merge for some reason --- matlabHelpers/simPlot.m | 3 --- src/main.cpp | 9 +++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/matlabHelpers/simPlot.m b/matlabHelpers/simPlot.m index 461ad18..45e56aa 100644 --- a/matlabHelpers/simPlot.m +++ b/matlabHelpers/simPlot.m @@ -51,7 +51,6 @@ title('Altitude vs Time') xlabel('Time (s)') ylabel('Altitude (m)') ylim([0 z(1)+5]) -saveas(gcf,'outputs/Accel-Vel-Alt vs Time.png') figure(2) @@ -75,7 +74,6 @@ plot(t, rolldot) title('Angular Velocity vs Time') xlabel('Time (ms)') ylabel('Angular Velocity (deg/s)') -saveas(gcf,'outputs/Euler Angles vs Time.png') legend("yawdot", "pitchdot", "rolldot") figure(3) @@ -93,4 +91,3 @@ plot(t, Servo2) title('Servo 2 Position vs Time') xlabel('Time (ms)') ylabel('Servo 2 Position (rad)') -saveas(gcf,'outputs/Servo Position vs Time.png') diff --git a/src/main.cpp b/src/main.cpp index 412b1d7..c2f29fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,14 +17,19 @@ int main() { Vehicle State; Vehicle PrevState; + // PID Gains + State.Kp = -6.8699; + State.Ki = 0; + State.Kd = -0.775; + // Initial Velocity State.vx = 0; // [m/s] State.vy = 0; // [m/s] State.vz = 0; // [m/s] // Initial YPR - State.yaw = 10 * M_PI / 180; // [rad] - State.pitch = 5 * M_PI / 180; // [rad] + State.yaw = 75 * M_PI / 180; // [rad] + State.pitch = 35 * M_PI / 180; // [rad] State.roll = 0 * M_PI / 180; // [rad] // Initial YPRdot