mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
chane navigation profiles to go for attack direction instead of target
This commit is contained in:
parent
d34201ed4e
commit
a2d2dd0df9
@ -19,7 +19,7 @@
|
||||
BEGIN_COUNTER(guidancePFH);
|
||||
|
||||
params ["_args", "_pfID"];
|
||||
_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams"];
|
||||
_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData"];
|
||||
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
|
||||
_launchParams params ["","_targetLaunchParams","","","","","_navigationType"];
|
||||
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState", "_navigationParameters", "_guidanceParameters"];
|
||||
@ -40,6 +40,8 @@ _seekerTargetPos = AGLtoASL ASLToAGL _seekerTargetPos;
|
||||
private _profileAdjustedTargetPos = [_seekerTargetPos, _args, _attackProfileStateParams] call FUNC(doAttackProfile);
|
||||
|
||||
private _projectilePos = getPosASLVisual _projectile;
|
||||
_targetData set [1, _projectilePos vectorFromTo _profileAdjustedTargetPos];
|
||||
|
||||
|
||||
// If we have no seeker target, then do not change anything
|
||||
// If there is no deflection on the missile, this cannot change and therefore is redundant. Avoid calculations for missiles without any deflection
|
||||
@ -70,7 +72,7 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
|
||||
if (isNil "_pitchChange") then {
|
||||
_pitchChange = 0;
|
||||
};
|
||||
|
||||
|
||||
private _clampedPitch = (_pitchChange min _pitchRate) max -_pitchRate;
|
||||
private _clampedYaw = (_yawChange min _yawRate) max -_yawRate;
|
||||
|
||||
|
@ -20,17 +20,17 @@ _firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "","_navigationParams"];
|
||||
_navigationParams params ["_lastMissileFrame", "_navigationGain"];
|
||||
_lastMissileFrame params ["_lastLineOfSight"];
|
||||
_targetData params ["_targetDirection", "", "_targetVelocity", "_targetAcceleration"];
|
||||
_targetData params ["_targetDirection", "_attackProfileDirection", "", "_targetVelocity", "_targetAcceleration"];
|
||||
|
||||
// Proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel
|
||||
private _closingVelocity = _targetVelocity vectorDiff velocity _projectile;
|
||||
|
||||
private _targetAccelerationProjected = _targetDirection vectorMultiply (_targetAcceleration vectorDotProduct _targetDirection);
|
||||
private _targetAccelerationProjected = _attackProfileDirection vectorMultiply (_targetAcceleration vectorDotProduct _attackProfileDirection);
|
||||
_targetAcceleration = _targetAcceleration vectorDiff _targetAccelerationProjected;
|
||||
|
||||
// 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 = _targetDirection vectorDiff _lastLineOfSight;
|
||||
private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight;
|
||||
private _losRate = if (_timestep == 0) then {
|
||||
0
|
||||
} else {
|
||||
@ -42,11 +42,11 @@ private _commandedAcceleration = _closingVelocity vectorMultiply _lateralAcceler
|
||||
_commandedAcceleration = _commandedAcceleration vectorAdd (_losDelta vectorMultiply (0.5 * _navigationGain * vectorMagnitude _targetAcceleration));
|
||||
|
||||
// we need acceleration normal to our LOS
|
||||
private _commandedAccelerationProjected = _targetDirection vectorMultiply (_commandedAcceleration vectorDotProduct _targetDirection);
|
||||
private _commandedAccelerationProjected = _attackProfileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _attackProfileDirection);
|
||||
_commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected;
|
||||
|
||||
if (accTime > 0) then {
|
||||
_navigationParams set [0, [_seekerTargetPos, _targetVelocity, _targetDirection]];
|
||||
_navigationParams set [0, [_seekerTargetPos, _targetVelocity, _attackProfileDirection]];
|
||||
};
|
||||
|
||||
_commandedAcceleration
|
||||
|
@ -18,18 +18,19 @@ params ["_args", "_timestep", "_seekerTargetPos", "_profileAdjustedTargetPos"];
|
||||
_args params ["_firedEH", "", "", "", "_stateParams", "_targetData"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "","_navigationParams"];
|
||||
_navigationParams params ["_lastLineOfSight"];
|
||||
_targetData params ["_targetDirection", "", "_targetVelocity", ""];
|
||||
_navigationParams params ["_onLaunch"];
|
||||
_onLaunch params ["_lastLineOfSight"];
|
||||
_targetData params ["_targetDirection", "_attackProfileDirection", "", "_targetVelocity", ""];
|
||||
|
||||
// Semi-proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel
|
||||
|
||||
// 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 = _targetDirection vectorDiff _lastLineOfSight;
|
||||
private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight;
|
||||
private _losRate = if (_timestep == 0) then {
|
||||
0
|
||||
} else {
|
||||
10 * (vectorMagnitude _losDelta) / _timestep;
|
||||
1 * (vectorMagnitude _losDelta) / _timestep;
|
||||
};
|
||||
|
||||
private _closingVelocity = _targetVelocity vectorDiff (velocity _projectile);
|
||||
@ -37,11 +38,11 @@ private _closingVelocity = _targetVelocity vectorDiff (velocity _projectile);
|
||||
private _commandedAcceleration = _closingVelocity vectorMultiply _losRate;
|
||||
|
||||
// we need acceleration normal to our LOS
|
||||
private _commandedAccelerationProjected = _lineOfSight vectorMultiply (_commandedAcceleration vectorDotProduct _lineOfSight);
|
||||
private _commandedAccelerationProjected = _attackProfileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _attackProfileDirection);
|
||||
_commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected;
|
||||
|
||||
if (accTime > 0) then {
|
||||
_navigationParams set [0, _targetDirection];
|
||||
_navigationParams set [0, [_attackProfileDirection]];
|
||||
};
|
||||
|
||||
_commandedAccelerationProjected
|
||||
_commandedAcceleration
|
||||
|
@ -20,14 +20,14 @@ _firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "","_navigationParams"];
|
||||
_navigationParams params ["_lastMissileFrame", "_navigationGain"];
|
||||
_lastMissileFrame params ["_lastLineOfSight"];
|
||||
_targetData params ["_targetDirection", "", "_targetVelocity", ""];
|
||||
_targetData params ["_targetDirection", "_attackProfileDirection", "", "_targetVelocity", ""];
|
||||
|
||||
// Proportional navigation implemented via "Fundamentals of proportional navigation" by Stephen Murtaugh and Harry Criel
|
||||
private _closingVelocity = _targetVelocity vectorDiff velocity _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 = _targetDirection vectorDiff _lastLineOfSight;
|
||||
private _losDelta = _attackProfileDirection vectorDiff _lastLineOfSight;
|
||||
private _losRate = if (_timestep == 0) then {
|
||||
0
|
||||
} else {
|
||||
@ -38,11 +38,11 @@ private _lateralAcceleration = _navigationGain * _losRate;
|
||||
private _commandedAcceleration = _closingVelocity vectorMultiply _lateralAcceleration;
|
||||
|
||||
// we need acceleration normal to our LOS
|
||||
private _commandedAccelerationProjected = _targetDirection vectorMultiply (_commandedAcceleration vectorDotProduct _targetDirection);
|
||||
private _commandedAccelerationProjected = _attackProfileDirection vectorMultiply (_commandedAcceleration vectorDotProduct _attackProfileDirection);
|
||||
_commandedAcceleration = _commandedAcceleration vectorDiff _commandedAccelerationProjected;
|
||||
|
||||
if (accTime > 0) then {
|
||||
_navigationParams set [0, [_seekerTargetPos, _targetVelocity, _targetDirection]];
|
||||
_navigationParams set [0, [_seekerTargetPos, _targetVelocity, _attackProfileDirection]];
|
||||
};
|
||||
|
||||
_commandedAcceleration
|
||||
|
@ -19,14 +19,14 @@ _args params ["_firedEH", "", "", "", "_stateParams", "_targetData"];
|
||||
_firedEH params ["","","","","","","_projectile"];
|
||||
_stateParams params ["", "", "", "","_navigationParams"];
|
||||
_navigationParams params ["", "_navigationGain"];
|
||||
_targetData params ["_targetDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"];
|
||||
_targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"];
|
||||
|
||||
private _vectorToTarget = _targetDirection vectorMultiply _targetRange;
|
||||
private _vectorToTarget = _attackProfileDirection vectorMultiply _targetRange;
|
||||
private _closingVelocity = _targetVelocity vectorDiff velocity _projectile;
|
||||
private _timeToGo = _targetRange / vectorMagnitude _closingVelocity;
|
||||
|
||||
private _zeroEffortMiss = _vectorToTarget vectorAdd (_closingVelocity vectorMultiply _timeToGo);
|
||||
private _zeroEffortMissProjectiled = _targetDirection vectorMultiply (_zeroEffortMiss vectorDotProduct _targetDirection);
|
||||
private _zeroEffortMissProjectiled = _attackProfileDirection vectorMultiply (_zeroEffortMiss vectorDotProduct _attackProfileDirection);
|
||||
private _zeroEffortMissNormal = _zeroEffortMiss vectorDiff _zeroEffortMissProjectiled;
|
||||
|
||||
private _commandedAcceleration = _zeroEffortMissNormal vectorMultiply (_navigationGain / (_timeToGo * _timeToGo));
|
||||
|
@ -141,6 +141,7 @@ private _args = [_this,
|
||||
[
|
||||
// target data from missile. Must be filled by seeker for navigation to work
|
||||
[0, 0, 0], // direction to target
|
||||
[0, 0, 0], // direction to attack profile
|
||||
0, // range to target
|
||||
[0, 0, 0], // target velocity
|
||||
[0, 0, 0] // target acceleration
|
||||
@ -180,7 +181,7 @@ if (_onFiredFunc != "") then {
|
||||
// _flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"];
|
||||
// _stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams", "_guidanceParameters"];
|
||||
// _seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
|
||||
// _targetData params ["_targetDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"];
|
||||
// _targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"];
|
||||
|
||||
[LINKFUNC(guidancePFH),0, _args ] call CBA_fnc_addPerFrameHandler;
|
||||
|
||||
|
@ -117,9 +117,9 @@ if !(isNull _target) then {
|
||||
_seekerStateParams set [8, CBA_missionTime];
|
||||
_seekerStateParams set [9, false];
|
||||
|
||||
_targetData set [1, _projectile distance _target];
|
||||
_targetData set [2, velocity _target];
|
||||
_targetData set [3, 0]; // todo: acceleration
|
||||
_targetData set [2, _projectile distance _target];
|
||||
_targetData set [3, velocity _target];
|
||||
_targetData set [4, 0]; // todo: acceleration
|
||||
};
|
||||
|
||||
_targetData set [0, (getPosASLVisual _projectile) vectorFromTo _expectedTargetPos];
|
||||
|
@ -45,9 +45,9 @@ private _distanceToTarget = (getPosASL _projectile) vectorDistance _foundTargetP
|
||||
private _eta = _distanceToTarget / _projectileSpeed;
|
||||
|
||||
_targetData set [0, (getPosASL _projectile) vectorFromTo _foundTargetPos];
|
||||
_targetData set [1, _distanceToTarget];
|
||||
_targetData set [2, velocity _target];
|
||||
_targetData set [3, 0];
|
||||
_targetData set [2, _distanceToTarget];
|
||||
_targetData set [3, velocity _target];
|
||||
_targetData set [4, 0];
|
||||
|
||||
TRACE_2("return",_foundTargetPos,(aimPos _target) distance _foundTargetPos);
|
||||
_foundTargetPos;
|
||||
|
Loading…
Reference in New Issue
Block a user