mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
implement LOS guidance, rename previous LOS guidance
This commit is contained in:
parent
224a243713
commit
bac6a0b6dd
@ -95,7 +95,10 @@ class GVAR(SeekerTypes) {
|
||||
class GVAR(NavigationTypes) {
|
||||
class LineOfSight {
|
||||
functionName = QFUNC(navigationType_lineOfSight);
|
||||
onFired = QFUNC(lineOfSight_onFired);
|
||||
};
|
||||
class SimpleProportionalNavigation {
|
||||
functionName = QFUNC(navigationType_simpleProNav);
|
||||
onFired = QFUNC(simpleProNav_onFired);
|
||||
};
|
||||
class ProportionalNavigation {
|
||||
functionName = QFUNC(navigationType_proNav);
|
||||
|
@ -31,7 +31,8 @@ PREP(attackProfile_JAV_TOP);
|
||||
|
||||
// Navigation Profiles
|
||||
PREP(navigationType_proNav);
|
||||
PREP(navigationType_lineOfSight)
|
||||
PREP(navigationType_simpleProNav);
|
||||
PREP(navigationType_lineOfSight);
|
||||
|
||||
// Seeker search functions
|
||||
PREP(seekerType_SALH);
|
||||
@ -48,4 +49,5 @@ PREP(ahr_onFired);
|
||||
|
||||
// Navigation OnFired
|
||||
PREP(proNav_onFired);
|
||||
PREP(lineOfSight_onFired);
|
||||
PREP(simpleProNav_onFired);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brandon (TCVM)
|
||||
* Projectile will take the direct LOS path to target
|
||||
* Accelerates toward LOS
|
||||
*
|
||||
* Arguments:
|
||||
* Guidance Arg Array <ARRAY>
|
||||
@ -14,30 +14,9 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"];
|
||||
_args params ["_firedEH", "", "", "", "_stateParams"];
|
||||
params ["_args", "", "", "_profileAdjustedTargetPos"];
|
||||
_args params ["_firedEH"];
|
||||
_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
|
||||
_lineOfSight
|
||||
|
@ -0,0 +1,43 @@
|
||||
#include "script_component.hpp"
|
||||
/*
|
||||
* Author: Brandon (TCVM)
|
||||
* Simple form of proportional navigation: does not take into account target velocity
|
||||
*
|
||||
* Arguments:
|
||||
* Guidance Arg Array <ARRAY>
|
||||
*
|
||||
* Return Value:
|
||||
* Commanded acceleration normal to LOS in world space <ARRAY>
|
||||
*
|
||||
* Example:
|
||||
* [] call ace_missileguidance_fnc_navigationType_simpleProNav
|
||||
*
|
||||
* 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
|
Loading…
Reference in New Issue
Block a user