Feedback gains: Position =
Velocity =
Tilt =
Tilt rate =
Tmax =
dt=
The drive is limited in magnitude to 1.
You can change the position target, xtarget =
0
//Loop window 1){u=1; Colour("red");} //This applies the limit if (u<-1){u=-1; Colour("red");} MoveTo(t,x); x=x+v*dt; v=v+(-10*theta+10*u)*dt; theta=theta+omega*dt; omega=omega+(250*theta-125*u)*dt; t=t+dt; LineTo(t,x); Colour("black"); Spot(t,x); Colour("blue"); Spot(t,v); Colour("red"); Spot(t,theta*10); Colour("green"); Spot(t,omega); Colour("gray"); Spot(t,u); // document.xgain.value=t; if(t