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! :smiley:

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.

Quadratic equation time!

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