WSF
WsfTrackStateController.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 WSFTRACKSTATECONTROLLER_HPP
13#define WSFTRACKSTATECONTROLLER_HPP
14
15#include "wsf_export.h"
16
17#include <map>
18#include <string>
19#include <vector>
20
21#include "UtCallbackHolder.hpp"
22#include "UtGenericMappedList.hpp"
24class WsfMessage;
25class WsfPlatform;
26class WsfProcessor;
27#include "WsfRandomVariable.hpp"
31#include "WsfTrackId.hpp"
32#include "WsfTrackList.hpp"
33class WsfTrackManager;
34
46
48{
49public:
54
57
60
62
63
64 virtual bool Initialize(double aSimTime,
65 WsfProcessor* aProcessorPtr,
66 WsfTimeDelayQueue* aThinkerPtr,
67 WsfTrackManager* aTrackManagerPtr);
68 virtual bool ProcessInput(const WsfScenario& aScenario, UtInput& aInput);
69 virtual bool ProcessMessage(double aSimTime, const WsfMessage& aMessage);
70
71 bool IsTurnedOn() const { return mIsTurnedOn; }
72 virtual void TurnOff(double aSimTime);
73 virtual void TurnOn(double aSimTime);
74
75 void ConnectCallbacks();
76
77
79
82 void SetEvaluationInterval(double aEvaluationInterval) { mEvaluationInterval = aEvaluationInterval; }
83
86 void SetTransitionTime(double aTransitionTime) { mTransitionTime = aTransitionTime; }
87
88 virtual void EnterState(double aSimTime, const WsfTrackId& aTrackId, WsfStringId aNewStateName);
89
90 virtual void TracksInState(WsfStringId aStateName, std::vector<WsfLocalTrack*>& aTrackList);
91
92 virtual int TracksInState(WsfStringId aStateName);
93
94 virtual WsfStringId StateOfTrack(const WsfTrackId& aLocalTrackId);
95
96 WsfSimulation* GetSimulation() const;
97
99
100
101 virtual void EnterState(int aStateIndex);
102 virtual void ExitState(int aStateIndex);
103
104 virtual double EvaluationComplete(double aSimTime, const WsfTrackId& aLocalTrackId, unsigned int aEvaluationEpoch);
105
106 virtual void RequestEvaluation(double aSimTime, const WsfTrackId& aLocalTrackId, unsigned int aEvaluationEpoch);
107
109 {
110 public:
112 : mControllerPtr(nullptr)
113 {
114 }
115
117 : WsfScriptStateMachine(aContext)
118 , mControllerPtr(aControllerPtr)
119 {
120 }
122 : WsfScriptStateMachine(aSrc, aContext)
123 , mControllerPtr(aControllerPtr)
124 {
125 }
126 void EnterStateNotify(int aStateIndex) override { mControllerPtr->EnterState(aStateIndex); }
127 void ExitStateNotify(int aStateIndex) override { mControllerPtr->ExitState(aStateIndex); }
128
129 private:
130 WsfTrackStateController* mControllerPtr;
131 };
132
133
134protected:
135 void PreConstruct();
136
137 void DeleteTrack(double aSimTime, const WsfTrackId& aLocalTrackId);
138
139 void DiscoverTrack(double aSimTime, const WsfLocalTrack* aTrackPtr);
140
141 bool EvaluateTrack(double aSimTime, WsfLocalTrackStatus* aStatusPtr);
142
143 void SubmitRequest(double aSimTime, WsfLocalTrackStatus* aStatusPtr);
144
145 void CandidateTrackPromoted(double aSimTime, const WsfLocalTrack* aLocalTrackPtr);
146
147 void LocalTrackInitiated(double aSimTime, const WsfLocalTrack* aLocalTrackPtr, const WsfTrack* aRawTrackPtr);
148
149 void LocalTrackDropped(double aSimTime, const WsfLocalTrack* aLocalTrackPtr);
150
151 void TrackManagerChanged(double aSimTime, WsfTrackManager* aNewManagerPtr);
152
160 UtCallbackHolder mCallbacks;
162 UtMappedList<WsfLocalTrackStatus, WsfTrackId> mTrackStatusList;
163
166 std::map<WsfStringId, WsfRandomVariable> mTimeToEvalByName;
168 std::vector<WsfRandomVariable> mTimeToEvalByIndex;
169
172 std::map<WsfStringId, WsfRandomVariable> mEvalIntervalByName;
174 std::vector<WsfRandomVariable> mEvalIntervalByIndex;
175
177 std::vector<int> mTracksInState;
178
183
189
195
201
205};
206
207#endif
ut::script::Data UtScriptData
Definition WsfScriptContext.hpp:47
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
WsfTrackListT< WsfLocalTrack > WsfLocalTrackList
Definition WsfTrackList.hpp:89
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
An auxiliary class for storing decision-making data that pertains to a local track.
Definition WsfLocalTrackStatus.hpp:28
Definition WsfLocalTrack.hpp:32
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
Definition WsfProcessor.hpp:39
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfScriptContext.hpp:71
WsfScriptStateMachine()=default
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfTimeDelayQueue.hpp:48
Definition WsfTrackId.hpp:33
Definition WsfTrackManager.hpp:62
Definition WsfTrackStateController.hpp:109
TrackStateMachine()
Definition WsfTrackStateController.hpp:111
void EnterStateNotify(int aStateIndex) override
Definition WsfTrackStateController.hpp:126
void ExitStateNotify(int aStateIndex) override
Definition WsfTrackStateController.hpp:127
TrackStateMachine(WsfScriptContext &aContext, WsfTrackStateController *aControllerPtr)
Definition WsfTrackStateController.hpp:116
TrackStateMachine(const TrackStateMachine &aSrc, WsfScriptContext &aContext, WsfTrackStateController *aControllerPtr)
Definition WsfTrackStateController.hpp:121
bool mEvaluateCandidateTracks
Definition WsfTrackStateController.hpp:179
WsfProcessor * GetProcessor() const
Get the processor to which the controller is attached.
Definition WsfTrackStateController.hpp:59
UtScriptData * mStatusVarPtr
Definition WsfTrackStateController.hpp:203
bool mClearSignalOnStateExit
Definition WsfTrackStateController.hpp:181
WsfPlatform * mPlatformPtr
Definition WsfTrackStateController.hpp:153
WsfTimeDelayQueue * mThinkerPtr
Definition WsfTrackStateController.hpp:155
WsfLocalTrackList * mTrackListPtr
Definition WsfTrackStateController.hpp:161
std::vector< WsfRandomVariable > mTimeToEvalByIndex
The time it takes to evaluate a state by state index.
Definition WsfTrackStateController.hpp:168
double mTransitionTime
Definition WsfTrackStateController.hpp:194
UtScriptData * mTrackVarPtr
Definition WsfTrackStateController.hpp:204
std::vector< int > mTracksInState
The number of tracks in a state, indexed by state index.
Definition WsfTrackStateController.hpp:177
UtScript * mOnTrackDropScriptPtr
Definition WsfTrackStateController.hpp:157
WsfScriptContext * mContextPtr
Definition WsfTrackStateController.hpp:156
bool mShowStateTransitions
Definition WsfTrackStateController.hpp:180
WsfTrackManager * mTrackManagerPtr
Definition WsfTrackStateController.hpp:159
WsfLocalTrack * mEvaluationTrackPtr
Definition WsfTrackStateController.hpp:200
std::map< WsfStringId, WsfRandomVariable > mTimeToEvalByName
Definition WsfTrackStateController.hpp:166
bool IsTurnedOn() const
Definition WsfTrackStateController.hpp:71
WsfPlatform * GetPlatform() const
Get the platform to which the controller is attached.
Definition WsfTrackStateController.hpp:56
std::map< WsfStringId, WsfRandomVariable > mEvalIntervalByName
Definition WsfTrackStateController.hpp:172
TrackStateMachine * mStateMachinePtr
Definition WsfTrackStateController.hpp:158
UtScriptData * mSignalVarPtr
Definition WsfTrackStateController.hpp:202
std::vector< WsfRandomVariable > mEvalIntervalByIndex
Evaluation interval by state index.
Definition WsfTrackStateController.hpp:174
double mEvaluationSimTime
Definition WsfTrackStateController.hpp:198
bool mIsTurnedOn
Definition WsfTrackStateController.hpp:182
WsfProcessor * mProcessorPtr
Definition WsfTrackStateController.hpp:154
UtCallbackHolder mCallbacks
Definition WsfTrackStateController.hpp:160
UtMappedList< WsfLocalTrackStatus, WsfTrackId > mTrackStatusList
Definition WsfTrackStateController.hpp:162
double mEvaluationInterval
Definition WsfTrackStateController.hpp:188
WsfTrackId mEvaluationTrackId
Definition WsfTrackStateController.hpp:199
void SetEvaluationInterval(double aEvaluationInterval)
Definition WsfTrackStateController.hpp:82
void SetTransitionTime(double aTransitionTime)
Definition WsfTrackStateController.hpp:86
WsfTrackStateController()
Definition WsfTrackStateController.cpp:104
An object that represents an 'track' (perception) of something.
Definition WsfTrack.hpp:120
Copyrights Multiple, All Rights Reserved