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)

Issues 08-01-2006 18:57

Calculating Angle to fire at
 
Ok I don't know why but I am kind of stumped as how to calculate the angle needed to fire at a targed x meters away that is y meters above the launcher when your robot is capable of firing at v meters per second.
From the kinematic equations
y= -0.5*g*t^2+v*sin(theta)*t
x= v*cos(theta)*t

t=x/(v*cos(theta))

Now I plug that into the first equation which is dandy but then I cant isolate theta... It is rather easy to do when the beginning and ending heights are the same. Maybe I need to brush up on my trig but this is as far as I get
y= (-g*x^2*sec^2(theta))/(2*v^2) + x*tan(theta)

Help would be appreciated

mechanicalbrain 08-01-2006 19:02

Re: Calculating Angle to fire at
 
Here are some formulas. http://www.ngsir.netfirms.com/englishhtm/ThrowABall.htm goole "projectile motion" and remember to calculate air resistance in your equations! :)
Also good guides:
http://hyperphysics.phy-astr.gsu.edu/hbase/traj.html
http://www.ac.wwu.edu/~vawter/Physic...lesMotion.html

chris31 08-01-2006 19:07

Re: Calculating Angle to fire at
 
I havent got around to looking at formulas becuase i dont have the camera code finished becuase i dont have the camera with me. Once i do, ill post the formulas that i used.

Hutch 08-01-2006 19:07

Re: Calculating Angle to fire at
 
Well once you get air resistance (which is significant with these) along with any spin, those equations don't quite cut it; some sort of expirementation and creating just an n-th order polynomial approximation might be better (that maps some parameters [distance, angle of camera, power, whatevever] to angle).

Anyhow, my TI-89 doesn't give me anything for those equations so perhaps if I have time in a little bit, I'll solve it by hand.

Issues 08-01-2006 19:22

Re: Calculating Angle to fire at
 
I understand all of those things are important, but first I need to figure out how to calculate it simply right :) . Plus do you think experimenting and finding out the average spin of the projectile will help all that much? Won't it vary a lot from launch to launch?

Hutch 08-01-2006 19:28

Re: Calculating Angle to fire at
 
I meant experimenting to find the coeffecients... Anyhow, it depends on how you design your mechanism - I know we are trying to come up with something that will give predictable spin for example. Air resistance is probably more important than spin though and would be something to consider if you have anyone on your team who can run the numbers.

Btw, now that you have the links to the projectile motion equations, would you still like me to solve those equations or do you have what you need?

mechanicalbrain 08-01-2006 19:40

Re: Calculating Angle to fire at
 
Also something to keep in mind. Your velocity is not going to be constant (assuming you use a motor to propel the ball) Since your motors power will continue to decrease as the battery drains. As I recall every year their are teams that will drain the entire battery in a single match. I would highly recommend using a Hall effect sensor to monitor your levels and integrate the equations for you motors power into the equations. Also Spin has the potential to really change distance and should be a variable in your equation.

Alan Anderson 08-01-2006 21:56

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by mechanicalbrain
Your velocity is not going to be constant (assuming you use a motor to propel the ball) Since your motors power will continue to decrease as the battery drains.

If you measure the motor speed, you can make the velocity be constant. Battery voltage will only be relevant if you're trying to make the motor go faster than the available battery power will permit.

Donut 08-01-2006 22:07

Re: Calculating Angle to fire at
 
Something I just thought of about an hour ago that you might also want to consider. It still needs to be calculated, but rather than changing the angle (as most everyone on here has said they plan on doing) that the ball is released at, why not keep the angle constant and vary the speed at which it leaves the robot? It gives you the same desired effect, and saves you one motor or servo (and who knows how much weight).

This is going to take alot of testing to get right. Air resistance you could factor in, but spin will be hard to, especially if/once balls start getting deformed from extensive use (eventually this form is going to squish!). Deformations can also effect how much contact the ball will have with the launcher and change speed.

Elgin Clock 08-01-2006 22:08

Re: Calculating Angle to fire at
 
I found a nice tutorial for projectile motion here:

http://www.physicsclassroom.com/Clas...ors/U3L2f.html

Using the equation in the example involving this question, you can find some nice info:

Quote:

A football is kicked with an initial velocity of 25 m/s at an angle of 45-degrees with the horizontal. Determine the time of flight, the horizontal displacement, and the peak height of the football.
Horizontal displacement is the info which would be most valuable, along with max height. Time is nice to know, but unless you are calculating how many you can shoot in a match, then it's not really relative.


And if you want to cheat, and use the max allowed velocity here (12m/s), and know how much the mass of the balls are in KG's you can use this.

http://galileo.phys.virginia.edu/cla...jarapplet.html

DonRotolo 08-01-2006 22:13

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Issues
I understand all of those things are important, but first I need to figure out how to calculate it simply right :) . Plus do you think experimenting and finding out the average spin of the projectile will help all that much? Won't it vary a lot from launch to launch?

Come up with some basic aiming equations, and then refine them with experimentation. A look up table might be faster to do (and execute). All you need (for now) is the launch velocity, assume 12 m/s (the max allowed). Camera angle to the target gives distance.

Be sure to impress upon the mechanical design team that variability in the launch velocity is VERY bad, they need to consider that in their design. (I think you will find that the variability is really not much, assuming the system is designed to be stable.)

Now, also remember to consider the added velocity if the robot is moving!!!

Don

DonRotolo 08-01-2006 22:18

Re: Calculating Angle to fire at
 
Quote:

Originally Posted by Donut
This is going to take alot of testing to get right. Air resistance you could factor in, but spin will be hard to, especially if/once balls start getting deformed from extensive use (eventually this form is going to squish!). Deformations can also effect how much contact the ball will have with the launcher and change speed.

Easy: use the Allen-Bradley sensor to measure the velocity, keep track of it and use it to make corrections on your next shot.

But, IMHO, angle will be easier than variable velocity. Not a bad idea, tho.

Don

White_Orpheus 08-01-2006 22:30

Re: Calculating Angle to fire at
 
This equation doesn't incorporate air resistance or spin, but it'll work for approximating. I have a sinking feeling that there isn't a way to do it with all the variables without forcing the controller to do a numerical integration every time you want to shoot the ball

(theta1)= the angle to the goal from the same height as your cannon
(theta2)= the angle of your cannon
(h)= height from your cannon to the goal (constant)
(v)= velocity of your ball (constant)


1/(v^2) = (tan(theta2)cos^2(theta2)/4.9h(cot(theta1))) - (cos^2(theta2)/4.9h(cot^2(theta1)))

It could use some simplifying, and it looks really ugly typed like that, but it works. I like this equation better because rather than accounting for distance to the goal, you only need the angle. I have a feeling the CMU cameras will be more accurate at giving the angle they are pointing at rather than giving a distance to the target.

bombadier337 08-01-2006 22:43

Re: Calculating Angle to fire at
 
For simplicity's sake, we are most likely going to have a shooter with a fixed vertical angle. We may lose the ability to shoot from every point on the field, but if we no where our good positions are we can increase our accuracy. We are simply having an adjustable angle (like that on a LCD projector, though a little more substantial and stable), so we can tweak it before competitions to fine tune it. Just my $0.02

Also, using the y axis signal from a camera set to lock on to the green target could simplify that a lot. You'd just need a formula to convert it to something usable for a lifting mechanism and compensate for an arc.

varcsscotty 09-01-2006 01:14

Re: Calculating Angle to fire at
 
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


All times are GMT -5. The time now is 04:31.

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