WSF
WsfPhysicalScanSensorScheduler.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 WSFPHYSICALSCANSENSORSCHEDULER_HPP
13#define WSFPHYSICALSCANSENSORSCHEDULER_HPP
14
15#include "wsf_export.h"
16
17#include <functional>
18#include <queue>
19#include <vector>
20
21#include "UtOptional.hpp"
23#include "WsfTrack.hpp"
24
26{
27 using SearchListSortFn = std::function<bool(size_t, size_t)>;
28
29public:
31 WsfPhysicalScanSensorScheduler(std::string aTypeName, bool aRandomizeInitialHeading, SearchListSortFn aSearchListSort);
32 ~WsfPhysicalScanSensorScheduler() override = default;
33
34 static std::unique_ptr<WsfSensorScheduler> ObjectFactory(const std::string& aTypeName);
35
36 WsfSensorScheduler* Clone() const override;
37
38 bool ProcessInput(UtInput& aInput) override;
39
40 bool Initialize(double aSimTime, WsfSensor* aSensorPtr, WsfSensorTracker* aTrackerPtr) override;
41
42 void ModeDeselected(double aSimTime, WsfStringId aModeNameId) override;
43
44 void ModeSelected(double aSimTime, WsfStringId aModeNameId) override;
45
46 void PlatformAdded(double aSimTime, WsfPlatform* aPlatformPtr) override;
47
48 void RemoveTarget(double aSimTime, size_t aTargetIndex) override;
49
50 bool SelectTarget(double aSimTime,
51 double& aNextSimTime,
52 size_t& aTargetIndex,
53 WsfTrackId& aRequestId,
54 WsfSensor::Settings& aSettings) override;
55
56 void TurnOff(double aSimTime) override;
57
58 void TurnOn(double aSimTime) override;
59
62 double GetInitialHeading() const { return mInitialHeading.value(); }
63
64protected:
67
69
70 void ResetSearchList();
71
73 std::vector<WsfSensorMode*> mModeList;
74
77
80 std::vector<size_t> mSearchModeIndex{0};
81
83 bool mSearchAllowed{false};
84
86 {
88 : SensorTarget(0, 0)
89 {
90 }
91
92 SensorTarget(size_t aTargetIndex, size_t aModeIndex)
93 : mTargetIndex(aTargetIndex)
94 , mModeIndex(aModeIndex)
95 {
96 }
97
99 size_t mModeIndex;
100 };
101
103 std::queue<SensorTarget> mSensorTargetQueue;
104
107
109 {
110 double mLastUpdate; // TODO - not sure this is required per mode (sensor level)
112 double mCurrentSensorHeading; // TODO - not sure this is required per mode (sensor level)
113 };
114
115 std::map<size_t, SearchModeData> mSearchModeDataMap;
116
120 double mLastUpdate{-1.0};
121
125 // double mCurrentSensorHeading;
126
127private:
128 std::string mTypeName{"physical_scan"};
129 ut::optional<double> mInitialHeading{ut::nullopt}; // If empty, initial heading will be randomized during initialization
130 SearchListSortFn mSearchListSort;
131};
132
133#endif
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfPhysicalScanSensorScheduler.hpp:26
~WsfPhysicalScanSensorScheduler() override=default
size_t mLastExplicitModeIndex
The last mode explicitly selected (i.e.: via WsfSensor::SelectMode).
Definition WsfPhysicalScanSensorScheduler.hpp:76
void ModeDeselected(double aSimTime, WsfStringId aModeNameId) override
Definition WsfPhysicalScanSensorScheduler.cpp:157
void ModeSelected(double aSimTime, WsfStringId aModeNameId) override
Definition WsfPhysicalScanSensorScheduler.cpp:168
bool Initialize(double aSimTime, WsfSensor *aSensorPtr, WsfSensorTracker *aTrackerPtr) override
Definition WsfPhysicalScanSensorScheduler.cpp:83
std::vector< size_t > mSearchModeIndex
Definition WsfPhysicalScanSensorScheduler.hpp:80
std::map< size_t, SearchModeData > mSearchModeDataMap
Definition WsfPhysicalScanSensorScheduler.hpp:115
bool SelectTarget(double aSimTime, double &aNextSimTime, size_t &aTargetIndex, WsfTrackId &aRequestId, WsfSensor::Settings &aSettings) override
Definition WsfPhysicalScanSensorScheduler.cpp:199
std::vector< WsfSensorMode * > mModeList
The pointers to the sensor modes, indexed by mode index.
Definition WsfPhysicalScanSensorScheduler.hpp:73
WsfPhysicalScanSensorScheduler & operator=(const WsfPhysicalScanSensorScheduler &)=delete
std::queue< SensorTarget > mSensorTargetQueue
A queue of platform indices representing targets in the sensor's current FOV angle.
Definition WsfPhysicalScanSensorScheduler.hpp:103
bool ProcessInput(UtInput &aInput) override
Definition WsfPhysicalScanSensorScheduler.cpp:70
void RemoveTarget(double aSimTime, size_t aTargetIndex) override
Definition WsfPhysicalScanSensorScheduler.cpp:189
double GetInitialHeading() const
Definition WsfPhysicalScanSensorScheduler.hpp:62
bool mSearchAllowed
'true' if search chances can be processed.
Definition WsfPhysicalScanSensorScheduler.hpp:83
void CheckSearchModeAvailability()
Check if the current mode selections provide for the ability to process search chances.
Definition WsfPhysicalScanSensorScheduler.cpp:365
void ResetSearchList()
Definition WsfPhysicalScanSensorScheduler.cpp:451
double mSensorUpdateInterval
The value of UpdateInterval defined by user at run-time in the input files.
Definition WsfPhysicalScanSensorScheduler.hpp:106
void TurnOn(double aSimTime) override
Definition WsfPhysicalScanSensorScheduler.cpp:333
static std::unique_ptr< WsfSensorScheduler > ObjectFactory(const std::string &aTypeName)
Definition WsfPhysicalScanSensorScheduler.cpp:55
double mLastUpdate
Definition WsfPhysicalScanSensorScheduler.hpp:120
void PlatformAdded(double aSimTime, WsfPlatform *aPlatformPtr) override
Definition WsfPhysicalScanSensorScheduler.cpp:175
void TurnOff(double aSimTime) override
Definition WsfPhysicalScanSensorScheduler.cpp:318
WsfSensorScheduler * Clone() const override
Definition WsfPhysicalScanSensorScheduler.cpp:65
Platforms represent a entity within the simulation.
Definition WsfPlatform.hpp:115
WsfSensorScheduler()
Definition WsfSensorScheduler.cpp:26
Definition WsfSensorTracker.hpp:75
Definition WsfSensor.hpp:133
Definition WsfSensor.hpp:92
Definition WsfTrackId.hpp:33
Definition WsfPhysicalScanSensorScheduler.hpp:109
double mLastUpdate
Definition WsfPhysicalScanSensorScheduler.hpp:110
double mSensorPieSize
Definition WsfPhysicalScanSensorScheduler.hpp:111
double mCurrentSensorHeading
The size of the angle centered around the sensor heading.
Definition WsfPhysicalScanSensorScheduler.hpp:112
SensorTarget(size_t aTargetIndex, size_t aModeIndex)
Definition WsfPhysicalScanSensorScheduler.hpp:92
size_t mModeIndex
Definition WsfPhysicalScanSensorScheduler.hpp:99
SensorTarget()
Definition WsfPhysicalScanSensorScheduler.hpp:87
size_t mTargetIndex
Definition WsfPhysicalScanSensorScheduler.hpp:98
Copyrights Multiple, All Rights Reserved