Bicycle Challenge - fully automatic
The ball is the rider, the dots are the back view of the wheel.
This is the position demand.
Position demand =
0
metres.
0.5){angdem=0.5;} if(angdem<-0.5){angdem=-0.5;} leandem= 1.0*(angdem-ang); if(leandem>0.3){leandem=0.3;} if(leandem<-0.3){leandem=-0.3;} steer=20*(lean-leandem)+6*leanrate; cos=Math.cos(lean); sin=Math.sin(lean); leanrate=leanrate+(10*sin-16*steer*cos)*dt; lean=lean+leanrate*dt; ang=ang+4*steer*dt; x=x+4*ang*dt; // Move the picture Move(rider, x+sin, -cos); for(i=0;i<5;i++){ Move(wheel[i], x+i*sin/6, -i*cos/6); } //round again if(running){setTimeout("stepmodel()",40);} ]]>