# Ball launching math (with pictures!)

So here at team #4095 camp we have finished going through the math that goes along with firing the ball at different angles so that it can be programmed much easier. And yes, like I promised, there are pictures of the math!

Setting everything up

Iām assuming you can tell that that is in fact a right triangle, not at all to scale, but it does what we want it to. But here are all of the variables:
Y = The height from the ground to the top of the rim of the hoop.
Yo = Initial height, where the ball leaves the shooter.
Ī = The angle that the ball leaves at when shot at the hoop (projectile).
dc (camDist) = The distance of the camera Ā© to the bottom of the highest reflective tape.
Īc = Angle of the camera to the line parallel to the ground.
d adjusted (hoopDist) = The distance from shooter to the boards that the hoop is on, minus the distance to the center of the hoop.

Finding Y

g = Acceleration by gravity, 9.8 m/s/s or 32.2 ft/s/s.
v = Velocity of the ball.
You can see the math here, and in the next step weāll break it apart a bit more.

Finding more Y

Top left: Yo is subtracted over to the other side of the equations. TAN is split into SINĪ over COSĪ, then 1-COSĪ over COSĪ (yay trigonometric identities!).
Bottom left: Excluding the subtraction of gd^2/2(vCOSĪ)^2, we move d into the numerator.
Bottom right: This part is distributed into separate fractions.

Now we have this

Self explanatory. If you donāt know, \ just means that I am continuing the equation on the next line.

Ha, I can only use five images. Continued next. (Iām sorry about the double post, but you leave me no choice delphi).

Making some constants

Just for easier use. Also as an aside, now looking back on this J doesnāt seem necessary because (Y - Yo) is already contained in parenthesis so it shouldnāt matter if it getās changed into a constant or not.

We now have put this equation into where we can take it and put it into the quadratic equation.

And for ease

We just use the variables that we defined earlier just so that transitioning it into code will be easier.

Important stuff [READ]: If you take only the part under the square root sign, you can find out if it will reach the hoop or not. If it is less than zero, than it will not reach it, but if it is greater than zero it will reach it.

Hope this helps you if youāre stuck. Also if you see a miscalculation please donāt hesitate to call us out on it!

/me slams face on table.

We apologize our equation is wrong. Weāll get up more information once we figure this out.

Where can I find some information on how to define set and retrieve registry values in Labview.
Iām attempting to change the constant strings in begin, teleop and disable and getting undefined references to the registry.

See attachment:

This is what we NOW use!

Not to overcomplicate things, but a (acceleration of ball) is not a constant āgā, but a summation of acceleration due to gravity, Drag, and Lift.

Change in gravity is a function of Y.

Acceleration due to drag is a function of velocity where a_d = .5rhoV^2*Cd / M_ball (rho = air density (function of temperature), Cd = drag coefficient for spherical ball, M_ball = ball mass)

Acceleration due to lift is a function of ball spin where a_l = 16/3pi^2R^3alpharho*V
(alpha is spin rate in radians/sec, R is ball radius), perpendicular to the spin axis

Sum the forces together in 3 dimensions to get the actual āaā in your equation, but calculating the final position would require iteration or an ODE solver.

Maybe this could be a good student summer post-build season project ::rtm::

Weāre working with the āshoot the ball with a nice flat trajectoryā equation, hoping we donāt have to adjust anything as long as weāre on the keyā¦

Yes, thatās been discussed at great length here on CD

.

Thereās a paper here that someone posted a link to a few weeks ago which discusses the effects of air friction and magnus effect, and concluded that it would be reasonable to ignore them.

I donāt know whether or not I agree with that conclusion, but I suspect that even if those effects were included, other factors such as variations in ball mass, size, compressibility, surface texture, and location of center-of-mass relative to center-of-volume, and air currents and atmospheric pressure would play a roleā¦ not to mention the effect of variations from shot-to-shot in the launcher itself.

Bottom line: in this application, equations are useful for getting a ballpark estimate.

Change in gravity is a function of Y.

You werenāt seriously suggesting changing āgā with height of the ball should be considered, were you? I didnāt see a smiley face at the end of that.

calculating the final position would require iteration or an ODE solver.

With air friction and magnus included, the DE would be non-linear, and itās unlikely that an ODE solver could find a closed-form solution. The only way to solve would be numerical (āiterationā, most likely rk4).

Maybe this could be a good student summer post-build season project

I think there have been a couple of attempts already that have been posted here.

Very good but this is more accurate y = e^(āxĀ²)+(z2-z3)^2 = 4(z3-z1)(z1-z2) sin^2 alpha/2 if z1,z2,z3