Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Calculating Angle to fire at (http://www.chiefdelphi.com/forums/showthread.php?t=41363)

artdutra04 09-01-2006 02:17

Re: Calculating Angle to fire at
 
Now I know that all those hours I seemingly "wasted" in middle school playing Pocket Tanks has finally come to some use! And all my teacher's never believed me when I told them that learning how to calculate ballistic trajectories on the fly and in my head would become an important skill someday. :rolleyes:

EOC 09-01-2006 09:54

Re: Calculating Angle to fire at
 
It seems to me that there are so many factors(air resistance, spin, etc.) that are not in standard projectile equations that calculations won't be very useful. Experimentation will be required.

Rick TYler 09-01-2006 10:03

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by EOC
It seems to me that there are so many factors(air resistance, spin, etc.) that are not in standard projectile equations that calculations won't be very useful. Experimentation will be required.

I was trying to explain to a teammate that the US Navy has been calculating ballistic trajectories for at least 150 years, and even with their experience they still frequently miss on the first shot. If you don't combine your math with experimentation and the ability to fine-tune shooting angles at the competition you are probably going to have troubles hitting the goal.

Brokoro 09-01-2006 10:14

Re: Calculating Angle to fire at
 
Here is an old equation i used a looong while back... see how you like it...

(It's a very simple equation)

V= Ft/s
A=Angle of take off

(-16/V^2 *((CosA)^2)*X^2) + (X(TanA))

Though this is a great equation, I'd would only use it in approximation. It is very simple and can be done by hand but is meant to be seen on a graphing calculator. So I hope this helps for the newcomers.

Eldarion 09-01-2006 12:32

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Brokoro
Here is an old equation i used a looong while back... see how you like it...

(It's a very simple equation)

V= Ft/s
A=Angle of take off

(-16/V^2 *((CosA)^2)*X^2) + (X(TanA))

Though this is a great equation, I'd would only use it in approximation. It is very simple and can be done by hand but is meant to be seen on a graphing calculator. So I hope this helps for the newcomers.

All that is is the standard position equation with the trig to split an angle up into its component vectors. We need to be able to compute the desired angle, given speed and range, which I don't think that equation can do. :)

Kevin Watson 09-01-2006 13:02

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by EOC
It seems to me that there are so many factors(air resistance, spin, etc.) that are not in standard projectile equations that calculations won't be very useful. Experimentation will be required.

Air resistance at these velocities can be effectively considered to be zero. Spin stabilization of projectiles is done to decrease the effect of orthogonal forces like wind. I would just stick with the projectile motion equations, which should work just fine at these velocities and distances.

BTW, I've seen a 'bot that can use the camera to position itself and fire ball after ball into the target, so I know that teams can do it if they put the effort into it.

-Kevin

Kevin Sevcik 09-01-2006 13:32

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Kevin Watson
Air resistance at these velocities can be effectively considered to be zero. Spin stabilization of projectiles is done to decrease the effect of orthogonal forces like wind. I would just stick with the projectile motion equations, which should work just fine at these velocities and distances.

BTW, I've seen a 'bot that can use the camera to position itself and fire ball after ball into the target, so I know that teams can do it if they put the effort into it.

-Kevin

Using your standard Fd=1/2*Cd*rho*A*v^2, I get a drag force of over 1N. On a 183 gram ball, it works out to an additional 6 m/s^2 deceleration. Is that really negligible?

Assumptions: Cd=0.5, rho=1.29 kg/m^3, A = (7/2)^2*pi in^2 = 0.025 m^2, v=12 m/s

I know it's not as significant as if we were firing ping-pong balls, but I don't think standard ballistics will give much accuracy without a large fudge factor.

Kevin Watson 09-01-2006 14:17

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Kevin Sevcik
Using your standard Fd=1/2*Cd*rho*A*v^2

Hmmm, while we're picking nits, is your assumption that Cd = 0.5 a good one? 0.5 is worst case for a smooth sphere with perfect laminar flow over the surface. These balls are more like golf balls, which produce quite a bit of turbulence behind them, which can drop the Cd by at least half. Also, your drag force assumes a constant velocity. Is this really the case?

I guess I should have said that the effects of wind resistance should be ignored. Discussing drag coefficients and the Reynold's number of a nerf basketball is silly and will only serve to confuse people, who might get turned-off to the idea of going for the three point score.

-Kevin

kmcclary 09-01-2006 14:23

Foxtrot Comic link Re: Calculating Angle to fire at
 
Quote:

Originally Posted by varcsscotty
OK! something really funny just happened. I was working on these trajectories and having quite the frustrating time with them....
In walks my brother with the comics section of The Oregonian newspaper. He tells me to read the Foxtrot comic, so I do. And what do I find? I find the Foxtrot dude doing equations to calculate the trajectory of a snowball. That made my day! So I got the equations now...heeheehee

Here's the comic: http://www.ucomics.com/foxtrot/2006/01/08/

Enjoy!

- Keith

Kevin Sevcik 09-01-2006 14:31

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Kevin Watson
Hmmm, while we're picking nits, is your assumption that Cd = 0.5 a good one? 0.5 is worst case for a smooth sphere with perfect laminar flow over the surface. These balls are more like golf balls, which produce quite a bit of turbulence behind them, which can drop the Cd by at least half. Also, your drag force assumes a constant velocity. Is this really the case?

I guess I should have said that the effects of wind resistance should be ignored. Discussing drag coefficients and the Reynold's number of a nerf basketball is silly and will only serve to confuse people, who might get turned-off to the idea of going for the three point score.

-Kevin

I will grant you all those points. I didn't really want to pull out my fluid dynamics book or anything. I've got a quick and dirty spreadsheet I'll be posting later tonight to help out any teams lacking in physics. I'll probably settle on a .25 Cd as a good compromise, .5 was just the first that popped to mind. It should give teams a second more conservative datapoint to judge from.

Edit: Predictably, 12 m/s puts the Reynold's number right in the critical range for a rough sphere where Cd drops a ton depending on the roughness of the sphere. At 10 m/s the Cd is comfortably 0.5 for most roughnesses. So go figure. It's still an estimate, but it will err on the side of shorter than reality.

Yan Wang 09-01-2006 15:32

Re: Calculating Angle to fire at
 
1 Attachment(s)
So ignoring the fun stuff (air resistance, spin), suppose your ball's point of release is at the origin with velocity v0 and you want to hit the point (h,k) in the first quadrant. I quickly found a cubic equation which you can solve for theta. I'm sure you'll have fun learning how to solve cubics. Let me know if there's some algebra error. The general idea seems right.

Matt Adams 09-01-2006 15:39

Re: Calculating Angle to fire at
 
Ah, I love the lunch break. If this is correct, which I'm pretty sure it is, I'm proud to say I did it myself. if it's not, then you get what you paid for. :]


Given:
X (desired position in horizontal direction),
Y (desired position in vertical direction)
Vo (firing velocity)

Find: Launch Angle, A

Starting with your two basic projectile motion equations:

X = Vo * cos(A) * t
Y = Vo * sin(A) * t - 1/2 * g * t^2

First, solve for t to eliminate it from the equation.

t = x / (Vo * cos(A) )

Substituting:

y = (x * Vo * sin(A)) / (Vo * cos(A)) - (g * x^2)/(2 * Vo^2 * cos^2(A))


Trig Identity: tan(A) = sin(A) / cos(A)

y = (x * tan(A) ) - (g * x^2) / (2 * Vo^2 * cos^2(A))


(x * tan(A) - y ) * (2 * Vo^2 * cos^2(A)) = g * x^2

(2 * Vo^2 * x * sin(A) * cos(A)) - (2 * Vo^2 * cos^2(A) * y) = g * x^2


Simplify some more:
(2 * x * sin(A) * cos(A)) - (2 * cos^2(A) * y) = (g * x^2) / (Vo^2)

Fancy Trig:

(x * sin(2A)) - (2 * cos^2(A) * y) = (g * x^2) / (Vo^2)

Little More Fancy Trig:

(x * sin(2A)) + (-y)(1+cos(2A)) = (g * x^2) / (Vo^2)

Not So Fancy Math:

(x * sin(2A)) + (-y * cos(2A)) = (((g * x^2) / (Vo^2)) +y)


Pretty Fancy Trig Identity: (if there's a mistake, it's bad application here!)
a * sin(A) + b * cos (A) = sqrt(A^2 + B^2) * sin(A + T)

Where T:
arctan(b/a) if a>=0;
pi + arctan(b/a) if a<0

I simplified this with the common(?) matlab function atan2 which is a 'smart' arc tan function that takes the sign of the x and y components into account when returning an angle.

Note, however, that since A in our case is X, it should never be negative, assuming you're aiming in front of you...


Using Pretty Fancy Trig Identity Above:

sqrt(x^2 + y^2) * sin(2A + atan2(-y/x)) = (((g * x^2) / (Vo^2)) +y)


Finally, when you put this in terms of A:

A = 1/2 * (asin( (((g * x^2) / (Vo^2)) +y) / sqrt(x^2 + y^2) ) - atan2(-y/x))


The reason I feel pretty comfortable about this, because when you set Y=0, you get your basic range equation:

2A = asin(g * X / Vo^2))

That's that!

Sources:
http://en.wikipedia.org/wiki/Trigonometric_identity
http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html



Matt

Issues 09-01-2006 16:24

Re: Calculating Angle to fire at
 
That is precisely what I was looking for, if it is correct anyways. I knew it would require some mad trig. Thank you = ).


edit.

Now I am trying to add air resistance in the calculation. I think the easiest way to do it would be to determine the terminal velocity of the poof ball and use that with a known weight of a projectile to find the proportionality constant of a poof ball k such that F= k v(y) beacuse the force of air resistance is proportional to speed right? and this k would be the same one to use for the x direction because it is a sphere. Has anyone experimentally determined this value of k? I guess I could try something with my schools logger pro stuff =)

David Brinza 10-01-2006 12:51

Re: Calculating Angle to fire at
 
1 Attachment(s)
Here's a "quick and dirty" Excel spreadsheet that allows the user to vary speed, angle, height, drag coefficient, and for the Mars version of AimHigh (special feature for Dave Lavery ;) ): air density and gravity.

The algorithm is based on the white paper found here:

http://wps.aw.com/wps/media/objects/...cs/topic01.pdf

I made sure the integration gave accurate answers for some test cases (verify max height for vertical shot with zero drag coefficent, etc.).

The user should be able to perform some "sensitivity analyses" on parameters like speed, drag coefficient, etc. to get some idea of how the trajectory is affected by changes in the various parameters.

You can answer: How much further does a new (low drag) ball fly in Colorado than a beat-up (high drag) ball at the Florida Regional? :cool:

Alan Anderson 10-01-2006 13:21

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by David Brinza
You can answer: How much further does a new (low drag) ball fly in Colorado than a beat-up (high drag) ball at the Florida Regional? :cool:

The answer depends on whether you take spin into account. A rough ball gets better loft from backspin than a smooth one does (that's why golf balls are dimpled).


All times are GMT -5. The time now is 00:09.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi