I am working on this short assignment where I have to find the right PD values for a simulated quadcopter. I have to reach 0.9 meters under 1 second with an overshoot of less than 5%. This is my code:
function [ u ] = pd_controller(~, s, s_des, params) %PD_CONTROLLER PD controller for the height % % s: 2x1 vector containing the current state [z; v_z] % s_des: 2x1 vector containing desired state [z; v_z] % params: robot parameters % u = 0; error = s_des - s; z_des = 0.9; Kp = 0.5; Kv = 1.0; u = params.mass*(z_des + Kp*error(1) + Kv*error(2) + params.gravity); end
So far this is my output:
I've tried many different value combinations and so far this is the closest that I could get.