Computing the range of a robot.

In this lab, we'll explore the problems involved in figuring out how fast the robot arm needs to spin in order to launch a ball on a given trajectory.

The setup

We assume that our projectile is a ball bearing stuck to the end of a rotating arm by an electromagnet. We’ll turn the magnet off at a given time, allowing the ball to fly freely.

D1Pos[r_,theta_] := {r*Cos[theta],r*Sin[theta],0};
D1Dir[r_,theta_] := { - Sin[theta], Cos[theta],0};

Launcher[r_,theta_] := {
Graphics3D[Rotate[Cuboid[{-r,-0.1,-0.1},{r,0.1,0.1}],theta,{0,0,1}]],
Graphics3D[Cuboid[{-0.1,-1.5 r,0},{0.1,0.1,0}]],
ParametricPlot3D[{r*Cos[u],r*Sin[u],0},{u,0,2*Pi}]
 };

BallPos[r_,t_,launchtime_] := If[t < launchtime, D1Pos[r+0.1,t],
D1Pos[r+0.1,launchtime] + {-r*Sin[launchtime]*(t-launchtime),r*Cos[launchtime]*(t-launchtime) + -0.1*(t-launchtime)^2,0}];


Ball[r_,t_,launchtime_] := Module[{loc},

Graphics3D[Sphere[BallPos[r,t,launchtime],0.1]]

];

Manipulate[Show[{Launcher[2,theta],Ball[2,theta,launchtime],ParametricPlot3D[BallPos[2,t,launchtime],{t,0,10}]},ImageSize->{400,400},PlotRange->{{-3,10},{-3,3},{-3,3}},ViewPoint->Top,Boxed->False],{theta,0,10},{launchtime,0,2*Pi}]

ParametricPlot3D[Ball[2,t,7Pi/8.0],

 := Module[{loc},

loc = If[t < launchtime, D1Pos[r+0.1,t],
D1Pos[r+0.1,launchtime] + {-r*Sin[launchtime]*(t-launchtime),r*Cos[launchtime]*(t-launchtime) + -0.1*(t-launchtime)^2,0}];

Graphics3D[Sphere[loc,0.1]]

];