Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. //PID Code
  2. Error = TargetP - Pitch;
  3. Integral = Integral + (Error*1);
  4.  
  5. Derivitive = (Error - PrevError)/1;
  6. Output = (Kp*Error) + (Ki*Integral) + (Kd*Derivitive);
  7. // 0.00375 For Launch
  8. // 0.00375
  9. PrevError = Error;
  10.  
  11. if(Error > 0.5){SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,Output); SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,0);}
  12.  
  13. if(Error < -0.5){SetThrusterGroupLevel(THGROUP_ATT_PITCHDOWN,-Output); SetThrusterGroupLevel(THGROUP_ATT_PITCHUP,0);}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement