Commit 6754371f authored by mmroma's avatar mmroma
Browse files

Added method to change PID gains. Anne needs to finish connecting the params...

Added method to change PID gains. Anne needs to finish connecting the params into the Simulink PID blocks.
parent 522625b3
function [vehicle_params] = setPIDgains(vehicle_params)
%SETPIDGAINS
%% Position -> Velocity
% x
vehicle_params.PIDctrl.x.kP = 1;
% y
vehicle_params.PIDctrl.y.kP = 1;
% z
vehicle_params.PIDctrl.z.kP = 1;
vehicle_params.PIDctrl.z.kI = 0;
vehicle_params.PIDctrl.z.kD = 0;
%% Velocity -> Acceleration
% x-dot
vehicle_params.PIDctrl.x_dot.kP = 1;
vehicle_params.PIDctrl.x_dot.kI = 0;
vehicle_params.PIDctrl.x_dot.kD = 0;
% y-dot
vehicle_params.PIDctrl.y_dot.kP = 1;
vehicle_params.PIDctrl.y_dot.kI = 0;
vehicle_params.PIDctrl.y_dot.kD = 0;
% z-dot
vehicle_params.PIDctrl.z_dot.kP = 1;
vehicle_params.PIDctrl.z_dot.kI = 0;
vehicle_params.PIDctrl.z_dot.kD = 0;
%% Attitude -> Attitude Rate
% Roll
vehicle_params.PIDctrl.roll.kP = 1;
vehicle_params.PIDctrl.roll.kI = 0;
vehicle_params.PIDctrl.roll.kD = 0;
% Pitch
vehicle_params.PIDctrl.pitch.kP = 1;
vehicle_params.PIDctrl.pitch.kI = 0;
vehicle_params.PIDctrl.pitch.kD = 0;
% Yaw
vehicle_params.PIDctrl.yaw.kP = 1;
vehicle_params.PIDctrl.yaw.kI = 0;
vehicle_params.PIDctrl.yaw.kD = 0;
%% Attitude Rate -> Torques
% Roll Rate
vehicle_params.PIDctrl.roll_rate.kP = 1;
vehicle_params.PIDctrl.roll_rate.kI = 0;
vehicle_params.PIDctrl.roll_rate.kD = 0;
% Pitch Rate
vehicle_params.PIDctrl.pitch_rate.kP = 1;
vehicle_params.PIDctrl.pitch_rate.kI = 0;
vehicle_params.PIDctrl.pitch_rate.kD = 0;
% Yaw Rate
vehicle_params.PIDctrl.yaw_rate.kP = 1;
vehicle_params.PIDctrl.yaw_rate.kI = 0;
vehicle_params.PIDctrl.yaw_rate.kD = 0;
end
...@@ -92,6 +92,9 @@ function [params] = setUpParameters_OneQuad(traj_num) ...@@ -92,6 +92,9 @@ function [params] = setUpParameters_OneQuad(traj_num)
params.multirotors{1}.noise_seed = 101:112; params.multirotors{1}.noise_seed = 101:112;
%% Specify PID controller gains
params.multirotors{1} = setPIDgains(params.multirotors{1});
end end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment