mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
implement LOS guidance and Bang-Bang control
This commit is contained in:
parent
450d1a2a09
commit
224a243713
@ -93,9 +93,11 @@ class GVAR(SeekerTypes) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class GVAR(NavigationTypes) {
|
class GVAR(NavigationTypes) {
|
||||||
|
class LineOfSight {
|
||||||
|
functionName = QFUNC(navigationType_lineOfSight);
|
||||||
|
onFired = QFUNC(lineOfSight_onFired);
|
||||||
|
};
|
||||||
class ProportionalNavigation {
|
class ProportionalNavigation {
|
||||||
name = "Proportional Navigation";
|
|
||||||
|
|
||||||
functionName = QFUNC(navigationType_proNav);
|
functionName = QFUNC(navigationType_proNav);
|
||||||
onFired = QFUNC(proNav_onFired);
|
onFired = QFUNC(proNav_onFired);
|
||||||
};
|
};
|
||||||
|
@ -72,6 +72,8 @@ class CfgAmmo {
|
|||||||
pitchRate = 40; // degrees per second
|
pitchRate = 40; // degrees per second
|
||||||
yawRate = 40;
|
yawRate = 40;
|
||||||
|
|
||||||
|
bangBangGuidance = 0;
|
||||||
|
|
||||||
canVanillaLock = 0;
|
canVanillaLock = 0;
|
||||||
|
|
||||||
// Guidance type for munitions
|
// Guidance type for munitions
|
||||||
|
@ -31,6 +31,7 @@ PREP(attackProfile_JAV_TOP);
|
|||||||
|
|
||||||
// Navigation Profiles
|
// Navigation Profiles
|
||||||
PREP(navigationType_proNav);
|
PREP(navigationType_proNav);
|
||||||
|
PREP(navigationType_lineOfSight)
|
||||||
|
|
||||||
// Seeker search functions
|
// Seeker search functions
|
||||||
PREP(seekerType_SALH);
|
PREP(seekerType_SALH);
|
||||||
@ -47,3 +48,4 @@ PREP(ahr_onFired);
|
|||||||
|
|
||||||
// Navigation OnFired
|
// Navigation OnFired
|
||||||
PREP(proNav_onFired);
|
PREP(proNav_onFired);
|
||||||
|
PREP(lineOfSight_onFired);
|
||||||
|
@ -66,8 +66,16 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
|
|||||||
|
|
||||||
// controls are either on or off, no proportional
|
// controls are either on or off, no proportional
|
||||||
if (_isBangBangGuidance) then {
|
if (_isBangBangGuidance) then {
|
||||||
private _pitchSign = _clampedPitch / abs _clampedPitch;
|
private _pitchSign = if (_clampedPitch == 0) then {
|
||||||
private _yawSign = _clampedYaw / abs _clampedYaw;
|
0
|
||||||
|
} else {
|
||||||
|
_clampedPitch / abs _clampedPitch
|
||||||
|
};
|
||||||
|
private _yawSign = if (_clampedYaw == 0) then {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
_clampedYaw / abs _clampedYaw
|
||||||
|
};
|
||||||
_clampedPitch = _pitchSign * _pitchRate;
|
_clampedPitch = _pitchSign * _pitchRate;
|
||||||
_clampedYaw = _yawSign * _clampedYaw;
|
_clampedYaw = _yawSign * _clampedYaw;
|
||||||
};
|
};
|
||||||
|
24
addons/missileguidance/functions/fnc_lineOfSight_onFired.sqf
Normal file
24
addons/missileguidance/functions/fnc_lineOfSight_onFired.sqf
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Brandon (TCVM)
|
||||||
|
* Sets up LOS navigation state arrays (called from missileGuidance's onFired).
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* Guidance Arg Array <ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_missileguidance_fnc_proNav_onFired
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
params ["_firedEH", "", "", "", "_stateParams"];
|
||||||
|
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||||
|
_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
|
||||||
|
_targetLaunchParams params ["_target", "_targetPos", "_launchPos"];
|
||||||
|
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams"];
|
||||||
|
_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
|
||||||
|
|
||||||
|
_stateParams set [4, [[0, 0, 0]]];
|
@ -0,0 +1,43 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
/*
|
||||||
|
* Author: Brandon (TCVM)
|
||||||
|
* Projectile will take the direct LOS path to target
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* Guidance Arg Array <ARRAY>
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* Commanded acceleration normal to LOS in world space <ARRAY>
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* [] call ace_missileguidance_fnc_navigationType_lineOfSight
|
||||||
|
*
|
||||||
|
* Public: No
|
||||||
|
*/
|
||||||
|
params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"];
|
||||||
|
_args params ["_firedEH", "", "", "", "_stateParams"];
|
||||||
|
_firedEH params ["","","","","","","_projectile"];
|
||||||
|
_stateParams params ["", "", "", "","_navigationParams"];
|
||||||
|
_navigationParams params ["_lastLineOfSight"];
|
||||||
|
|
||||||
|
// LOS navigation implemented via https://apps.dtic.mil/sti/pdfs/ADA481330.pdf (called bang-bang)
|
||||||
|
|
||||||
|
private _closingVelocity = vectorMagnitude velocity _projectile;
|
||||||
|
private _lineOfSight = vectorNormalized (_profileAdjustedTargetPos vectorDiff getPosASLVisual _projectile);
|
||||||
|
|
||||||
|
// 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 = 1000 * (vectorMagnitude _losDelta) / _timestep;
|
||||||
|
|
||||||
|
private _commandedAcceleration = _closingVelocity vectorMultiply _losRate;
|
||||||
|
|
||||||
|
// 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, _lineOfSight];
|
||||||
|
};
|
||||||
|
|
||||||
|
_commandedAcceleration
|
29
addons/missileguidance/todo.txt
Normal file
29
addons/missileguidance/todo.txt
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
Weapon Configs:
|
||||||
|
Hellfire - Laser
|
||||||
|
AGM-65 - Laser
|
||||||
|
DAGR - Laser
|
||||||
|
GBU-12 - Laser
|
||||||
|
|
||||||
|
Dragon - SACLOS
|
||||||
|
Metis - SACLOS
|
||||||
|
HOT - SACLOS
|
||||||
|
|
||||||
|
Javelin - Optical
|
||||||
|
NLAW - PLOS
|
||||||
|
|
||||||
|
Seeker Types:
|
||||||
|
Laser - causes lots of weapon noise, causing bad guidance
|
||||||
|
|
||||||
|
Navigation Types:
|
||||||
|
GBU-12 - LOS Guidance
|
||||||
|
NLAW - LOS Guidance
|
||||||
|
Dragon - LOS Guidance
|
||||||
|
Metis - LOS Guidance
|
||||||
|
HOT - LOS Guidance
|
||||||
|
|
||||||
|
Javelin - Pro Nav
|
||||||
|
Hellfire - Pro Nav
|
||||||
|
AGM-65 - Pro Nav
|
||||||
|
DAGR - Pro Nav
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user