Starbase/Reference/Approach.yolol
2024-05-09 14:05:30 -07:00

20 lines
665 B
Plaintext

s=15 t=15 m=1000 g=0.800 ib=4 p=0 i=0 x=ib+s u=0
:cdc=2-:cd goto(4-:CD)*:APRCH*(:AU<m)
Kp=0.038 Ki=0.001 Kd=5.4 f=0.3 n=300 Kd*=1-f l=:AU-s goto5 //NSZ
Kp=0.038 Ki=0.001 Kd=5.4 f=0.3 n=500 Kd*=1-f l=:AU-s goto5 //SZ
e=:AU-s p=e p-=(e>n)*(e-n) d=(l-e)*Kd+d*f i+=e*Ki*(:AU<x) r=u/t u+=u<t
l=e z/=:Aprch*(:AU<m)*(d*d>g+e*e>5) :CF=(Kp*p+i)*r :CB=(d-i)*r goto5
if((d*d>g+e*e>5)*:APRCH)<1 then :APRCH=0 :CF=0 :CB=0 goto1end goto5
//Improved PID - Approximated Profiled Motion PID - VER 2.1
// github.com/GameName-Darkyshadow/Starbase
// tips by in game mail are not necessary but appreciated
// Tuning Parameters explained on Github with Manual
// by: Darkyshadow