12#ifndef WSFSA_PERCEIVE_HPP
13#define WSFSA_PERCEIVE_HPP
15#include "wsf_air_combat_export.h"
24#include <unordered_map>
25#include <unordered_set>
120 const std::vector<WsfSA_EntityPerception*>& PerceivedAssets(
double aSimTime);
126 const std::vector<WsfSA_EntityPerception*>& PerceivedAircraftAssets(
double aSimTime);
132 const std::vector<WsfSA_EntityPerception*>& PerceivedMissileAssets(
double aSimTime);
138 const std::vector<WsfSA_EntityPerception*>& PerceivedBogies(
double aSimTime);
144 const std::vector<WsfSA_EntityPerception*>& PerceivedAircraftBogies(
double aSimTime);
150 const std::vector<WsfSA_EntityPerception*>& PerceivedMissileBogies(
double aSimTime);
156 const std::vector<WsfSA_EntityPerception*>& PerceivedBandits(
double aSimTime);
162 const std::vector<WsfSA_EntityPerception*>& PerceivedAircraftBandits(
double aSimTime);
168 const std::vector<WsfSA_EntityPerception*>& PerceivedMissileBandits(
double aSimTime);
190 bool ProcessInput(UtInput& aInput);
196 bool ProcessMessage(
double aSimTime,
const WsfMessage& aMessage);
202 void Initialize(
double aSimTime);
225 bool EntityIsInAssetGroup(
size_t aEntityIndex)
const;
228 void PurgeOldAssets(
double aSimTime);
264 bool ThreatScore(
double aSimTime,
WsfLocalTrack* aThreatPtr,
bool aIsMissile,
double& aScore);
306 std::set<WsfPlatform*> TruthAssets();
311 std::string SelectedWeaponName()
const;
317 int QuantityOfSelectedWeapon()
const;
322 bool SetSelectedWeapon(
const std::string& aWeaponName);
330 void SetMasterArm(
bool aArmed);
333 bool GetMasterArm()
const;
336 bool MasterWarningActive()
const;
339 bool MasterCautionActive()
const;
342 bool WeaponBayDoorsAreOpen()
const;
345 bool ShootCueActive()
const;
348 bool ShootCueBlinking()
const;
351 bool JammingDetected()
const;
356 void SetMasterWarningActive(
bool aActive);
361 void SetMasterCautionActive(
bool aActive);
366 void SetWeaponBayDoorsAreOpen(
bool aOpen);
371 void SetShootCueActive(
bool aActive);
376 void SetShootCueBlinking(
bool aBlinking);
381 void SetJammingDetected(
bool aJammingDetected);
396 mDataPtr->mEngagedTarget = aEngagedTarget;
402 int QuantityOfChaff()
const;
405 int QuantityOfFlares()
const;
408 int QuantityOfDecoys()
const;
411 bool DispenseChaff(
double aSimTime);
414 bool DispenseFlare(
double aSimTime);
417 bool DispenseDecoy(
double aSimTime);
426 bool RenameGroup(
WsfSA_Group* aGroup,
const std::string& aName);
437 WsfSA_Group* CreateGroup(
const std::list<WsfSA_EntityPerception*>& aElements,
bool aProtect =
false);
448 bool DisbandGroup(
WsfSA_Group* aGroup,
bool aProtect =
false);
460 WsfSA_Group* MergeGroups(
const std::list<WsfSA_Group*>& aGroups,
bool aProtect =
false);
474 std::pair<WsfSA_Group*, WsfSA_Group*>
475 SplitGroup(
WsfSA_Group* aGroup,
int aNumElements,
int aCriterion,
bool aProtect =
false);
507 bool SetFocus(
WsfSA_Group* aGroup,
bool aFocus,
bool aProtect =
false);
550 bool Important(
size_t aPlatformIndex);
565 bool Unimportant(
size_t aPlatformIndex);
571 void LocalTrackDropped(
double aSimTime,
const WsfLocalTrack* aLocalTrackPtr);
576 double TryUpdateStatus(
double aSimTime);
582 double TryUpdateAssets(
double aSimTime);
588 double TryUpdatePerceivedItemData(
double aSimTime);
595 double TryUpdatePerceivedItemCalculation(
double aSimTime);
600 double UpdateStatus(
double aSimTime);
605 void UpdateAssets(
double aSimTime);
610 void UpdateAssetsData(
double aSimTime);
616 void UpdateGroupsData(
double aSimTime);
621 void UpdatePerceivedItemsCalculation(
double aSimTime);
624 void RemoveAnyInvalidEntitiesInBogiesAndBandits();
629 void Prune(
double aSimTime);
632 void FindExpenableCountermeasures();
643 void CreateAssetsList(
double aSimTime, std::list<WsfSA_EntityPerception*>& aTempAssetsList,
bool aUnlimitedAssets);
652 void CreateBanditsList(
double aSimTime, std::list<WsfSA_EntityPerception*>& aTrackedEntitiesList,
bool aUnlimitedBandits);
661 void CreateBogiesList(
double aSimTime, std::list<WsfSA_EntityPerception*>& aTrackedEntitiesList,
bool aUnlimitedBogies);
671 void CreateAssetSublists();
674 void CreateSublists();
682 void RemoveExpiredCoastingPerceptions(std::vector<WsfSA_EntityPerception*>& aPerceptionList,
686 void SetOldPerceptionsAsCoasting(
const std::vector<WsfSA_EntityPerception*>& aPerceptionList,
double aSimTime);
697 void UpdateCoastingPerceptions(
const std::vector<WsfSA_EntityPerception*>& aPerceptionList,
698 const std::list<WsfSA_EntityPerception*>& aNewPerceptionList,
708 void AddOrUpdatePerception(std::vector<WsfSA_EntityPerception*>& aPerceptionList,
719 void JoinInitialGroups(std::vector<WsfSA_EntityPerception*>& aPerceptionList,
720 std::list<WsfSA_Group*>& aGroupList,
736 void DeferredDelete();
739 std::list<WsfSA_EntityPerception*> mDeferredForDeletion;
741 double mConsiderationRandomness{0.0};
743 std::default_random_engine mRandom{};
747 struct TrackDelayData
757 std::unordered_map<WsfTrackId, TrackDelayData, WsfTrackId> mTrackDelayQueue;
762 WsfSA_GroupManager mGroupManager;
764 double mMaxGroupingDistanceCentroid{8.0 * UtMath::cM_PER_NM};
765 double mMaxGroupingDistanceNeighbor{4.0 * UtMath::cM_PER_NM};
766 double mMaxGroupingHeadingDifference{10.0 * UtMath::cRAD_PER_DEG};
767 double mMaxGroupingSpeedDifference{100.0};
768 double mMinGroupRadius{1.0 * UtMath::cM_PER_NM};
769 bool mUseCentroidGrouping{
true};
770 bool mUseNeighborGrouping{
true};
771 bool mUseHeadingGrouping{
true};
772 bool mUseSpeedGrouping{
true};
773 bool mUseTypeGrouping{
false};
774 bool mIgnoreBogiesWhenGrouping{
false};
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
A specialization of WsfWeapon for weapons modeled as separate platforms.
Definition WsfExplicitWeapon.hpp:30
Definition WsfLocalTrack.hpp:32
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Definition WsfSA_EntityPerception.hpp:37
Definition WsfSA_Group.hpp:24
WsfSA_Processor::PerceiveData * mDataPtr
Perceived data container used by multiple SAP classes and lives in the SA Processor.
Definition WsfSA_Module.hpp:56
WsfSA_Module(WsfSA_Processor *aSA_ProcPtr, WsfSA_Processor::PerceiveData *aDataPtr)
Definition WsfSA_Module.cpp:14
This is the perceive module of the SA Processor.
Definition WsfSA_Perceive.hpp:31
WsfSA_Perceive(WsfSA_Processor *aSA_ProcPtr, WsfSA_Processor::PerceiveData *aDataPtr)
Definition WsfSA_Perceive.cpp:32
void SetEngagedTarget(const WsfSA_Processor::SA_EngagedTarget &aEngagedTarget)
Sets the engaged target using the specified engaged target data.
Definition WsfSA_Perceive.hpp:394
void AddExtraCognitiveLoading(double aTimeDelay)
Add a cognitive loading time (delay).
Definition WsfSA_Perceive.cpp:63
void SetMaxAssetLoad(int aLoad)
Set the max asset load.
Definition WsfSA_Perceive.hpp:209
WsfSA_Perceive & operator=(const WsfSA_Perceive &)=delete
const std::vector< WsfExplicitWeapon * > GetWeaponList() const
Returns the current list of weapons.
Definition WsfSA_Perceive.hpp:325
friend class WsfSA_Processor
Definition WsfSA_Perceive.hpp:33
RecipientType
Definition WsfSA_Perceive.hpp:37
@ cPEERS
Definition WsfSA_Perceive.hpp:39
@ cALLSUBORDINATES
Definition WsfSA_Perceive.hpp:42
@ cSUBORDINATES
Definition WsfSA_Perceive.hpp:40
@ cALLCOMMANDERS
Definition WsfSA_Perceive.hpp:41
@ cCOMMANDER
Definition WsfSA_Perceive.hpp:38
void MarkThreatTypeAsImportant(const std::string &aType)
Mark a threat type as important.
Definition WsfSA_Perceive.cpp:287
friend class WsfSA_ProcessorUpdateEvent
Definition WsfSA_Perceive.hpp:34
void MarkAssetAsImportant(WsfPlatform &aAsset)
Mark an asset as important.
Definition WsfSA_Perceive.cpp:241
void SetMaxThreatLoad(int aLoad)
Set the max asset load.
Definition WsfSA_Perceive.hpp:253
int MaxAssetLoad()
Return the max asset load the platform can handle.
Definition WsfSA_Perceive.hpp:105
bool EngagedTargetValid() const
These functions provide data related to the primary target being engaged.
Definition WsfSA_Perceive.hpp:386
void MarkAssetAsUnimportant(WsfPlatform &aAsset)
Mark an asset as unimportant.
Definition WsfSA_Perceive.cpp:252
void MarkAssetTypeAsImportant(const std::string &aType)
Mark an asset type as important.
Definition WsfSA_Perceive.cpp:263
void ResetMaxAssetLoad()
Set the max asset load to the value provided during initialization (default is -1 where not provided)...
Definition WsfSA_Perceive.hpp:212
void ResetMaxThreatLoad()
Set the max threat load to the value provided during initialization (default is -1 where not provided...
Definition WsfSA_Perceive.hpp:256
void MarkAssetTypeAsUnimportant(const std::string &aType)
Mark an asset type as unimportant.
Definition WsfSA_Perceive.cpp:269
WsfSA_Processor::SA_EngagedTarget GetEngagedTarget() const
Returns an EngagedTarget struct for the primary engaged target.
Definition WsfSA_Perceive.hpp:389
void MarkThreatTypeAsUnimportant(const std::string &aType)
Mark a threat type as unimportant.
Definition WsfSA_Perceive.cpp:293
void MarkThreatAsUnimportant(WsfLocalTrack &aThreat)
Mark a threat as unimportant.
Definition WsfSA_Perceive.cpp:281
int MaxThreatLoad()
Return the max threat load the platform can handle.
Definition WsfSA_Perceive.hpp:108
void MarkThreatAsImportant(WsfLocalTrack &aThreat)
Mark a threat as important.
Definition WsfSA_Perceive.cpp:275
The WsfSA_PerceivedItem class is used as a base class for WsfSA_EntityPerception and WsfSA_Group,...
Definition WsfSA_PerceivedItem.hpp:38
Definition WsfSA_Processor.hpp:60
Definition WsfTrackId.hpp:33
Definition WsfSA_Processor.hpp:86
Definition WsfSA_Processor.hpp:69