FramesPerSecond = 30;
r = (p/2) /. constantrules;
t0 = 0;
tf = 3;
solnsandconstants = Join[solns,  constantrules];
p0rh = {
	x[t]-r Sin[alpha[t]] Sin[theta[t]],
	y[t]+r Sin[alpha[t]] Cos[theta[t]],
	-r Cos[alpha[t]]
};
p0fh = {
	x[t]-r Sin[alpha[t]] Sin[theta[t]] + l2 Cos[theta[t]],
	y[t]+r Sin[alpha[t]] Cos[theta[t]] + l2 Sin[theta[t]],
	-r Cos[alpha[t]]
};
(* The following line is for zero rake angle.*)
steerhead = p0rh + Rz[theta[t]].Rx[alpha[t]].{l2, 0, -1.5 r};
R0rh = Rz[theta[t]].Rx[alpha[t]];
R0fh = Rz[theta[t]].Rx[alpha[t]].Rz[ ArcTan[ Cos[alpha[t]] u2[t] ] ];
circr[s_] := ({{0,1,0},{1,0,0},{0,0,-1}}.(p0rh +R0rh.{ Cos[s], 0, Sin[s]}))/.solnsandconstants;
circf[s_] := ({{0,1,0},{1,0,0},{0,0,-1}}.(p0fh + R0fh.{ Cos[s], 0, Sin[s]}))/.solnsandconstants;

projxy[x_]:= {{1,0,0},{0,1,0},{0,0,0}}.x;

Animate[
        Graphics3D[
			{
				{
					Line[{{-5,-5,0},{-5,25,0}}]
				},
				{
					Line[{{-5,25,0},{10,25,0}}]
				},
				{
					Line[{{10,25,0},{10,-5,0}}]
				},
				{
					Line[{{10,-5,0},{-5,-5,0}}]
				},
				{
					GrayLevel[0.9],
					EdgeForm[],
					Polygon[
							Table[
								(projxy[circf[s]]/.solnsandconstants),{
								s,0, 2 Pi, 2 Pi/30}
							]
					]
				},
				{
					GrayLevel[0.9],
					EdgeForm[],
					Polygon[
							Table[
								(projxy[circr[s]]/.solnsandconstants),
								{s,0, 2 Pi, 2 Pi/30}
							]
					]
				},
				{
					FaceForm[RGBColor[0.15,0.3,1], RGBColor[1,0.9,0]],
					EdgeForm[{ GrayLevel[0], Thickness[0.005] }],
					Polygon[
							Table[circr[s]/.solnsandconstants,{s,0, 2 Pi, 2 Pi/30}]
					]
				},
				{
					FaceForm[RGBColor[0.15,0.3,1], RGBColor[1,0.9,0]],
					EdgeForm[{ GrayLevel[0], Thickness[0.005]}],
					Polygon[
							Table[
								circf[s]/.solnsandconstants,
								{s,0, 2 Pi, 2 Pi/30}
							]
					]
				},
				{
					Thickness[0.005],
					Line[{
							{{0,1,0},{1,0,0},{0,0,-1}}.p0rh, 
							{{0,1,0},{1,0,0},{0,0,-1}}.steerhead
						}/.solnsandconstants
					]
				},
				{
					Thickness[0.005],
					Line[{
							{{0,1,0},{1,0,0},{0,0,-1}}.p0fh, 
							{{0,1,0},{1,0,0},{0,0,-1}}.steerhead
						}/.solnsandconstants
					]
				}
			},
			PlotRange -> {{-5,10},{-5,25},{0,6}},
            PlotRegion -> {{0,1},{0,1}},
            Boxed->False
		],
		{t,t0,tf,1/FramesPerSecond}
]


(* 
			Balancing Bicycle
				Tracking
	Sinusiodal Roll-Angle Trajectory
	After Recovering from Near-Fall
	
				Neil Getz
				 2-13-94
*)