|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#46
|
||||
|
||||
|
Re: Calculating Angle to fire at
When seeking guidance, look up. There is a very good website with the basics, not only on ballistics, but also on other cool and significant topics. I am really very impressed by this website. I recommend starting with this index page:
http://exploration.grc.nasa.gov/educ...ket/short.html You will probably want to be sure to have a look at this particular page: http://exploration.grc.nasa.gov/educ...et/flteqs.html Our government has borrowed trillions of dollars to fund this website, so you should take advantage of it! The strictly ballistic part (without air resistance) you can do parametrically, using the Newtonian relation F=m*a, with first term physics/calculus, or algebraically by looking it up. That's a good first approximation and probably 80% right or so. The drag part is a much harder problem because the drag always shows up as a force vector whose vertical and horizontal components are changing as a function of the magnitude and direction of the overall velocity vector. Drag in the horizontal direction, for instance, will be largest at the top of the projectile's arc. For this reason you cannot treat the components as ordinary differential equations with separable variables as you can using the simple Newtonian equations of motion. If the projectile is dropping straight down there is no horizontal component, and if it is a car there is no vertical component, which is why you can solve for terminal velocity using simple calculus. You can make some simplifying assumptions about the average horizontal and vertical drag components, and that will get you closer if you pick the right assumptions. However, your best bet is to do prepare a numerical model using the state equations and some sort of calculation software--you can use Excel, or MATLAB, or Mathematica, or Mathcad, or program it in C. In other words, chop the problem up into N parts of the total flight time T (t0,t1,t2...tN), calculate an approximation at each interval, plug that value back in to calculate the conditions at t2, and so forth. The more the N, the more reality will be willing to cooperate with your answer...if the numbers you pick for the drag coefficient and for the area and so on are the right ones. Oh, I almost forgot. There is also the Magnus effect which adds another wrinkle yet. A symmetrical spinning or rotating projectile moving through a viscous fluid (for example, air) will experience forces due to pressure differences caused by the Bernoulli effect created by the rotation. This is the subject of curveballs and so on. And while we're on that subject, I should probably mention surface roughness, reynolds number, airstreams, laminar flow, turbulent flow, and chaos theory. Not to worry, though. If even the very smartest of us really understood this stuff (and I am not one of those guys), we wouldn't need to build wind tunnels. Your numerical simulation will get you in the ballpark. Once in, you need to build a pitching machine and do some testing. Good luck. |
|
#47
|
||||
|
||||
|
Re: Calculating Angle to fire at
Quote:
http://exploration.grc.nasa.gov/educ...et/shortr.html I'm taking serious offense to the statement above about our government borrowing trillions of dollars to fund this website. NASA's total budget this year is on the order of $17 billion dollars. Since NASA's inception (< 50 years ago), it hasn't spent $1 trillion dollars. The current NASA budget funds a huge list of activities: returning the Space Shuttle to flight, starting the development of the new human spaceflight vehicle, operating the ISS, supporting the Mars missions - operating (2 of Dave Lavery's "other cars" and 3 orbiters) and two in development (Mars Science Lab and Phoenix), operating Cassini at Saturn, launching New Horizons Pluto mission (later this month), operating Stardust (returning Jan. 15 with cometary and interplanetary dust particles), operating 2 Voyager spacecraft (at the real "edge" of our solar system), operating Hubble Space Telescope (including the final Hubble repair mission), operating Spitzer (a large infrared space telescope), developing the Space Interferometer Mission, supporting aeronautics research, operating and developing many, many Earth Science missions, plus many other missions and research activities that wouldn't begin to fit on a whole page of this thread. On top of all the research and mission support, the NASA budget is providing some support to educational activities (such as FIRST and the above referenced website). The NASA education budget is on the order of 1% of the total NASA budget (which in of itself is about 0.7% of the federal government's budget). The website above was probably developed by a small handful of dedicated people - true educators, with a tiny budget and, most unfortunately, not a totally secure job future. (NASA's budget is under tremendous pressure and scrutiny as the agency is in a period of transition - there have be many layoffs within the agency and with contractors that support NASA in the past year). Sorry for the rant, but I suspect there's a lot of people with the misconception that NASA's budget is large (it's less than 5% of the Department of Defense budget). I think the public gets a lot for what it invests (not borrows) in NASA. |
|
#48
|
|||
|
|||
|
Re: Calculating Angle to fire at
Quote:
|
|
#49
|
|||
|
|||
|
Re: Calculating Angle to fire at
I don't know whether the question was sufficiently answered as far as calculating the angle goes. I certainly agree that with the trig involved and the other factors like air resistance and spin it's probably not going to be the way to go, but there is a simpler way to get theta than "A = 1/2 * (asin( (((g * x^2) / (Vo^2)) +y) / sqrt(x^2 + y^2) ) - atan2(-y/x))" ~Matt Adams.
Asumming: Y = hieght to center of hoop V = constant velocity X = distance to goal from end of firing mechanism Yo = height at which projectile leaves the firing mechanism Vox = cos(A) * V Voy = sin(A) * V Y = Yo + Voy * t - 4.9 * t^2, T = x/Vox, Voy = Vox * tan(A); Y = Yo + (Vox * tan(A)) * (X / Vox) - 4.9 * X^2 / Vox^2 Y = Yo + X * tan(A) - 4.9 * X^2 * sec(A)^2 / V^2 0 = Yo * V^2 - Y * V^2 + X * V^2 * tan(A) - 4.9*X^2 * (1 + tan(A)^2) 0 = (-4.9*X^2*tan(A)^2) + (X * V^2 * tan(A)) + ( V^2 (Yo - Y - 4.9X^2)) so just plug that into the quadratic formula with: a = -4.9 * X * X b = X * V * V c = V * V * (Yo - Y - (4.9 * X * X) ) arctan( (-b + sqrt(b * b - 4 * a * c)) / (2 * a) ) Though it has been said that you will have to take into account the variables of air resistance and spin among others, this should give some people a good idea of where to start and fine tune from. Hope this was at least somewhat helpful. |
|
#50
|
|||||
|
|||||
|
Re: Calculating Angle to fire at
Quote:
|
|
#51
|
|||
|
|||
|
Re: Calculating Angle to fire at
Quote:
Last edited by seanwitte : 17-01-2006 at 10:54. |
|
#52
|
|||||
|
|||||
|
Re: Calculating Angle to fire at
Quote:
|
|
#53
|
|||||
|
|||||
|
Re: Calculating Angle to fire at
Quote:
-dave |
|
#54
|
|||
|
|||
|
Re: Calculating Angle to fire at
Quote:
![]() The equation is not that simple, though, when you want it the other way around, with launch angle in terms of range/target distance. I calculated it as: ![]() Unfortunately, as Hutch noted, spin and air resistance make it almost pointless to try to use a physics function, so you're probably better off with a best-fit polynomial anyway. |
|
#55
|
||||
|
||||
|
Re: Calculating Angle to fire at
If you ever end up with an equation like
f(x) = g(x) and you're unable to isolate x, there are many fast ways to get good approximations for x. Newton's Method Rearrange it so that you have f(x) - g(x) = 0 Now your problem is reduced to finding the zeroes of f(x)-g(x). This is still difficult, unless you're clever, like Newton was. If you take a tangent to this function at some point x1, then find the 0-intercept of that tangent, the x-position of that intercept is probably closer to the zero of (f[x] - g[x]) than your start point was. Call the tangent's intercept x2. Repeat this process from x2. Unless you picked your start position poorly, you should iteratively get closer. Code example: Code:
float fcn(float v,float d,float h,float t)
{ return 0.5*sin(2*t)*d - (G*d*d)/(2*v*v) - h*cos(t)*cos(t);
}
float der(float v,float d,float h,float t)
{ return cos(2*t)*d + 2*h*cos(t)*sin(t);
}
float getAngle(float v,float d,float h)
{
// function: f[t] = 0.5*sin(2t)*d - gdd/2vv - hcoscos
// derivative: f'[t] = cos(2t)*dist + 2h*cos*sin
float xn = PI/8; // I start at 22.5 degrees because I know the solution will be somewhere nearby
for(int x=0;x<5;x++)
{
xn = xn - fcn(v,d,h,xn)/der(v,d,h,xn);
}
return xn;
}
Also check out the wikipedia article on this: http://en.wikipedia.org/wiki/Newton's_method |
|
#56
|
||||
|
||||
|
Re: Calculating Angle to fire at
Here's a small application that demonstrates a calculation of firing angle.
The project zip file contains all the source code. It's meant for VC++ 6.0. If you want to use another IDE, you'll have to link comctl32.lib and figure out how to use the resource file. |
|
#57
|
|||
|
|||
|
Re: Calculating Angle to fire at
Quote:
Our only concern at this point is the light warm-up period. I'm sure hoping they have the lights on *BEFORE* autonomous begins. Our camera takes 17 seconds to "see the light" from a cold start. After warming up for a bunch of minutes, it will still recognize it nearly instantaneously after a 40 second off period. If the lights are not kept on most of the time, I suspect that the initial autonomous action will be entertaining for the audience and disappointing to the programmers! Lynn (D) - Team Voltage 386 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Viewing Angle of Camera | Joe Johnson | Technical Discussion | 10 | 14-01-2005 14:11 |
| Calc. Triangle Angle or Side Based on Ellipses? | indieFan | Math and Science | 1 | 07-06-2004 21:25 |
| Serious VCU Fire | Joe Matt | Chit-Chat | 3 | 26-03-2004 19:04 |
| PBASIC ARCTAN function | Greg Ross | Programming | 14 | 11-05-2003 12:28 |
| 45 degree PVC angle fittings: which? | archiver | 2001 | 2 | 23-06-2002 22:53 |