WSF
WsfCoherentSensorProcessor.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI//REL TO USA ONLY
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2016 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOHERENTSENSORPROCESSOR_HPP
13#define WSFCOHERENTSENSORPROCESSOR_HPP
14
15#include "wsf_nx_export.h"
16
17#include <list>
18#include <map>
19#include <vector>
20
22class WsfPlatform;
23class WsfScenario;
25class WsfSensor;
26#include "WsfSensorResult.hpp"
28#include "WsfStringId.hpp"
29class WsfTrack;
30
33
35{
36public:
38 {
39 public:
41 : mSimTime()
42 , mResult()
43 {
44 }
45
46 ResultData(double aSimTime, WsfSensorResult& aResult)
47 : mSimTime(aSimTime)
48 , mResult(aResult)
49 {
50 }
51
52 double mSimTime;
54 };
55
62
69
71 using Results = std::vector<ResultData>;
72 using SensorToResultsMap = std::map<WsfStringId, Results>;
73 using TargetToSensorToResultMap = std::map<WsfStringId, SensorToResultsMap>;
74
77
78 WsfProcessor* Clone() const override;
79 bool Initialize(double aSimTime) override;
80 bool Initialize2(double aSimTime) override;
81 bool ProcessInput(UtInput& aInput) override;
82
83 void Update(double aSimTime) override;
84
85 // Overrides from WsfSingleSensorObserver
86 void OnSensorTurnedOff(double aSimTime, WsfSensor* aSensorPtr) override;
87 void OnSensorDetectionAttempted(double aSimTime,
88 WsfSensor* aSensorPtr,
89 WsfPlatform* aTargetPtr,
90 WsfSensorResult& aResult) override;
91 void OnSensorDeleting(WsfSensor* aSensorPtr) override;
92 void OnSensorTargetUpdated(double aSimTime, WsfSensor* aSensorPtr, WsfPlatform* aTargetPtr, WsfSensorResult& aResult) override;
93
94 class State
95 {
96 public:
98 // WsfFilter* mFilterPtr;
99 // unsigned int mStreamNumber;
100 };
101
102 // class Status
103 //{
104 // public:
105 // Status(WsfStringId aTruthName = WsfStringId())
106 // : mStateEntryTime(-1.0E+30),
107 // mMinimumTimeInState(0.0),
108 // mLastGoodUpdateTime(-1.0E+30),
109 // mCurrentState(cSS_UNDETECTED),
110 // mCoastingStartTime(-1.0E+30),
111 // mCoastingState(cSS_UNDETECTED),
112 // mTruthName(aTruthName),
113 // mIsStale(false)
114 // { }
115
116 // WsfStringId TruthName() const { return mTruthName; }
117
118 // void EnterState(TargetSensingState aNewState,
119 // double aStateEntryTime,
120 // double aMinimumTimeInState)
121 // {
122 // mCurrentState = aNewState;
123 // mStateEntryTime = aStateEntryTime;
124 // mMinimumTimeInState = aMinimumTimeInState;
125 // }
126
127 // void SetLastGoodUpdateTime(double aSimTime)
128 // {
129 // mLastGoodUpdateTime = aSimTime;
130 // mCoastingStartTime = -1.0E-30;
131 // mIsStale = false;
132 // }
133
134 // void SetStale() { mIsStale = true; }
135 // bool IsStale() const { return mIsStale; }
136
137 // //! Updates the coasting status.
138 // //! @returns true if the coast time limit has been exceeded, or false if coasting can continue.
139 // bool CoastTimeExceeded(double aSimTime,
140 // TargetSensingState aState,
141 // double aCoastTime)
142 // {
143 // if (mCoastingStartTime < 0.0)
144 // {
145 // mCoastingStartTime = aSimTime;
146 // mCoastingState = aState;
147 // }
148 // else if (aState > mCoastingState)
149 // {
150 // mCoastingState = aState;
151 // }
152 // mIsStale = false;
153 // return ((aSimTime - mCoastingStartTime) >= aCoastTime);
154 // }
155
156 // TargetSensingState CoastingState() const { return mCoastingState; }
157
158 // TargetSensingState CurrentState() const { return mCurrentState; }
159 // double StateEntryTime() const { return mStateEntryTime; }
160
161 // double EarliestStateExitTime() const { return mStateEntryTime + mMinimumTimeInState; }
162
163 // //! The time when the transition occurred into the current state.
164 // double mStateEntryTime;
165 // //! The minimum time that must be spent in the current state before a transition to a higher state can occur.
166 // double mMinimumTimeInState;
167 // //! The last time when a detection was registered that met the criteria for the current state.
168 // double mLastGoodUpdateTime;
169 // //! The current state
170 // TargetSensingState mCurrentState;
171 // //! The time when coasting started.
172 // double mCoastingStartTime;
173 // //! The state (quality) of the update associated with mLastFailedUpdateTime;
174 // TargetSensingState mCoastingState;
175 // //! The name id of the underlying platform represented by the object.
176 // WsfStringId mTruthName;
177 // //! True if the object is stale (didn't exist in the last image).
178 // bool mIsStale;
179 //};
180
182 // WsfCorrelationStrategy& GetCorrelationStrategy() { return *mCorrelationStrategyPtr; }
183
185 WsfFusionStrategy& GetFusionStrategy() { return *mFusionStrategyPtr; }
186
188 // void SetCorrelationStrategy(WsfStringId aTypeName);
189
191 void SetFusionStrategy(WsfStringId aTypeName);
192
193protected:
196
198 bool SensorAdded(WsfSensor* aSensorPtr) override;
199 bool SensorRemoved(WsfSensor* aSensorPtr) override;
200
201 void ClearSensorResults(WsfStringId aSensorId);
202
203 // virtual void TrackDropped(double aSimTime,
204 // const WsfTrack& aTrack) override;
205
206 virtual void UpdateTrack(double aSimTime,
207 WsfTrack* aTrackPtr,
208 WsfSensor* aSensorPtr,
209 WsfPlatform* aTargetPtr,
210 WsfSensorResult& aResult);
211
212private:
213 void ClearStateList();
214
215 void ProcessResults(double aSimTime, WsfSensor* aSensorPtr = nullptr, WsfPlatform* aTargetPtr = nullptr);
216
217 void ResultsProcessingInitiated(double aSimTime);
218 void ResultsProcessingCompleted(double aSimTime);
219
220 void PurgeOldTracks(double aSimTime, WsfSensor* aSensorPtr);
221
223 std::list<WsfSensor*> mAttachedSensors;
224
225 // Input Items
226 bool mUseTargetResult;
227 // bool mProcessOnTargetUpdate;
228 DetectionAlgorithmType mDetectionAlgorithmType;
229 double mDetectionThreshold;
230 // bool mShowStateTransitions;
231
232 // Results containers
233 SensorToResultsMap mIncomingResults;
234 TargetToSensorToResultMap mProcessedResults;
235
237 double mCoastTime;
238
241 // WsfVariable<double> mTransitionCoastTime;
242 // WsfVariable<double> mDetectionCoastTime;
244
247 using StateList = std::map<size_t, State*>;
248 StateList mStateList;
249
250 // typedef std::map<size_t, Status> StatusList;
251 // StatusList mStatusList;
252
255 // WsfCorrelationStrategy* mCorrelationStrategyPtr;
256 WsfFusionStrategy* mFusionStrategyPtr;
257 // WsfFilter* mPrototypeFilterPtr; // could be a part of the state struct above
258};
259
260#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
WsfSensorResult mResult
Definition WsfCoherentSensorProcessor.hpp:53
ResultData()
Definition WsfCoherentSensorProcessor.hpp:40
double mSimTime
Definition WsfCoherentSensorProcessor.hpp:52
ResultData(double aSimTime, WsfSensorResult &aResult)
Definition WsfCoherentSensorProcessor.hpp:46
Definition WsfCoherentSensorProcessor.hpp:95
WsfTrack * mTrackPtr
Definition WsfCoherentSensorProcessor.hpp:97
Definition WsfCoherentSensorProcessor.hpp:35
WsfFusionStrategy & GetFusionStrategy()
Return the correlation strategy used by this processor.
Definition WsfCoherentSensorProcessor.hpp:185
void ClearSensorResults(WsfStringId aSensorId)
Definition WsfCoherentSensorProcessor.cpp:746
std::vector< ResultData > Results
Type definitions for storing and processing sensor results.
Definition WsfCoherentSensorProcessor.hpp:71
WsfCoherentSensorProcessor & operator=(const WsfCoherentSensorProcessor &)=delete
DetectionAlgorithmType
Detection Algorithm State.
Definition WsfCoherentSensorProcessor.hpp:58
@ cDA_SNR
Definition WsfCoherentSensorProcessor.hpp:59
@ cDA_RSS_SNR
Definition WsfCoherentSensorProcessor.hpp:60
WsfCoherentSensorProcessor(WsfScenario &aScenario)
Definition WsfCoherentSensorProcessor.cpp:46
virtual void UpdateTrack(double aSimTime, WsfTrack *aTrackPtr, WsfSensor *aSensorPtr, WsfPlatform *aTargetPtr, WsfSensorResult &aResult)
Definition WsfCoherentSensorProcessor.cpp:799
std::map< WsfStringId, Results > SensorToResultsMap
Definition WsfCoherentSensorProcessor.hpp:72
std::map< WsfStringId, SensorToResultsMap > TargetToSensorToResultMap
Definition WsfCoherentSensorProcessor.hpp:73
TargetSensingState
Target Sensing State.
Definition WsfCoherentSensorProcessor.hpp:65
@ cSS_UNDETECTED
Definition WsfCoherentSensorProcessor.hpp:66
@ cSS_DETECTED
Definition WsfCoherentSensorProcessor.hpp:67
Definition WsfFusionStrategy.hpp:52
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
bool Initialize2(double aSimTime) override
Definition WsfProcessor.cpp:104
void Update(double aSimTime) override
Definition WsfProcessor.cpp:121
WsfProcessor(const WsfScenario &aScenario)
Definition WsfProcessor.cpp:25
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
virtual bool SensorAdded(WsfSensor *aSensorPtr)=0
Clear any data or lists maintained by inheriting classes.
bool Initialize(double aSimTime) override
Definition WsfSensorProcessor.cpp:54
WsfSensorProcessor(WsfScenario &aScenario)
Definition WsfSensorProcessor.cpp:34
bool ProcessInput(UtInput &aInput) override
Definition WsfSensorProcessor.cpp:72
WsfProcessor * Clone() const override=0
virtual bool SensorRemoved(WsfSensor *aSensorPtr)=0
Definition WsfSensorResult.hpp:27
Definition WsfSensor.hpp:92
Definition WsfSingleSensorObserver.hpp:33
virtual void OnSensorDetectionAttempted(double aSimTime, WsfSensor *aSensorPtr, WsfPlatform *aTargetPtr, WsfSensorResult &aResult)
Called after each sensor detection attempt, per mode/beam for multi-mode/beam sensors.
Definition WsfSingleSensorObserver.hpp:56
virtual void OnSensorTurnedOff(double aSimTime, WsfSensor *aSensorPtr)
Called just after the sensor is turned off.
Definition WsfSingleSensorObserver.hpp:38
virtual void OnSensorTargetUpdated(double aSimTime, WsfSensor *aSensorPtr, WsfPlatform *aTargetPtr, WsfSensorResult &aResult)
Called after each sensor update.
Definition WsfSingleSensorObserver.hpp:50
virtual void OnSensorDeleting(WsfSensor *aSensorPtr)
Called before the sensor is actually deleted.
Definition WsfSingleSensorObserver.hpp:44
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Copyrights Multiple, All Rights Reserved