Feedback gains: Tilt =
Tilt rate =
Wheel turns =
Wheel speed =
Tmax =
dt=
The drive is limited in magnitude to 1.
You can change the position target, phitarget =
0
//Loop window 1){u=1; Colour("red");} //This applies the limit if (u<-1){u=-1; Colour("red");} theta=theta+omega*dt; omega=omega+(80*theta+2*phirate-50*u)*dt; phi=phi+phirate*dt phirate=phirate+(-4*phirate+100*u)*dt x=(theta+phi)*r; v=(omega+phirate)*r; t=t+dt; Colour("black"); Spot(t,x/10); Colour("blue"); Spot(t,v/10); Colour("red"); Spot(t,theta*10); Colour("green"); Spot(t,omega); Colour("gray"); Spot(t,u); if(t