Go to Post This thread is so done I can almost smell the burnt. - Chris Fultz [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 15-02-2012, 12:53
gnunes gnunes is offline
Registered User
FRC #1391 (Metal Moose)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Westtown School
Posts: 57
gnunes has a spectacular aura aboutgnunes has a spectacular aura aboutgnunes has a spectacular aura about
Re: Trajectory Calculator (W/ Drag)

Yes, drag is complicated, but also important. If your launcher spins the ball, then lift is important too.

If you don't want this complication, then your best approach is empirical. Get a lot of data on distance vs. your launch parameters and make a table. Then, the robot can use interpolation to work the other way: given a distance, it can get values for the launch parameters. If you are varying two things (launch angle and ball velocity), then this could get complicated. You will have several tables, and will need an algorithm to determine which one to use.

Even though I wrote the trajectory calculator, our team is going to use the interpolation approach!
  #17   Spotlight this post!  
Unread 15-02-2012, 13:06
engunneer's Avatar
engunneer engunneer is offline
Alumni turned Mentor
AKA: Branden Gunn
FRC #4761
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1996
Location: Reading, MA
Posts: 868
engunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by gnunes View Post
Get a lot of data on distance vs. your launch parameters and make a table. Then, the robot can use interpolation to work the other way: given a distance, it can get values for the launch parameters.
This is pretty much our plan.
__________________
Student FRC23 (1996-1999), Mentor FRC246 (2000), Mentor FRC1318 (2007-2009), Mentor FRC93 (2011), Mentor FRC2151 (2012), Mentor FRC23 (2013), Mentor FRC4761 (2014-2017)
1998 - National Chairman's Award and Woodie Flowers Award (FRC23, Mike Bastoni ) | 2007 - PNW SF (488, 1595) | 2008 - Oregon RCA - Seattle #2 Seed, SF (488, 1696) | 2009 - Oregon #1 Seed, Winners (1983, 2635) - Seattle SF (945, 2865) - Galileo #2 Seed, SF (973, 25) | 2012 Midwest F (111, 71) | 2014 RIDE Winners (78, 125), Inspector - NEU #24, QF (3479, 3958) - NECMP #35 | 2015 Reading #11, SF (1058, 190), Inspector - RIDE #17, QF(4055, 5494), Inspector - NECMP #57 | 2016 Reading #4, SF (133, 4474), DCA, Inspector - Ride #22, SF (1735, 2067), Creativity, Inspector - NECMP #48, RCA - Archimedes
  #18   Spotlight this post!  
Unread 15-02-2012, 19:29
Hinfoiltat Hinfoiltat is offline
Registered User
FRC #0375
 
Join Date: Feb 2012
Location: Staten Island, NY
Posts: 7
Hinfoiltat is an unknown quantity at this point
Re: Trajectory Calculator (W/ Drag)

I would appreciate a video of this in action.
  #19   Spotlight this post!  
Unread 22-02-2012, 02:40
Brandon_L Brandon_L is offline
Back @ it again with the white vans
AKA: Brandon Liatys
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Newark, NJ
Posts: 1,207
Brandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond reputeBrandon_L has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

I see a formula for finding the angle to launch at with a constant velocity, but I can't find the opposite (Velocity to launch at with a constant angle) anywhere for the life of me. Does anyone know/have it? I've been going through my kinematic equations for the past 6 hours (I kid you not) and have nothing
__________________
FRC 2495 - Hamilton West Robotics [2007-2014] - whats a..."hive mind"?
FRC 3929 - Atomic Dragons [2012-2013]
FRC 2180 - Zero Gravity [2017-]

Just trying to collect all the possible team colors
  #20   Spotlight this post!  
Unread 22-02-2012, 09:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Brandon_L View Post
I see a formula for finding the angle to launch at with a constant velocity, but I can't find the opposite (Velocity to launch at with a constant angle) anywhere for the life of me. Does anyone know/have it? I've been going through my kinematic equations for the past 6 hours (I kid you not) and have nothing
Let
Code:
d = horizontal distance (in feet) from launch point to hoop

h = vertical height (in feet) of hoop above the launch point

a = angle of launch (radians) above the horizontal

v = initial speed of ball (in ft/sec) as it leaves the launcher
Then the no-drag, no magnus formula for speed is:
Code:
v = 4*d/(cos(a)*sqrt(d*tan(a)-h))

  #21   Spotlight this post!  
Unread 22-02-2012, 10:02
Lalaland1125 Lalaland1125 is offline
Registered User
AKA: Ethan Steinberg
FRC #2429
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: La Canada
Posts: 29
Lalaland1125 is an unknown quantity at this point
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Brandon_L View Post
I see a formula for finding the angle to launch at with a constant velocity, but I can't find the opposite (Velocity to launch at with a constant angle) anywhere for the life of me. Does anyone know/have it? I've been going through my kinematic equations for the past 6 hours (I kid you not) and have nothing
Our plan is to simply do the simple drag-free formula for an initial guess, and then slowly increase the velocity till the non-reversible drag including formula "hits" the target.

The computers are definitely fast enough for this, but who knows if the ball actually acts like its supposed to.
  #22   Spotlight this post!  
Unread 22-02-2012, 14:03
gnunes gnunes is offline
Registered User
FRC #1391 (Metal Moose)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Westtown School
Posts: 57
gnunes has a spectacular aura aboutgnunes has a spectacular aura aboutgnunes has a spectacular aura about
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Lalaland1125 View Post
Our plan is to...slowly increase the velocity till the non-reversible drag including formula "hits" the target.
The problem is that there is no "formula" for the case where drag is included. If you are using LabView, then you could take my trajectory calculator (see post #11) and turn it into a sub-VI that would find the distance for you (just cut out all the graphing stuff which you won't need).

I would recommend using the trajectory calculator "off-line" to calculate the distance for, say 100 or 200 launch velocities between your fastest and slowest launch speeds. Then store that table of distance vs launch speed in your competition code, and use interpolation to find the velocity you want in a single pass. Much, much faster.
  #23   Spotlight this post!  
Unread 22-02-2012, 16:58
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Lalaland1125 View Post
Our plan is to simply do the simple drag-free formula for an initial guess, and then slowly increase the velocity till the non-reversible drag including formula "hits" the target.
Quote:
Originally Posted by gnunes View Post
The problem is that there is no "formula" for the case where drag is included.
For a drag model where drag is either linear or quadratic in velocity, I believe there is a closed form solution* for height, given distance, launch angle, drag coefficient, and launch velocity. So you could vary the launch velocity and calculate the height until the height is the desired value.

I'm not saying that's the best way to do it, but it could be done.


* I haven't checked it. It's rather ugly.

  #24   Spotlight this post!  
Unread 22-02-2012, 19:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Ether View Post
* I haven't checked it. It's rather ugly.
Here it is, if anyone wants to try it or check my math. I'm sure this could be simplified with a bit of work. Maybe even solved explicitly for Vo?

Code:
h=log(1-Vo^2*K/g)/(2*K)-log(sec(sqrt(-g)*sqrt(K)*((%e^(d*K)-1)/(cos(theta)*Vo*K)-atan((Vo*sqrt(K))/sqrt(-g))/(sqrt(-g)*sqrt(K)))))/K;
See attached PDF for derivation.



Last edited by Ether : 23-02-2012 at 20:50.
  #25   Spotlight this post!  
Unread 22-02-2012, 22:58
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)



@gnunes: can you run your trajectory program with the following parameters, and post height vs distance data (say, every foot) and a PNG of a plot of height (above the launch point, in feet) vs distance (horizontal distance from the launch point) with the following parameters: Vo=23 feet/sec, theta=45 degrees, g=-32 ft/sec2, drag = -0.03*V2 ft/sec2, and no spin?



Last edited by Ether : 23-02-2012 at 20:49. Reason: error in derivation
  #26   Spotlight this post!  
Unread 23-02-2012, 19:56
Lalaland1125 Lalaland1125 is offline
Registered User
AKA: Ethan Steinberg
FRC #2429
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2011
Location: La Canada
Posts: 29
Lalaland1125 is an unknown quantity at this point
Re: Trajectory Calculator (W/ Drag)

I ran your numbers through my dead simple approximator(code at bottom) and got a different result(image + source code is attached)

I am fairly sure that your result cannot be correct due to running it through the standard projectile motion equations.

Assuming no loss of energy, the ball will follow the equation: .5*Vy^2 = g * h.
(mgh = 1/2 * m * v^2)

Plugging this into wolfram alpha(http://www.wolframalpha.com/input/?i=%28%2823+feet+per+second+in+meters+*+sin%2845+d egrees%29%29+**+2++*+.5+%29%2F9.8+meters+per+secon d+squared) ( using meters because I am more used to them) gets me 4.113 ft as the max possible height. Your graph shows the ball approaching 7 m.

(When I set the drag to 0 on my code the height reaches a max of about 4ft and change)

Oh, and the code attachment shows what I mean by trial and error. Look at findBestCurveWithin.

Code:
void calcY(double& x,double& y, double &xVel, double& yVel)
{
   double oldxVel = xVel;
   double oldyVel = yVel;


   xVel += drag * xVel * xVel * timeIncrement;
   yVel += (g + drag * yVel * yVel) * timeIncrement;

   x += oldxVel * timeIncrement + .5 * timeIncrement * (xVel - oldxVel);
   y += oldyVel * timeIncrement + .5 * timeIncrement * (yVel - oldyVel);
}

QVector<QPointF> findCurve(double velocity, double angle, double targetX)
{
   QVector<QPointF> result;

   double rads = angle * M_PI/180;
   double xVel = velocity * cos(rads);
   double yVel = velocity * sin(rads);
   double x = 0;
   double y = 0;

   do
   {
      calcY(x,y,xVel,yVel);
      result.push_back(QPointF(x,y));
   }
   while (fabs(x - targetX) > .01);


   return result;
}
Attached Thumbnails
Click image for larger version

Name:	blah.png
Views:	17
Size:	10.7 KB
ID:	12082  
Attached Files
File Type: cpp mainwindow.cpp (3.4 KB, 4 views)

Last edited by Lalaland1125 : 23-02-2012 at 20:08.
  #27   Spotlight this post!  
Unread 23-02-2012, 20:46
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trajectory Calculator (W/ Drag)

Quote:
Originally Posted by Lalaland1125 View Post
I ran your numbers through my dead simple approximator(code at bottom) and got a different result(image + source code is attached)
Thank you. I have should have caught that.

Code:
x3: Vo =subst(0,t,rhs(x2));  <= a small typo on Page 2
x3: Vyo=subst(0,t,rhs(x2));  <= should have been
I'll see if a closed-form solution is still possible with this correction.


Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 18:46.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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