1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I Projectile Prediction with Acceleration & Delay

  1. Aug 12, 2017 #1
    Hello,

    I'm working on a (private) Software Project and Part of that is finding a Way to Predict Projectile Positions. My thought's are explained from a Code View a little bit, but I tried to clarify everything so everyone could understand what's going on.

    (It's my first time in this Forum, I hope i posted in the right Section)

    Data Available

    Target.Position (Vec3 x, y, z)
    Target.minVelocity (float)
    Target.maxVelocity (float)
    Target.Accel (float)
    Target.Width (integer/float)

    Projectile.Position (Vec3 x, y, z)
    Projectile.minVelocity (float)
    Projectile.maxVelocity (float)
    Projectile.Accel (float)
    Projectile.Delay (integer)
    Projectile.Range (integer; Only Relevant if Target Outruns Projectile)
    Projectile.Width (integer/float)

    Extra.Delay (integer, usually 1ms to 80ms)

    Process
    ^This is what i've got so far.

    targetDirection = Vector.Normalize(Target.Position - Projectile.Position)
    targetVelocityOrth = Vector.Dot(Target.minVelocity, targetDirection) * targetDirection
    targetVelocityTang = Target.minVelocity - targetVelocityOrth

    float velSpeed = targetVelocityTang.Magnitude;

    if (velSpeed > Projectile.minVelocity)
    exit
    else
    float OrthSpeed = Sqrt(Projectile.Speed * Projectile.Speed - velSpeed * velSpeed)
    Vec3 velOrth = targetDirection * OrthSpeed

    Vec3 Result = targetVelocityTang + velOrth

    float tCollision = ((Projectile.Position - Target.Position).Magnitude - Projectile.Width - Target.Width) / (velOrth.Magnitude-targetVelocityOrth.Magnitude)

    Vec3 ProjectileVel = velOrth + targetVelocityTang
    Vec3 PredictedPos = Projectile.Position + ProjectileVel * tCollision

    "Problem"

    Took me quite a while to figure out all of this (and a lot of Internet Searches) but now I'm stuck with a Solution that doesn't use Delay or Acceleration. How would one go further down the Road? I've read that Kinematic Equations are used for Acceleration, but which one exactly?

    Basicly i'm just looking how to further progess with this algorithm/equation.
     
  2. jcsd
  3. Aug 13, 2017 #2

    jbriggs444

    User Avatar
    Science Advisor

    A bit more background on the problem would have been helpful. I had to read the code to even start to understand what you are talking about.

    As written, the code assumes a target moving at its given initial ("minimum") velocity starting from its given initial position. The projectile is launched on an intercept course moving at its given initial ("minimum") speed starting from its given initial position. If an intercept is impossible, the code simply exits without making a prediction.

    The algorithm you have chosen works by (implicitly) setting up a coordinate system with the projectile at the origin and the target positioned on the X axis. An inertial intercept requires that the projectile and target share the same y coordinate at all times. Thus, the target's y velocity (targetVelocityTang) immediately gives the projectile's y velocity. The Pythagorean theorem yields the projectile's x velocity. The closing rate between projectile and target is then given by the difference in x velocities (velOrth) and the time of impact is given by initial separation divided by closing velocity.

    The collision position is then simply projectile position at the time of impact. Equivalently, it would be the target position at the time of impact.

    There are some errors in the problem description and undefined variables in the code. In particular, the givens of the problem specify target.minVelocity as a float. but the program code uses target.minVelocity as a vector ( "Vector.Dot(Target.minVelocity, targetDirection)" ). Projectile.Speed is never defined.


    The full version of the problem about which you ask appears to assume a target that accelerates (according to a fixed evasion plan or according to a plan that must be actively countered?) We are left to guess at the constraints on these accelerations.

    Target.delay = Delay in seconds after start of scenario before a period of acceleration can begin?
    Target.maxVelocity = Maximum speed that can be attained, but thrusters can stay on forever? -- or --
    Target.maxVelocity = Thrusters burn out after delta-V equal to Target.maxVelocity - Target.minVelocity

    Presumably the projectile operates under similar constraints.

    It is difficult to offer advice on a problem without a good problem statement. Offhand, this sounds like a challenging optimization problem.
     
  4. Aug 13, 2017 #3
    @jbrigs444

    First of all thanks for your reply.

    This is wanted Behavior. If an Intercept is Impossible the Projectile shouldn't be fired. (Prediction could also simply be Vec3(0,0,0))

    Since the Prediction happen's in 2D Space, I don't see why a Vector would be necessary here? The Projectile Moves Forward at a Fixed Speed (Unless Acceleration is in Place)

    The Projectile Speed will be available at "Runtime" (so to speak (usually 800-2000 "Unit's" (meter per second, if that's easier))) a made up number in this Example could be 1400.

    The Evasion of the Target must be "actively countered", the Acceleration is usually pretty small (Ranging from 5-40% for about 1-6 Seconds, In one Special Case it's 200%)

    Delay = After Prediction has been made there's a (Example) 0.25 Second Delay before the Projectile is actually fired
    Target.maxVelocity = Max. Velocity Possible, "Thrusters" Stay On Until Maximum Range is reached.

    Hope that helps with clarification. Thank's again!
     
  5. Aug 13, 2017 #4

    jbriggs444

    User Avatar
    Science Advisor

    You used a dot product on it. So it must be a vector. There is no other choice.

    As for countering the evasion, you have not given us the rules by which the evasion operates or is allowed to operate. Nor the rules by which our compensation is allowed to operate.
     
  6. Aug 13, 2017 #5
    Getting the Projectile Speed as a Vector would be possible too in this Case (Just re-checked), So this shouldn't be a Problem.

    Which Type of Ruleset exactly?
    The Target Can Evade On The X/Y Axis with his Speed for X Units (525 Speed = Can Move 525 Unit's Up, Down, Left, Right And Diagonal)
    Compensation is not possible. Once the Projectile is Fired, It can't change any Variables expect Speed (with Acceleration, otherwhise not even that)
     
    Last edited: Aug 13, 2017
  7. Aug 13, 2017 #6

    jbriggs444

    User Avatar
    Science Advisor

    I did not say that it was a problem. It was, however, a bug in your code.

    The rules governing the target's evasion. If we do not know what he can do, and what we can do, how can we make an informed decision?
    Yes, I understand that it is a two dimensional intercept problem. That's a start.

    He can evade for "X units". But that contradicts the problem statement. We are given an acceleration delay, an acceleration and a maximum speed. We are not given a variable named X. Nor had we been told anything that implies that his evasion capability depends on his Speed.

    Can you please define the problem properly?
    But previously you had stated:
    Let me see if I can put this into my own words.

    The target launches. We wish to intercept. We have the option to launch immediately or to delay our launch. We can choose launch angle. We are locked into a launch speed of Projectile.minVelocity. After launch, our projectile will continue on a straight line course. However, we can optionally choose to accelerate up to Projectile.maxVelocity while in flight, provided we wait at least Projectile.delay before initiating an in-flight burn. It is not clear whether the Projectile is allowed to slow down in flight. It is not clear whether we can throttle back. It is not clear whether Projectile.delay is a delay imposed on all in-flight acceleration changes.

    The target has the ability to accelerate (in which directions?) within the bounds imposed by Target.maxVelocity.

    We already have an algorithm that can determine launch angle, time in flight and intercept position. You want to improve the algorithm to make use of in-flight acceleration. That means that we need an interception strategy. What do you have in mind for an interception strategy?
     
  8. Aug 13, 2017 #7
    The projectile can't slow down only accelerate until it reaches maximum speed.

    To elaborate a little bit more let me give an Example:
    We have a Railgun. The Railgun needs 0.25 Seconds (<- Delay) to load a Shot (<- Projectile) but our Aiming Algorithm already Aim's before the Shot is loaded (Yes, bad product design, doesn't matter). The Projectile now fires at a fixed Speed (Let's say 500 Unit's per Second). Projectile can't accelerate.

    Some of these's Projectile's are Special. We can overload our Railgun every 120 Seconds (Irrelevant, this is just to clarify that only a small amount of projectiles are accelerated during flight) to fire a Projectile which has a 200% Speed Increase Actually Irrelevant this is an Edge Case I will handle in Code.

    Delay only happens when charging the Gun everything else is unaffected. Flight Path of the Projectile can't be changed in any way now.

    Continuing the Analogy above:
    During the Flight time of our now fired Projectile the Target has the Ability to Move. (It could try to "outrun" the Projectile, or trick the Prediction by starting to move backwards instead of forwards during the Flighttime of Projectile)

    A simple example would be:

    Projectile is fired with a speed of 1400 units per second after a delay of 0.25 seconds (in these 0.25 seconds the target can move already). The target can move 300 units per second in any direction and is 2100 units away from the projectile initial start point so during these 1.75 seconds of impact it can try to evade the projectile. The target can use this Exosuit (Imagination...) to accelerate for 10-50% for these 1.75 Seconds.

    Achieved Result would be: Make the most accurate possible prediction where the target will be in the next 1.75 seconds and fire the projectile at this location

    If the target can simply outrun the projectile (e.g. if the target could move out of the max range of the projectile in the next 1.75 seconds) no prediction will be made (this will be done code wise and isn't really important here).

    See Analogy Above. (X = 300 Unit's in this Case)
     
    Last edited: Aug 13, 2017
  9. Aug 14, 2017 #8

    jbriggs444

    User Avatar
    Science Advisor

    In the absence of a clear problem description including projectile capabilities, target capabilities and the quantity that you want to calculate, I cannot offer any assistance.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Projectile Prediction with Acceleration & Delay
Loading...