Pendulum simulation
Command
c = .01; d = .04; e = 1.61; f = .44;
//stepmodel() u=c*(x-command)+d*v+e*tilt+f*tiltrate; x=x+v*dt; v=v+10*u*dt; tilt=tilt+tiltrate*dt; tiltrate=tiltrate + (10*Math.sin(tilt) - 10*u*Math.cos(tilt))*dt; Move(trolley, x, 0); Move(bob, x + Math.sin(tilt), Math.cos(tilt)); //round again if (running){setTimeout("stepmodel()",10);}