implement augmented proportional navigation

This commit is contained in:
Brandon Danyluk 2021-04-13 14:09:36 -06:00
parent 187c6d35c3
commit a93eb6433d
7 changed files with 93 additions and 16 deletions

View File

@ -22,8 +22,8 @@ class CfgAmmo {
defaultSeekerLockMode = "LOAL";
seekerLockModes[] = { "LOAL", "LOBL" };
defaultNavigationType = "ProportionalNavigation";
navigationTypes[] = { "ProportionalNavigation" };
defaultNavigationType = "AugmentedProportionalNavigation";
navigationTypes[] = { "AugmentedProportionalNavigation" };
seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos]
seekerAngle = 50; // Angle from the shooter's view that can track the missile
@ -62,8 +62,8 @@ class CfgAmmo {
defaultSeekerLockMode = "LOAL";
seekerLockModes[] = { "LOAL", "LOBL" };
defaultNavigationType = "ProportionalNavigation";
navigationTypes[] = { "ProportionalNavigation" };
defaultNavigationType = "AugmentedProportionalNavigation";
navigationTypes[] = { "AugmentedProportionalNavigation" };
seekLastTargetPos = 0; // seek last target position [if seeker loses LOS of target, continue to last known pos]
seekerAngle = 50; // Angle from the shooter's view that can track the missile

View File

@ -83,6 +83,10 @@ class CfgAmmo {
activeRadarEngageDistance = 1000;
seekerMaxRange = 2000; // distance that the hellfire internal radar can scan
// we can get target acceleration data from radar
defaultNavigationType = "AugmentedProportionalNavigation";
navigationTypes[] = { "AugmentedProportionalNavigation" };
};
// Vanilla lock system vars

View File

@ -98,4 +98,8 @@ class GVAR(NavigationTypes) {
functionName = QFUNC(navigationType_proNav);
onFired = QFUNC(proNav_onFired);
};
class AugmentedProportionalNavigation {
functionName = QFUNC(navigationType_augmentedProNav);
onFired = QFUNC(proNav_onFired);
};
};

View File

@ -29,6 +29,7 @@ PREP(attackProfile_JAV_DIR);
PREP(attackProfile_JAV_TOP);
// Navigation Profiles
PREP(navigationType_augmentedProNav);
PREP(navigationType_proNav);
PREP(navigationType_lineOfSight);

View File

@ -32,6 +32,7 @@ if (_seekerTargetPos isEqualTo [0, 0, 0]) exitWith {
};
private _projectilePos = getPosASLVisual _projectile;
private _distanceToTarget2d = _projectilePos distance2d _seekerTargetPos;
private _closingRate = vectorMagnitude velocity _projectile;
private _timeToGo = (_projectilePos distance _seekerTargetPos) / _closingRate;
@ -44,7 +45,7 @@ private _atMinRotationAngle = _angleToTarget >= (0.5 * _pitchRate * _timeToGo);
private _returnTargetPos = _seekerTargetPos;
if !(_atMinRotationAngle) then {
if (!_atMinRotationAngle && _distanceToTarget2d >= 500 && _timeToGo >= 10) then {
// 10 degree pitch up
_returnTargetPos = _seekerTargetPos vectorAdd [0, 0, (_projectilePos distance _seekerTargetPos) * sin 10];
};

View File

@ -0,0 +1,63 @@
#include "script_component.hpp"
/*
* Author: Brandon (TCVM)
* Determine path for projectile to take in accordance to proportional navigation, takes target acceleration into account
*
* Arguments:
* Guidance Arg Array <ARRAY>
*
* Return Value:
* Commanded acceleration normal to LOS in world space <ARRAY>
*
* Example:
* [] call ace_missileguidance_fnc_navigationType_augmentedProNav
*
* Public: No
*/
params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"];
_args params ["_firedEH", "", "", "", "_stateParams"];
_firedEH params ["","","","","","","_projectile"];
_stateParams params ["", "", "", "","_navigationParams"];
_navigationParams params ["_lastMissileFrame", "_navigationGain"];
_lastMissileFrame params ["_lastTargetPosition", "_lastTargetVelocity", "_lastLineOfSight"];
// Proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel
private _projectileVelocity = velocity _projectile;
// integrate target velocity for realistic inference of velocity
private _targetVelocity = _lastTargetVelocity;
private _targetAcceleration = [0, 0, 0];
if (_timestep != 0) then {
_targetVelocity = (_seekerTargetPos vectorDiff _lastTargetPosition) vectorMultiply (1 / _timestep);
_targetAcceleration = (_targetVelocity vectorDiff _lastTargetVelocity) vectorMultiply (1 / _timestep);
};
private _closingVelocity = _targetVelocity vectorDiff _projectileVelocity;
private _lineOfSight = vectorNormalized (_profileAdjustedTargetPos vectorDiff getPosASLVisual _projectile);
private _targetAccelerationProjected = _lineOfSight vectorMultiply (_targetAcceleration vectorDotProduct _lineOfSight);
_targetAcceleration = _targetAcceleration vectorDiff _targetAccelerationProjected;
systemChat str vectorMagnitude _targetAcceleration;
// the los rate is tiny, so we multiply by a constant of a power of ten to get more aggressive acceleration
// this is just due to how we measure our LOS delta, the vectors involved are _tiny_
private _losDelta = _lineOfSight vectorDiff _lastLineOfSight;
private _losRate = if (_timestep == 0) then {
0
} else {
10 * (vectorMagnitude _losDelta) / _timestep;
};
private _lateralAcceleration = (_navigationGain * _losRate);
private _commandedAcceleration = _closingVelocity vectorMultiply _lateralAcceleration;
_commandedAcceleration = _commandedAcceleration vectorAdd (_losDelta vectorMultiply (0.5 * _navigationGain * vectorMagnitude _targetAcceleration));
// we need acceleration normal to our LOS
private _commandedAccelerationProjected = _lineOfSight vectorMultiply (_commandedAcceleration vectorDotProduct _lineOfSight);
_commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected;
if (accTime > 0) then {
_navigationParams set [0, [_seekerTargetPos, _targetVelocity, _lineOfSight]];
};
_commandedAcceleration

View File

@ -1,24 +1,24 @@
Weapon Configs:
Hellfire - Laser
AGM-65 - Laser
DAGR - Laser
GBU-12 - Laser
X Hellfire - Laser
X AGM-65 - Laser
X DAGR - Laser
X GBU-12 - Laser
Dragon - SACLOS
Metis - SACLOS
HOT - SACLOS
X Dragon - SACLOS
X Metis - SACLOS
X HOT - SACLOS
Javelin - Optical
NLAW - PLOS
X Javelin - Optical
X NLAW - PLOS
Vikhr - Beam Rider SACLOS
R-73 - Infrared
AIM-9 - Infrared
AIM-132 - Infrared
R-77 - AHR
AIM-120 - AHR
AIM-132 - AHR
X AIM-120 - AHR
KH-25 - Optical
AGM-65 - Optical
@ -58,6 +58,10 @@ Navigation Types:
Navigation States:
Todo
Navigation Types:
X Augmented Pro-Nav
Zero Effort Miss
General To-Do:
Add more weapons
X Fix GBU drag