So, I've been scouring this, the Physics Exchange, Wikipedia, and the general web for information about Proportional Navigation, and I can't seem to wrap my head around how to find the individual terms that make up a PN equation, especially in a 2D environment.
Per Wikipedia:
a = N * lambda * V
Where:
a is the normal acceleration, that's fine. It's how much I should accelerate left or right from the missile's current heading.
N is a scaling factor. Sure. No problem there. Just fiddle with it.
lambda is the line of sight rate... What? It's how much the angle between the missile's heading and the position of the target change in an instant? Or something? Given the position and velocity of the target, and the position and velocity of the missile, I feel like this should be easy to figure out instantaneously, without having to 'save' the previous position of the target, but for the life of me I can't wrap my head around it.
V is the closing velocity. That's how fast I want to be going when I reach the target? Yes? Or is it the component of my velocity in the direction of the target? There's not much explaining this term that I can see.
Wikipedia offers another variation of the equation that involves the cross product, which I don't think works in this situation, since the cross product is explicitly 3D.
Related Questions:
Implementing simple proportional navigation for a homing missile
How to Create an Intercept Missile for a Game
Calculating vector to aim for moving asteroid (3D asteroid game)
Answer
Few things, according to your wikipedia question, a is actually the perpendicular force, presumably the orthogonal force in N dimensional space. N is a constant, sure, but lambda must be calculated via previous frame versus current frame, or the predicted next position of the target. You don't need to keep the previous value if you predict where the target will go. You need the targets velocity any way, so you'll have this information any how.
V, closing velocity is not "how fast I want to be going when I reach the target" though I admit, its not exactly easy to find these terms defined, they are constantly overloaded. I believe closing velocity here is describing the velocity formed by the frame of reference caused by both the moving target and the missile. In the case of the static target, the closing velocity will simply be the velocity (or negated depending on order of missile or target in calculations) of the missile if the missile is moving directly towards the target.
Based upon this forum post http://mathhelpboards.com/calculus-10/calculate-closing-velocities-19402.html closing velocity can be computed in the following way:
Given V1
= velocity of the missile, V2
= velocity of the target, P1
= position of missile, P2
= position of the target.
Vclosing = dot((V2 - V1),(P2 - P1)) * (( P2 - P1) / Magnitude(P2 - P1)^2)
SpeedClosing = dot((V2 - V1),(P2 - P1))/ Magnitude(P2 - P1)
Wikipedia offers another variation of the equation that involves the cross product, which I don't think works in this situation, since the cross product is explicitly 3D.
This is a fundamental misunderstanding of the cross product. The cross product measures the difference between vectors, much like the dot product measures the similarity between vectors. This difference is represented by a magnitude and a vector orthogonal to the plane represented by the two vectors, which is not restricted to any specific N dimensional space. If the cross product produced a N+1 vector as our output, and that turned out to be impossible to use for our equations, the formula itself would be wrong.
To compute the cross product version, we have new terms, Vr, which is actually the difference between the target velocity and the missile velocity, R, which is the Range vector from missile to target, Omega, the "rotation vector of line of site" which is cross(R, Vr)/dot(R,R)
. The final formula expanded would be:
// target velocity relative to missile
vec2 Vr = Vt - Vm;
// range from missile to target
vec2 R = Rt - Rm;
//some constant
float N = ...;
//rotation vector of line of sight
vec3 Omega = cross(R, Vr)/dot(R,R);
// the cross product of orthogonal vector to R and Vr from previous cross
// product, and Vr again, will produce vector which lies on the plane of R
// and Vr again, hence we can ignore the last dimension of the cross product
// it will be zero anyway for 2d.
vec2 a = N*cross(Vr, Omega);
You'll see that because we perform two cross products that both involve a vector that lies on the plane Vr, R, we will end up with a vector in the appropriate dimension for a, even in 2D.
No comments:
Post a Comment