Skip to content

Commit

Permalink
Missileguidance - Update Javelin (#10030)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCandianVendingMachine authored Aug 23, 2024
1 parent b369619 commit 7279b94
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 6 deletions.
26 changes: 23 additions & 3 deletions addons/missileguidance/CfgAmmo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ class CfgAmmo {
// Begin ACE guidance Configs
class ADDON {
enabled = 1;
minDeflection = 0.00005; // Minium flap deflection for guidance
maxDeflection = 0.025; // Maximum flap deflection for guidance
incDeflection = 0.00005; // The incrmeent in which deflection adjusts.

pitchRate = 100; // degrees per second
yawRate = 100;
stabilityCoefficient = 0.2;
bangBangGuidance = 0;

canVanillaLock = 0;

Expand All @@ -83,6 +85,11 @@ class CfgAmmo {
defaultSeekerLockMode = "LOBL";
seekerLockModes[] = { "LOBL" };

defaultNavigationType = "Direct";
navigationTypes[] = { "Direct", "ZeroEffortMiss" };

navigationGain = 3;

seekerAngle = 180; // Angle in front of the missile which can be searched
seekerAccuracy = 1; // seeker accuracy multiplier

Expand All @@ -95,6 +102,19 @@ class CfgAmmo {
defaultAttackProfile = "JAV_TOP";
attackProfiles[] = { "JAV_TOP", "JAV_DIR" };
useModeForAttackProfile = 1;

class navigationStates {
class initial {
transitionCondition = QFUNC(javelin_midCourseTransition);
navigationType = "Direct";
};
class terminal {
transitionCondition = "";
navigationType = "ZeroEffortMiss";
};
// transitions from initial -> termimal
states[] = {"initial", "terminal"};
};
};
};
class ACE_Javelin_FGM148_static: ACE_Javelin_FGM148 {
Expand Down
1 change: 1 addition & 0 deletions addons/missileguidance/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ PREP(attackProfile_BEAM);
// Javelin profiles
PREP(attackProfile_JAV_DIR);
PREP(attackProfile_JAV_TOP);
PREP(javelin_midCourseTransition);

// Navigation Profiles
PREP(navigationType_zeroEffortMiss);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ private _returnTargetPos = _seekerTargetPos;
switch (_attackProfileStateParams select 0) do {
case STAGE_LAUNCH: {
TRACE_1("STAGE_LAUNCH","");
if (_distanceToShooter < 10) then {
if (_distanceToShooter < 6) then {
_returnTargetPos = _seekerTargetPos vectorAdd [0,0,_distanceToTarget*2];
} else {
_attackProfileStateParams set [0, STAGE_CLIMB];
};
};
case STAGE_CLIMB: {
TRACE_1("STAGE_CLIMB","");
private _cruisAlt = 60 * (_distanceShooterToTarget/2000);
// 65 is min range
private _cruisAlt = 60 * ((0 max (_distanceShooterToTarget - 65))/2000);

if ( ((ASLToAGL _projectilePos) select 2) - ((ASLToAGL _seekerTargetPos) select 2) >= _cruisAlt) then {
_attackProfileStateParams set [0, STAGE_TERMINAL];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ switch( (_attackProfileStateParams select 0) ) do {
TRACE_1("STAGE_CLIMB","");
private _cruisAlt = 140;
if (_distanceShooterToTarget < 1250) then {
_cruisAlt = 140 * (_distanceShooterToTarget/1250);
_cruisAlt = 140 * ((0 max (_distanceShooterToTarget - 150))/1250);
TRACE_1("_cruisAlt",_cruisAlt);
};
if ( ((ASLToAGL _projectilePos) select 2) - ((ASLToAGL _seekerTargetPos) select 2) >= _cruisAlt) then {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include "..\script_component.hpp"
/*
* Author: tcvm
* Condition to switch to next navigation profile
*
* Arguments:
* Guidance Arg Array <ARRAY>
*
* Return Value:
* None
*
* Example:
* [] call ace_missileguidance_fnc_javelin_midCourseTransition
*
* Public: No
*/
#define STAGE_LAUNCH 1
#define STAGE_CLIMB 2
#define STAGE_COAST 3
#define STAGE_TERMINAL 4

_args params ["_firedEH", "_launchParams", "_flightParams", "_seekerParams", "_stateParams", "_targetData", "_navigationStateData"];
_firedEH params ["_shooter","","","","_ammo","","_projectile"];
_launchParams params ["_shooter","_targetLaunchParams","_seekerType","_attackProfile","_lockMode","_laserInfo","_navigationType"];
_targetLaunchParams params ["_target", "_targetPos", "_launchPos", "_launchDir", "_launchTime"];
_flightParams params ["_pitchRate", "_yawRate", "_isBangBangGuidance"];
_stateParams params ["_lastRunTime", "_seekerStateParams", "_attackProfileStateParams", "_lastKnownPosState","_navigationParams", "_guidanceParameters"];
_seekerParams params ["_seekerAngle", "_seekerAccuracy", "_seekerMaxRange", "_seekerMinRange"];
_targetData params ["_targetDirection", "_attackProfileDirection", "_targetRange", "_targetVelocity", "_targetAcceleration"];

_attackProfileStateParams params ["_state"];
_state isEqualTo STAGE_TERMINAL

0 comments on commit 7279b94

Please sign in to comment.