allow for bang bang guidance

This commit is contained in:
Brandon Danyluk 2021-04-10 19:02:31 -06:00
parent 0af82a56f4
commit 450d1a2a09
2 changed files with 13 additions and 2 deletions

View File

@ -31,7 +31,7 @@ if (!alive _projectile || isNull _projectile || isNull _shooter) exitWith {
END_COUNTER(guidancePFH);
};
_flightParams params ["_pitchRate", "_yawRate"];
_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"];
// Run seeker function:
private _seekerTargetPos = [[0,0,0], _args, _seekerStateParams, _lastKnownPosState] call FUNC(doSeekerSearch);
@ -64,6 +64,14 @@ if ((_pitchRate != 0 || {_yawRate != 0}) && {_profileAdjustedTargetPos isNotEqua
private _clampedPitch = (_pitchChange min _pitchRate) max -_pitchRate;
private _clampedYaw = (_yawChange min _yawRate) max -_yawRate;
// controls are either on or off, no proportional
if (_isBangBangGuidance) then {
private _pitchSign = _clampedPitch / abs _clampedPitch;
private _yawSign = _clampedYaw / abs _clampedYaw;
_clampedPitch = _pitchSign * _pitchRate;
_clampedYaw = _yawSign * _clampedYaw;
};
TRACE_9("pitch/yaw/roll",_pitch,_yaw,_roll,_yawChange,_pitchChange,_pitchRate,_yawRate,_clampedPitch,_clampedYaw);
_pitch = _pitch + _clampedPitch * TIMESTEP_FACTOR;

View File

@ -111,9 +111,11 @@ private _navigationParameters = [
// default config values to make sure there is backwards compat
private _pitchRate = 30;
private _yawRate = 30;
private _bangBang = false;
if (isNumber (_config >> "pitchRate")) then {
_pitchRate = getNumber ( _config >> "pitchRate" );
_yawRate = getNumber ( _config >> "yawRate" );
_bangBang = 1 == getNumber (_config >> "bangBangGuidance");
};
TRACE_5("Beginning ACE guidance system",_target,_ammo,_seekerType,_attackProfile,_navigationType);
@ -128,7 +130,8 @@ private _args = [_this,
],
[
_pitchRate,
_yawRate
_yawRate,
_bangBang
],
[
getNumber ( _config >> "seekerAngle" ),