99 int GetEventId(
const std::string& aEventName)
const;
105 void SendImmediate(
double aSimTime,
bool aExternal, std::unique_ptr<WsfEventPipe::MsgBase> aMessagePtr);
108 void SendDependent(
double aSimTime,
const WsfPlatform& aPlatform, std::unique_ptr<WsfEventPipe::MsgBase> aMessagePtr);
119 static std::unique_ptr<UtScriptClass> CreateScriptClass(
const std::string& aClassName, UtScriptTypes* aScriptTypesPtr);
124 static void Pack(WsfEventPipe::Track_Id& aData,
const WsfTrackId& aId);
125 static void Pack(WsfEventPipe::Covariance& aData,
const UtCovariance& aCovariance);
126 static void PackTrack(WsfEventPipe::Track& aTrackData,
const WsfTrack& aTrack);
129 static void Pack(WsfEventPipe::EM_Interaction& aData,
const WsfEM_Interaction& aInteraction);
131 void UpdateArticulation(
double aSimTime,
134 double aAdditionalAz = 0.0,
135 double aAdditionalEl = 0.0);
137 static unsigned int Platform(
const WsfPlatform& aPlatform);
138 static unsigned int Platform(
size_t aPlatformIndex);
140 void Bookmark(
double aSimTime,
const std::string& aMsgType,
const std::string& aMsgText);
143 WSF_DEPRECATED
void Record(
double aSimTime,
WsfPlatform* aPlatform,
const std::string& aKey,
double aValue);
145 void RecordDouble(
const WsfPlatform& aPlatform,
const std::string& aKey,
double aValue);
147 void RecordInt(
const WsfPlatform& aPlatform,
const std::string& aKey,
int aValue);
149 void RecordBool(
const WsfPlatform& aPlatform,
const std::string& aKey,
bool aValue);
151 void RecordString(
const WsfPlatform& aPlatform,
const std::string& aKey,
const std::string& aValue);
159 double HandleScheduledEntityStateRequest(
double aTime,
size_t aPlatformId);
161 void UpdatePartArticulation(
double aSimTime,
size_t aPlatformId,
WsfStringId& aPartNameId);
165 void PopulateAdvancedBehaviorTreeNodeList(WsfEventPipe::BehaviorTreeNodeList& aList,
168 void PopulateAdvancedBehaviorTreeStateLists(WsfEventPipe::BehaviorTreeNodeExecList& aExecList,
169 WsfEventPipe::BehaviorTreeBlackboardDataList& aBlackboardList,
173 void StateMachineState(
double aSimTime,
175 const int aOldStateIndex,
176 const int aNewStateIndex);
184 void SendEntityState(
double aSimTime,
WsfPlatform& aPlatform,
bool aForce =
false);
187 void SendAllPlatformAuxData(
double aSimTime);
190 void SendPlatformAuxData(
double aSimTime,
const WsfPlatform* aPlatform);
206 double MoverUpdateInterval(
const WsfMover& aMover)
const;
208 void DrawUpdate(
const std::string& aTarget,
const std::string& aLayer,
const WsfDraw::DrawEventList& aDrawList);
210 void Comment(
double aSimTime,
WsfPlatform* aPlatformPtr,
const std::string& aComment);
214 void LocalTrackCorrelation(
double aSimTime,
219 void LocalTrackDecorrelation(
double aSimTime,
226 void LocalTrackInitiated(
double aSimTime,
233 void MessageReceived(
double aSimTime,
243 void MoverChangedOnPlatform(
WsfPlatform* aPlatformPtr);
245 void MoverUpdated(
double aSimTime,
WsfMover* aMover);
247 void PlatformAdded(
double aSimTime,
WsfPlatform* aPlatformPtr);
251 void PlatformDeleted(
double aSimTime,
WsfPlatform* aPlatformPtr);
253 void PlatformInitialized(
double aSimTime,
WsfPlatform* aPlatformPtr);
255 void PlatformBroken(
double aSimTime,
WsfPlatform* aPlatformPtr);
257 void PublishAntennaData(WsfEventPipe::BeamDefinition& aBeamDef,
262 const double aBeamTilt)
const;
266 void RegisterZone(
WsfZone* aZonePtr,
267 WsfEventPipe::CircularZoneList& aCircularList,
268 WsfEventPipe::EllipticalZoneList& aEllipticalList,
269 WsfEventPipe::SphericalZoneList& aSphericalList,
270 WsfEventPipe::PolygonalZoneList& aPolygonalList,
271 std::unique_ptr<WsfEventPipe::MsgZoneSet>& aMsgPtr);
273 void RouteChanged(
WsfMover* aMoverPtr);
283 void SensorTrackDropped(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
285 void SensorTrackInitiated(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
287 void SensorTrackUpdated(
double aSimTime,
WsfSensor* aSensorPtr,
const WsfTrack* aTrackPtr);
289 void SensorTurnedOff(
double aSimTime,
WsfSensor* aSensorPtr);
291 void SensorTurnedOn(
double aSimTime,
WsfSensor* aSensorPtr);
293 void SimulationStarting();
295 void UpdateFilters();
297 void VisualPartTurnedOn(
double aSimTime,
WsfVisualPart* aPartPtr);
299 void VisualPartTurnedOff(
double aSimTime,
WsfVisualPart* aPartPtr);
303 void SendScenarioData();
305 static void PackDrawVertex(WsfEventPipe::MsgDrawCommand_Vertex& aMsg,
const WsfDraw::VertexObject& aVertex);
307 bool RequiresEntityStateUpdate(
double aSimTime,
unsigned int aPlatIdx,
const UtVec3d& aLocV,
const UtQuaternion& aOriV)
const;
309 struct DisBeamAddress
311 DisBeamAddress(
unsigned int aPlatformId,
unsigned int aSystemId,
unsigned int aBeamNumber)
312 : mPlatformId(aPlatformId)
313 , mSystemId(aSystemId)
314 , mBeamNumber(aBeamNumber)
317 bool operator<(
const DisBeamAddress& aRHS)
const
319 if (mPlatformId < aRHS.mPlatformId)
323 else if (mPlatformId > aRHS.mPlatformId)
327 else if (mSystemId < aRHS.mSystemId)
331 else if (mSystemId > aRHS.mSystemId)
335 else if (mBeamNumber < aRHS.mBeamNumber)
344 unsigned int mPlatformId;
345 unsigned int mSystemId;
346 unsigned int mBeamNumber;
349 void UpdateDisTrackJamSet(
const DisBeamAddress& aAddress,
350 const std::set<DisEntityId>& aNewList,
351 std::set<DisEntityId>& aAddSet,
352 std::set<DisEntityId>& aRemSet);
354 const WsfEventPipeOptions& GetPlatformDetailLevel(
const WsfPlatform& aPlatform);
356 void AddZoneSet(
double aSimTime, WsfZone* aZonePtr);
357 void SendZoneMsg(
bool aGlobal, WsfPlatform* aPlatform,
double aSimTime, std::unique_ptr<WsfEventPipe::MsgBase> aMsg);
358 void SendZoneDefMessage(WsfZoneDefinition* aZoneDefPtr,
double aSimTime);
361 const WsfEventPipeExtension& mExtension;
363 UtCallbackHolder mCallbacks;
365 UtPackMessageStdStreamO* mStreamPtr;
366 std::unique_ptr<std::ofstream> mFileStreamPtr;
367 UtPackSerializer* mSerializerPtr;
368 UtPackSchema* mSchemaPtr;
369 wsf::eventpipe::FileWriterWorker* mWriteThreadPtr;
373 const WsfEventPipeInput mInput;
374 wsf::eventpipe::EventIds mEventIds;
377 using FilterMap = std::unordered_map<std::string, WsfEventPipeOptions>;
382 WsfEventPipeOptionsCriteria mCritiera;
383 unsigned int mDetailSetting;
387 struct DetailSettingData
390 : mActivePlatformCount(0)
393 DetailSettingData(
const WsfEventPipeOptions& aOptions)
395 , mActivePlatformCount(0)
398 WsfEventPipeOptions mOptions;
400 int mActivePlatformCount;
403 class ArticulatedPartId
406 ArticulatedPartId(
int aOwner, std::string& aName,
int aType)
412 virtual ~ArticulatedPartId() =
default;
414 bool operator<(
const ArticulatedPartId& aRHS)
const
416 return (mOwner == aRHS.mOwner) ? (mName == aRHS.mName) ? (mType < aRHS.mType) : (mName < aRHS.mName) :
417 (mOwner < aRHS.mOwner);
426 struct ArticulationData
428 ArticulationData() =
default;
429 ArticulationData(
const UtVec3d& aPos,
const UtVec3d& aSlew,
const UtVec3d& aCue)
435 bool operator!=(
const ArticulationData& aRHS)
const noexcept
437 return (mPosition != aRHS.mPosition) || (mSlew != aRHS.mSlew) || (mCue != aRHS.mCue);
444 template<
typename OBSERVER>
445 void ConnectPartStatusCallback(OBSERVER& aObserver, WsfEventPipe::PartType::Value aType)
449 .Connect([
this, aType](
double aSimTime, WsfPlatformPart* aPart) { SendPartStatus(aSimTime, aPart, aType); });
452 std::map<ArticulatedPartId, ArticulationData> mArticulationTracker;
454 std::vector<unsigned int> mPlatformIndexToSettingIndex;
455 std::vector<Filter> mFilters;
456 std::vector<DetailSettingData> mDetailSettingsArray;
457 std::vector<WsfEventPipeLogger*> mLoggers;
458 WsfEventPipeOptions mCombinedOptions;
459 std::set<const WsfAuxDataEnabled*> mAuxDataAccessed;
460 std::mutex mAuxDataAccessedMutex;
462 UtCallbackHolder mDetectionChangeCallbacks;
463 UtCallbackHolder mLocalTrackEventCallbacks;
464 UtCallbackHolder mLocalTrackUpdatedCallbacks;
465 UtCallbackHolder mEntityStateCallbacks;
466 UtCallbackHolder mBaseCallbacks;
467 UtCallbackHolder mDetectionAttemptCallbacks;
468 UtCallbackHolder mDrawCallbacks;
469 UtCallbackHolder mMessageReceivedCallback;
470 UtCallbackHolder mMessageHopCallback;
471 UtCallbackHolder mMessageTransmittedCallback;
472 UtCallbackHolder mCommentCallback;
473 UtCallbackHolder mBehaviorToolCallbacks;
474 UtCallbackHolder mAuxDataCallbacks;
475 UtCallbackHolder mRouteCallbacks;
477 bool mTrackEventsFiltered;
478 bool mTrackUpdatesFiltered;
479 unsigned int mFilteredFlags;
481 std::string mOutputFileName;
483 using SensorModeIdentifier =
484 std::pair<unsigned int, std::string>;
485 std::set<SensorModeIdentifier> mModeSet;
487 std::map<unsigned int, wsf::eventpipe::PartUpdateEvent*> mPartUpdateEvents;
488 std::map<size_t, std::vector<std::unique_ptr<WsfEventPipe::MsgBase>>> mCachedMessages;
494#ifdef DETECTION_CHANGE_WORKAROUND_NECESSARY
495 std::map<std::pair<size_t, std::string>, std::map<size_t, int>> mDetectionList;
502 MessageId(
size_t aSerialNumber, std::string aSrcAddr, std::string aDstAddr)
503 : mSerialNumber(aSerialNumber)
508 bool operator<(
const MessageId& aRHS)
const;
511 size_t mSerialNumber;
512 std::string mSrcAddr;
513 std::string mDstAddr;
516 std::map<MessageId, std::pair<size_t, std::string>> mMessageHopTracker;
518 std::map<std::string, size_t> mExternalNameMap;
519 static std::map<size_t, size_t> mExternalIdLookup;
521 std::map<DisBeamAddress, std::set<DisEntityId>> mCurrentTrackJamList;
523 class EntityStateData
526 EntityStateData(
double aSimTime,
527 const UtVec3d& aPosition,
528 const UtVec3d& aVelocity,
529 const UtVec3d& aAcceleration,
530 const UtQuaternion& aOrientation)
532 , mPosition(aPosition)
533 , mVelocity(aVelocity)
534 , mAcceleration(aAcceleration)
535 , mQuaternion(aOrientation)
539 UtVec3d Extrapolate(
double aSimTime)
const;
540 const UtQuaternion& Orientation()
const {
return mQuaternion; }
541 double Time()
const {
return mSimTime; }
544 double mSimTime{0.0};
547 UtVec3d mAcceleration;
548 UtQuaternion mQuaternion;
551 std::map<unsigned int, EntityStateData> mEntityStateData;