WSF
WsfTrackManager.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing 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 WSFTRACKMANAGER_HPP
13#define WSFTRACKMANAGER_HPP
14
15#include "wsf_export.h"
16
17#include <map>
18#include <memory>
19#include <string>
20
21#include "UtCallback.hpp"
22class UtInput;
23class UtScriptTypes;
24
26class WsfFilter;
28class WsfLocalTrack;
29class WsfPlatform;
30class WsfScenario;
32class WsfSimulation;
33#include "WsfTrackList.hpp"
34
62{
63public:
64 static std::unique_ptr<UtScriptClass> CreateScriptClass(const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
65
66 WsfTrackManager() = default;
67 WsfTrackManager(const WsfScenario& aScenario);
69 ~WsfTrackManager() override;
70
72
73 WsfComponent* CloneComponent() const override { return Clone(); }
74 void* QueryInterface(int aRole) override { return (aRole == mRoles[0]) ? this : nullptr; }
76 void ComponentParentChanged(WsfPlatform* aPlatformPtr) override { mPlatformPtr = aPlatformPtr; }
78
81 virtual WsfTrackManager* Clone() const { return new WsfTrackManager(*this); }
82
83 bool ProcessInput(UtInput& aInput) override;
84 bool Initialize(double aSimTime) override;
85 bool Initialize2(double aSimTime) override;
86
87 virtual bool Initialize(double aSimTime, WsfPlatform* aPlatformPtr);
88
90 WsfPlatform* GetPlatform() const { return mPlatformPtr; }
91
93 WsfCorrelationStrategy& GetCorrelationStrategy() { return *mCorrelationStrategyPtr; }
94 const WsfCorrelationStrategy& GetCorrelationStrategy() const { return *mCorrelationStrategyPtr; }
95
97 WsfFusionStrategy& GetFusionStrategy() { return *mFusionStrategyPtr; }
98 const WsfFusionStrategy& GetFusionStrategy() const { return *mFusionStrategyPtr; }
99
101 void SetCorrelationStrategy(WsfStringId aTypeName);
102
104 void SetFusionStrategy(WsfStringId aTypeName);
105
110 void SetDropUncorrelatedTracks(bool aDropUncorrelatedTracks) { mDropUncorrelatedTracks = aDropUncorrelatedTracks; }
111
113 void SetDebug(bool aDebug) { mDebug = aDebug; }
114
116 bool DebugEnabled() const { return mDebug; }
117
120 void SetInitiateLocalTracks(bool aInitiateLocalTracks) { mInitiateLocalTracks = aInitiateLocalTracks; }
121
123 bool LocalTracksInitiated() const { return mInitiateLocalTracks; }
124
126
127 virtual void PurgeInactiveTracks(double aSimTime, double aInactivityTimeLimit);
128
129 virtual void PurgeInactiveRawTracks(double aSimTime, double aInactivityTimeLimit, double aStaticInactivityTimeLimit);
130
131 virtual void PurgeLocalTrackHistory(double aSimTime, double aKeepTimeInterval);
132
135 void SetWillPurgeInactiveTracks(bool aWillPurgeInactiveTracks)
136 {
137 mWillPurgeInactiveTracks = aWillPurgeInactiveTracks;
138 }
139
141 bool WillPurgeInactiveTracks() const { return mWillPurgeInactiveTracks; }
142
144
148
149 virtual void LockTrack(double aSimTime, const WsfTrackId& aLocalTrackId);
150
151 virtual void LockTrack(double aSimTime, WsfLocalTrack* aLocalTrackPtr);
152
153 virtual void UnlockTrack(double aSimTime, const WsfTrackId& aLocalTrackId);
154
155 virtual void UnlockTrack(double aSimTime, WsfLocalTrack* aLocalTrackPtr);
157
159 //{@
160 virtual void StartFrame();
161
162 virtual void EndFrame();
163
164 virtual WsfLocalTrack* AddTrackReport(double aSimTime, const WsfTrack& aTrackUpdate);
165
166 virtual WsfTrack* AddRawTrackReport(double aSimTime, const WsfTrack& aRawTrack);
167
168 virtual void DropTrack(double aSimTime, const WsfTrackId& aRawTrackId);
169
170 std::unique_ptr<WsfLocalTrack> RemoveTrack(const WsfTrackId& aTrackId);
171
172 virtual WsfLocalTrack* FindCorrelatedTrack(const WsfTrackId& aRawTrackId);
173
174 static WsfLocalTrack* FindCorrelatedTrack(const WsfTrackId& aRawTrackId, WsfLocalTrackList& aLocalTrackList);
176
178
179 virtual WsfLocalTrack* AddTrack(double aSimTime, const WsfTrack& aTrack);
180
181 void AddInitialTrack(const WsfTrack& aTrack);
182
183 virtual WsfLocalTrack* InitiateTrack(double aSimTime, const WsfTrack& aRawTrack);
184
185 WsfLocalTrack* InitiateTrackSilent(double aSimTime, const WsfTrack& aRawTrack);
186
188 WsfLocalTrack* InitiateAndCorrelateTrack(double aSimTime, const WsfTrack& aRawTrack)
189 {
190 return InitiateTrackSilent(aSimTime, aRawTrack);
191 }
192
193
195
196
200 unsigned int GetTrackCount() const { return mTrackList->GetTrackCount(); }
201
206 WsfLocalTrack* GetTrackEntry(unsigned int aEntryIndex) { return mTrackList->GetTrackEntry(aEntryIndex); }
207
212 unsigned int GetRawTrackCount() { return mRawTrackList->GetTrackCount(); }
213
219 WsfTrack* GetRawTrackEntry(unsigned int aEntryIndex) { return mRawTrackList->GetTrackEntry(aEntryIndex); }
220
225 WsfLocalTrack* FindTrack(const WsfTrackId& aLocalTrackId) { return mTrackList->FindTrack(aLocalTrackId); }
226
231 WsfTrack* FindRawTrack(const WsfTrackId& aRawTrackId) { return mRawTrackList->FindTrack(aRawTrackId); }
232
235 WsfLocalTrackList& GetTrackList() { return *mTrackList; }
236
239 WsfTrackList& GetRawTrackList() { return *mRawTrackList; }
240
243 WsfLocalTrackList& GetLocalTrackList() { return *mTrackList; }
244
247 WsfLocalTrackList& GetFilteredRawTrackList() { return *mFilteredRawTrackList; }
248
250 const WsfLocalTrackList& GetFilteredRawTrackList() const { return *mFilteredRawTrackList; }
251
252 WsfTrack* GetRawTrack(const WsfLocalTrack* aLocalTrackPtr, unsigned int aRawTrackEntry);
253
254 bool HasFilter() { return (mPrototypeFilterPtr != nullptr); }
255
257
259
260 const WsfTrack* GetCurrentTarget();
261
263 const WsfTrackId GetCurrentTargetTrackId() const { return mCurrentTargetId; }
264
265 WsfTrackId SetCurrentTarget(double aSimTime, const WsfTrack& aTrack);
266
270 void ClearCurrentTarget() { mCurrentTargetId.Null(); }
271
273
279
280 void NotifyOfCandidateTrackPromoted(double aSimTime, const WsfLocalTrack* aLocalTrackPtr);
281
282 void NotifyOfCurrentTargetChanged(double aSimTime, const WsfLocalTrack* aRawTrackPtr);
283
284 void NotifyOfLocalTrackCorrelation(double aSimTime, const WsfLocalTrack* aTrackPtr, const WsfTrackId& aRawTrackId);
285
286 void NotifyOfLocalTrackDecorrelation(double aSimTime, const WsfLocalTrack* aLocalTrackPtr, const WsfTrackId& aRawTrackId);
287
288 void NotifyOfLocalTrackDropped(double aLocalSimTime, const WsfLocalTrack* aTrackPtr);
289
290 void NotifyOfLocalTrackInitiated(double aSimTime, const WsfLocalTrack* aLocalTrackPtr, const WsfTrack* aRawTrackPtr);
291
292 void NotifyOfLocalTrackUpdated(double aSimTime, const WsfLocalTrack* aLocalTrackPtr, const WsfTrack* aRawTrackPtr);
293
294 void NotifyOfRawTrackDropped(double aSimTime, const WsfTrack* aTrack);
295
296 void NotifyOfRawTrackReceived(double aSimTime, const WsfTrack* aRawTrackPtr);
297
298 void NotifyOfTrackManagerChanged(double aSimTime, WsfTrackManager* aNewManagerPtr);
300
304
305 UtCallbackListN<void(double, const WsfLocalTrack*)> CandidateTrackPromoted;
306 UtCallbackListN<void(double, const WsfLocalTrack*)> CurrentTargetChanged;
307 UtCallbackListN<void(double, const WsfLocalTrack*, const WsfTrackId&)> LocalTrackCorrelation;
308 UtCallbackListN<void(double, const WsfLocalTrack*, const WsfTrackId&)> LocalTrackDecorrelation;
309 UtCallbackListN<void(double, const WsfLocalTrack*, const WsfTrack*)> LocalTrackInitiated;
310 UtCallbackListN<void(double, const WsfLocalTrack*)> LocalTrackDropped;
311 UtCallbackListN<void(double, const WsfLocalTrack*, const WsfTrack*)> LocalTrackUpdated;
312 UtCallbackListN<void(double, const WsfTrack*)> RawTrackDropped;
313 UtCallbackListN<void(double, const WsfTrack*)> RawTrackReceived;
314 UtCallbackListN<void(double, WsfTrackManager*)> TrackManagerChanged;
316
317 bool UpdateAuxData(double aSimTime, WsfLocalTrack& aLocalTrack, const WsfTrack& aNonLocalTrack);
318
335
342
343 WsfSimulation* GetSimulation() const;
344
345protected:
346 WsfLocalTrack* InitiateTrackP(double aSimTime, const WsfTrack& aTrack);
347
348 void AssessTrackQuality(double aSimTime, WsfTrack* aTrackPtr);
349
350 WsfLocalTrack* CorrelateTrack(double aSimTime, const WsfTrack& aNonLocalTrack);
351
352 void FuseTrack(double aSimTime, const WsfTrack& aNonLocalTrack, WsfLocalTrack& aLocalTrackPtr);
353
354 WsfLocalTrack* AddMeasurement(double aSimTime, const WsfTrack& aMeasurement);
355
356 WsfLocalTrack* GetPrototypeTrack() const { return mPrototypeTrackPtr; }
357
358 const WsfScenario& GetScenario() const { return mScenario; }
359
360private:
361 WsfTrackManager& operator=(const WsfTrackManager&) = delete; // not implemented
362
363 using AuxDataFusionRules = std::map<WsfStringId, AuxDataFusionRule>;
364
365 void DecorrelateLocalTrack(double aSimTime, WsfLocalTrack& aLocalTrack, const WsfTrackId& aRawTrack);
366
367 void CorrelateLocalTrack(double aSimTime, WsfLocalTrack& aLocalTrack, const WsfTrackId& aRawTrack);
368
369 void DeleteCorrelatedRawTracks(double aSimTime, WsfLocalTrack& aLocalTrack);
370
371 bool RemoveRawTrack(double aSimTime, const WsfTrackId& aTrackId);
372
373 bool CanUpdateAuxData(WsfStringId aNameId, WsfLocalTrack& aLocalTrack, const WsfTrack& aNonLocalTrack);
374
375 void ProcessAuxDataFusionInput(UtInput& aInput);
376
377 const WsfScenario& mScenario;
378
380 WsfPlatform* mPlatformPtr;
381
383 bool mIsInitialized;
384
386 bool mWillPurgeInactiveTracks;
387
389 bool mDropUncorrelatedTracks;
390
392 bool mRetainRawTracks;
393
395 bool mMaintainTrackHistory;
396
398 bool mIsFramed;
399 bool mFrameStarted;
400
402 bool mDebug;
403 bool mInitiateLocalTracks;
404
406 WsfLocalTrack* mPrototypeTrackPtr;
407
409 WsfLocalTrackList* mTrackList; // This is the 'master' or primary track list maintained.
410 WsfLocalTrackList* mFilteredRawTrackList;
411 WsfTrackList* mRawTrackList;
412
414 WsfTrackId mCurrentTargetId;
415
418 using InitialTrackList = std::vector<WsfTrack*>;
419 InitialTrackList mInitialTracks;
420 WsfTrackId mInitialTargetId;
421
424 WsfCorrelationStrategy* mCorrelationStrategyPtr;
425 WsfFusionStrategy* mFusionStrategyPtr;
426 WsfFilter* mPrototypeFilterPtr;
427
428 AuxDataFusionRules mAuxDataFusionRules;
429};
430
432
433#endif
@ cWSF_INITIALIZE_ORDER_TRACK_MANAGER
The track manager must be initialized prior to the mover.
Definition WsfComponentRoles.hpp:166
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_TRACK_MANAGER
A 'track manager' component (WsfTrackManager).
Definition WsfComponentRoles.hpp:107
WsfSimpleComponentT< WsfPlatformComponent > WsfSimplePlatformComponent
Definition WsfSimpleComponent.hpp:126
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
WsfTrackListT< WsfLocalTrack > WsfLocalTrackList
Definition WsfTrackList.hpp:89
WsfTrackListT< WsfTrack > WsfTrackList
Definition WsfTrackList.hpp:88
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComponent.hpp:39
virtual bool Initialize(double aSimTime)
Definition WsfComponent.cpp:45
virtual bool Initialize2(double aSimTime)
Definition WsfComponent.cpp:63
virtual bool ProcessInput(UtInput &aInput)
Definition WsfComponent.cpp:100
Definition WsfCorrelationStrategy.hpp:51
Implement a filter as an adapter.
Definition WsfFilter.hpp:24
Definition WsfFusionStrategy.hpp:52
Definition WsfLocalTrack.hpp:32
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
WsfSimpleComponentT & operator=(const WsfSimpleComponentT &aRhs)
Definition WsfSimpleComponent.hpp:84
int mRoles[2]
Definition WsfSimpleComponent.hpp:116
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfTrackId.hpp:33
Definition WsfTrackManager.hpp:62
UtCallbackListN< void(double, const WsfLocalTrack *)> LocalTrackDropped
Definition WsfTrackManager.hpp:310
WsfLocalTrack * GetPrototypeTrack() const
Definition WsfTrackManager.hpp:356
UtCallbackListN< void(double, const WsfLocalTrack *, const WsfTrackId &)> LocalTrackCorrelation
Definition WsfTrackManager.hpp:307
UtCallbackListN< void(double, const WsfLocalTrack *, const WsfTrack *)> LocalTrackInitiated
Definition WsfTrackManager.hpp:309
UtCallbackListN< void(double, WsfTrackManager *)> TrackManagerChanged
Definition WsfTrackManager.hpp:314
void SetDropUncorrelatedTracks(bool aDropUncorrelatedTracks)
Definition WsfTrackManager.hpp:110
UtCallbackListN< void(double, const WsfLocalTrack *)> CurrentTargetChanged
Definition WsfTrackManager.hpp:306
UtCallbackListN< void(double, const WsfTrack *)> RawTrackReceived
Definition WsfTrackManager.hpp:313
virtual WsfTrackManager * Clone() const
Definition WsfTrackManager.hpp:81
bool DebugEnabled() const
Return whether debug is enabled for this instance.
Definition WsfTrackManager.hpp:116
WsfTrack * GetRawTrackEntry(unsigned int aEntryIndex)
Definition WsfTrackManager.hpp:219
const WsfScenario & GetScenario() const
Definition WsfTrackManager.hpp:358
WsfLocalTrack * InitiateTrackSilent(double aSimTime, const WsfTrack &aRawTrack)
Definition WsfTrackManager.cpp:929
bool WillPurgeInactiveTracks() const
Will some external process perform period purging of inactive tracks.
Definition WsfTrackManager.hpp:141
const WsfTrackId GetCurrentTargetTrackId() const
Get the track ID for the current target of interest.
Definition WsfTrackManager.hpp:263
UtCallbackListN< void(double, const WsfLocalTrack *, const WsfTrack *)> LocalTrackUpdated
Definition WsfTrackManager.hpp:311
UtCallbackListN< void(double, const WsfTrack *)> RawTrackDropped
Definition WsfTrackManager.hpp:312
WsfCorrelationStrategy & GetCorrelationStrategy()
Return the correlation strategy used by this track manager.
Definition WsfTrackManager.hpp:93
int GetComponentInitializationOrder() const override
Definition WsfTrackManager.hpp:75
WsfLocalTrack * GetTrackEntry(unsigned int aEntryIndex)
Definition WsfTrackManager.hpp:206
WsfLocalTrackList & GetFilteredRawTrackList()
Definition WsfTrackManager.hpp:247
bool HasFilter()
Definition WsfTrackManager.hpp:254
const WsfFusionStrategy & GetFusionStrategy() const
Definition WsfTrackManager.hpp:98
WsfLocalTrackList & GetTrackList()
Definition WsfTrackManager.hpp:235
void SetWillPurgeInactiveTracks(bool aWillPurgeInactiveTracks)
Definition WsfTrackManager.hpp:135
WsfComponent * CloneComponent() const override
Definition WsfTrackManager.hpp:73
WsfFusionStrategy & GetFusionStrategy()
Return the fusion strategy used by this track manager.
Definition WsfTrackManager.hpp:97
WsfTrackList & GetRawTrackList()
Definition WsfTrackManager.hpp:239
WsfTrack * FindRawTrack(const WsfTrackId &aRawTrackId)
Definition WsfTrackManager.hpp:231
const WsfCorrelationStrategy & GetCorrelationStrategy() const
Definition WsfTrackManager.hpp:94
unsigned int GetTrackCount() const
Definition WsfTrackManager.hpp:200
UtCallbackListN< void(double, const WsfLocalTrack *)> CandidateTrackPromoted
Definition WsfTrackManager.hpp:305
unsigned int GetRawTrackCount()
Definition WsfTrackManager.hpp:212
void ComponentParentChanged(WsfPlatform *aPlatformPtr) override
Definition WsfTrackManager.hpp:76
void SetInitiateLocalTracks(bool aInitiateLocalTracks)
Definition WsfTrackManager.hpp:120
void * QueryInterface(int aRole) override
Definition WsfTrackManager.hpp:74
bool UpdateAuxData(double aSimTime, WsfLocalTrack &aLocalTrack, const WsfTrack &aNonLocalTrack)
Definition WsfTrackManager.cpp:1105
WsfPlatform * GetPlatform() const
Return the platform with which this track manager is associated.
Definition WsfTrackManager.hpp:90
AuxDataFusionRule
Definition WsfTrackManager.hpp:337
@ cADF_PRIVATE
Definition WsfTrackManager.hpp:338
@ cADF_PREFER_LOCAL
Definition WsfTrackManager.hpp:340
@ cADF_ONLY_LOCAL
Definition WsfTrackManager.hpp:339
WsfLocalTrack * FindTrack(const WsfTrackId &aLocalTrackId)
Definition WsfTrackManager.hpp:225
void SetDebug(bool aDebug)
Set whether this instance will print diagnostic message to standard output.
Definition WsfTrackManager.hpp:113
WsfTrackManager()=default
void ClearCurrentTarget()
Definition WsfTrackManager.hpp:270
UtCallbackListN< void(double, const WsfLocalTrack *, const WsfTrackId &)> LocalTrackDecorrelation
Definition WsfTrackManager.hpp:308
static std::unique_ptr< UtScriptClass > CreateScriptClass(const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
Definition WsfTrackManager.cpp:1728
const WsfLocalTrackList & GetFilteredRawTrackList() const
Return the filtered sensor track list (const version).
Definition WsfTrackManager.hpp:250
TrackStatusIndication
Definition WsfTrackManager.hpp:323
@ cCREATED
A local track has been created.
Definition WsfTrackManager.hpp:325
@ cNONE
There is no change, or the code is invalid.
Definition WsfTrackManager.hpp:324
@ cRAW_TRACK_RECEIVED
An unprocessed raw track was received.
Definition WsfTrackManager.hpp:330
@ cCURRENT_TARGET_CHANGED
The current target has changed.
Definition WsfTrackManager.hpp:331
@ cDECORRELATED
A local track has been decorrelated.
Definition WsfTrackManager.hpp:333
@ cDROPPED
A local track has been dropped.
Definition WsfTrackManager.hpp:327
@ cRAW_TRACK_DROPPED
A raw track has been dropped.
Definition WsfTrackManager.hpp:329
@ cCORRELATED
A local track has been correlated.
Definition WsfTrackManager.hpp:332
@ cUPDATED
A local track has been updated.
Definition WsfTrackManager.hpp:326
@ cCANDIDATE_TRACK_PROMOTED
A "candidate" local track has been promoted to a full local track.
Definition WsfTrackManager.hpp:328
WsfLocalTrackList & GetLocalTrackList()
Definition WsfTrackManager.hpp:243
WsfLocalTrack * InitiateAndCorrelateTrack(double aSimTime, const WsfTrack &aRawTrack)
Deprecated; use InitiateTrackSilent instead.
Definition WsfTrackManager.hpp:188
bool LocalTracksInitiated() const
Accessor to determine if local tracks are initiated (true by default).
Definition WsfTrackManager.hpp:123
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Copyrights Multiple, All Rights Reserved