WSF
WsfArticulatedPart.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 WSFARTICULATEDPART_HPP
13#define WSFARTICULATEDPART_HPP
14
15#include "UtCallback.hpp"
16#include "UtEntityPart.hpp"
17class UtInput;
18#include "wsf_export.h"
19
20#include "UtMath.hpp"
21#include "WsfComponent.hpp"
23class WsfPlatform;
24#include "WsfPlatformPart.hpp"
25class WsfScenario;
27
36{
37public:
38 static constexpr double cINFINITE_SLEW_RATE = 1.0E+12 * UtMath::cRAD_PER_DEG;
39 static constexpr double cALMOST_FULL_CIRCLE = 359.999 * UtMath::cRAD_PER_DEG;
40
44 {
45 cSLEW_FIXED = 0, //<! The part cannot be slewed
46 cSLEW_AZ = 1, //<! The part can be slewed only in azimuth
47 cSLEW_EL = 2, //<! The part can be slewed only in elevation
48 cSLEW_AZ_EL = 3 //<! The part can be slewed in both azimuth and elevation
49 };
50
52 {
53 cUNDEFINED = 0, //<! The slew direction is undefined
54 cPOSITIVE = 1, //<! Slew direction is through positive angle
55 cNEGATIVE = 2 //<! Slew direction is through negative angle
56 };
57
58 enum // slewState
59 {
60 cNOT_CUED = 0x0000,
61 cMIN_AZ = 0x0001,
62 cMAX_AZ = 0x0002,
63 cMIN_EL = 0x0004,
64 cMAX_EL = 0x0008,
67 cAT_LIMIT_MASK = 0x000F, // "and" (&) with this for any at limit state
68 cCUED_AZ = 0x0010,
69 cCUED_EL = 0x0020,
70 cCUED_AZ_EL = 0x0030, // = cCUED_AZ + cCUED_EL
71 cCUED_MASK = 0x0030 // "and" (&) with this for any cued state
72 };
73
80
81 WsfArticulatedPart(const WsfScenario& aScenario, int aPartType);
83 ~WsfArticulatedPart() override;
84
86
87 const int* GetComponentRoles() const override;
88 void* QueryInterface(int aRole) override;
89
90 const char* GetScriptClassName() const override;
91 bool Initialize(double aSimTime) override;
92 bool ProcessInput(UtInput& aInput) override;
93 void SetPlatform(WsfPlatform* aPlatformPtr) override;
95
96 virtual void UpdatePosition(double aSimTime);
97
99
100
103 void OnPlatformUpdated(double /* aSimTime */, WsfPlatform* /*aPlatformPtr*/) override { InvalidateTransform(); }
105
107
108
109 SlewMode GetSlewMode() const { return mSlewMode; }
110
112 double GetAzSlewRate() const { return mAzSlewRate; }
114 double GetElSlewRate() const { return mElSlewRate; }
115
117 double GetMaxAzSlewRate() const { return mMaxAzSlewRate; }
119 double GetMaxElSlewRate() const { return mMaxElSlewRate; }
120
122 double GetMinAzSlew() const { return mMinAzSlew; }
124 double GetMaxAzSlew() const { return mMaxAzSlew; }
126 double GetMinElSlew() const { return mMinElSlew; }
128 double GetMaxElSlew() const { return mMaxElSlew; }
129
131 int GetSlewState() const { return mSlewState; }
132
134 void SetSlewMode(SlewMode aSlewMode) { mSlewMode = aSlewMode; }
135
136 void SetSlewRates(double aAzSlewRate, double aElSlewRate);
137
139 void SetAzSlewLimits(double aMinAzSlew, double aMaxAzSlew)
140 {
141 mMinAzSlew = aMinAzSlew;
142 mMaxAzSlew = aMaxAzSlew;
143 }
144
146 void SetElSlewLimits(double aMinElSlew, double aMaxElSlew)
147 {
148 mMinElSlew = aMinElSlew;
149 mMaxElSlew = aMaxElSlew;
150 }
151
153 void SetAzimuthSlewDirection(SlewDirection aAzSlewDirection) { mAzSlewDirection = aAzSlewDirection; }
154
155 bool IsSlewing() const;
156
162 bool WithinSlewLimits(double aThisToTgtAz, double aThisToTgtEl) const
163 {
164 return ((aThisToTgtAz >= mMinAzSlew) && (aThisToTgtAz <= mMaxAzSlew) && (aThisToTgtEl >= mMinElSlew) &&
165 (aThisToTgtEl <= mMaxElSlew));
166 }
167
168
173
174
175 SlewMode GetCueMode() const { return mCueMode; }
176
178 double GetAzCueRate() const { return mAzCueRate; }
180 double GetElCueRate() const { return mElCueRate; }
182 double GetMinAzCue() const { return mMinAzCue; }
184 double GetMaxAzCue() const { return mMaxAzCue; }
186 double GetMinElCue() const { return mMinElCue; }
188 double GetMaxElCue() const { return mMaxElCue; }
189
191 void SetCueMode(SlewMode aCueMode) { mCueMode = aCueMode; }
192
194 void SetCueRates(double aAzCueRate, double aElCueRate)
195 {
196 mAzCueRate = aAzCueRate;
197 mElCueRate = aElCueRate;
198 }
199
201 void SetAzCueLimits(double aMinAzCue, double aMaxAzCue)
202 {
203 mMinAzCue = aMinAzCue;
204 mMaxAzCue = aMaxAzCue;
205 }
206
208 void SetElCueLimits(double aMinElCue, double aMaxElCue)
209 {
210 mMinElCue = aMinElCue;
211 mMaxElCue = aMaxElCue;
212 }
213
214
217
218 double GetRoll() const { return mRoll; }
219 void SetRoll(double aRoll);
220
221 double GetPitch() const { return mPitch; }
222 void SetPitch(double aPitch);
223
224 double GetYaw() const { return mYaw; }
225 void SetYaw(double aYaw);
226
227 double GetTilt() const { return mTilt; }
228 void SetTilt(double aTilt);
229
230 void GetCurrentOrientationECS(double& aYaw, double& aPitch, double& aRoll);
231
232 void GetLOS_UnitVectorWCS(double aUnitLOS_WCS[3]);
234
241
242 CueType GetCueType() const { return mCueType; }
243
245 bool IsCued() const { return mCueType != cCUED_TO_NOTHING; }
246
247 void ClearCueing();
248
249 bool GetActualCuedOrientation(double& aAzimuth, double& aElevation) const;
250
251 void GetCurrentCuedOrientation(double& aAzimuth, double& aElevation) const;
252
253 bool GetCuedLocationWCS(double aCuedLocationWCS[3]) const;
254
255 void SetCuedLocationWCS(const double aCuedLocationWCS[3]);
256
257 bool GetCuedOrientation(double& aAzimuth, double& aElevation) const;
258
259 void SetCuedOrientation(double aAzimuth, double aElevation);
260
261 void GetAbsoluteCuedOrientation(double& aAzimuth, double& aElevation, double aBaseNED[3]);
262
263 void ClearTransientCue();
264
266
267 bool GetTransientCuedLocationWCS(double aCuedLocationWCS[3]) const;
268
269 void SetTransientCuedLocationWCS(const double aCuedLocationWCS[3]);
271
273
275 void SetMaskingPatternState(WsfStringId aMaskingPatternStateId) { mMaskingPatternStateId = aMaskingPatternStateId; }
276 double GetMaskingPatternFactor(double aViewAzPCS, double aViewElPCS, const double aViewVecWCS[3]);
278
286
287 void SetIsPrivate(bool aIsPrivate) { mIsPrivate = aIsPrivate; }
288 bool IsPrivate() const { return mIsPrivate; }
290
294
295 void SetPositionRateECS(const double aDX, const double aDY, const double aDZ);
296
297 void GetCurrentPositionRateECS(double& aDX, double& aDY, double& aDZ) const;
298
299 double GetDX() const { return mDX; }
300 double GetDY() const { return mDY; }
301 double GetDZ() const { return mDZ; }
302
303 void EnableArticulationUpdates(double aSimTime, double aInterval);
304 void DisableArticulationUpdates(double aSimTime);
305
310 void SetArticulationUpdateInterval(double aUpdateInterval) { mArticulationUpdateInterval = aUpdateInterval; }
311
312 double GetArticulationUpdateInterval() const { return mArticulationUpdateInterval; }
313
316 unsigned int GetArticulationUpdateEventEpoch() const { return mArticulationUpdateEventEpoch; }
317
320 void IncrementArticulationUpdateEventEpoch() { ++mArticulationUpdateEventEpoch; }
321
323 bool ArticulationUpdateEventActive() const { return mArticulationUpdateEventActive; }
324
326 void SetArticulationUpdateEventActive(bool aUpdateEventActive)
327 {
328 mArticulationUpdateEventActive = aUpdateEventActive;
329 }
330
331
336 virtual double TimeToCue(double aDesiredAz, double aDesiredEl) const;
337
338 UtCallbackListN<void(double)> SlewComplete;
339
340protected:
341 bool FullCircle() const { return ((mMaxAzSlew - mMinAzSlew) >= cALMOST_FULL_CIRCLE); }
342
343 virtual double GetAzimuthRotationRate() const;
344 virtual double GetElevationRotationRate() const;
345
346 void SlewToOrientation(double aSimTime, double aDesiredAz, double aDesiredEl);
347
348 virtual void TimeToRotate(double& aDeltaAz,
349 double& aDeltaEl,
350 double& aAzRate,
351 double& aElRate,
352 double& aTimeToAz,
353 double& aTimeToEl) const;
354
355 void UpdateCuedOrientation(double aSimTime);
356
357 bool UpdateOrientation(double aSimTime);
358
360
365
367
368 double mYaw;
369 double mPitch;
370 double mRoll;
372
374
375 double mDX;
376 double mDY;
377 double mDZ;
379
381 double mTilt;
382
384
394
398
400
403 double mMinAzCue;
404 double mMaxAzCue;
405 double mMinElCue;
406 double mMaxElCue;
408
411
416
418 double mCuedAz;
419 double mCuedEl;
421
423
427
430
432
434
437
440
443
444private:
446 WsfArticulatedPart& operator=(const WsfArticulatedPart& aRhs) = delete;
447
452 double mArticulationUpdateInterval;
453 unsigned int mArticulationUpdateEventEpoch;
454 bool mArticulationUpdateEventActive;
455};
456
458
459#endif
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_ARTICULATED_PART
The component derives from WsfArticulatedPart.
Definition WsfComponentRoles.hpp:99
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfArticulatedPart.hpp:36
double GetAzCueRate() const
Get the azimuth cue rate.
Definition WsfArticulatedPart.hpp:178
WsfStringId mMaskingPatternName
Definition WsfArticulatedPart.hpp:362
double mMaxAzSlew
Definition WsfArticulatedPart.hpp:390
double mLastUpdateTime
The time when the x/y/z position was last updated.
Definition WsfArticulatedPart.hpp:433
void SetElSlewLimits(double aMinElSlew, double aMaxElSlew)
Set the elevation slew limits.
Definition WsfArticulatedPart.hpp:146
double GetDX() const
Definition WsfArticulatedPart.hpp:299
SlewDirection
Definition WsfArticulatedPart.hpp:52
@ cUNDEFINED
Definition WsfArticulatedPart.hpp:53
@ cNEGATIVE
Definition WsfArticulatedPart.hpp:55
@ cPOSITIVE
Definition WsfArticulatedPart.hpp:54
double mAzSlewRate
The slewing rates and limits of the device with respect to the device coordinate system.
Definition WsfArticulatedPart.hpp:385
double mRoll
Definition WsfArticulatedPart.hpp:370
double mMaxElCue
Definition WsfArticulatedPart.hpp:406
double mMaxElSlewRate
Definition WsfArticulatedPart.hpp:388
double mYaw
The orientation of the device coordinate system.
Definition WsfArticulatedPart.hpp:368
double mMaxElSlew
Definition WsfArticulatedPart.hpp:392
SlewMode
Definition WsfArticulatedPart.hpp:44
@ cSLEW_AZ_EL
Definition WsfArticulatedPart.hpp:48
@ cSLEW_FIXED
Definition WsfArticulatedPart.hpp:45
@ cSLEW_EL
Definition WsfArticulatedPart.hpp:47
@ cSLEW_AZ
Definition WsfArticulatedPart.hpp:46
double GetMinElCue() const
Gets the minimum elevation cue limit.
Definition WsfArticulatedPart.hpp:186
SlewDirection mAzSlewDirection
Definition WsfArticulatedPart.hpp:396
int GetSlewState() const
Get the slew limit state.
Definition WsfArticulatedPart.hpp:131
double GetAzSlewRate() const
Get the current azimuth slew rate.
Definition WsfArticulatedPart.hpp:112
bool mIsSlewing
'true' if the part is slewing to satisfy a cueing request.
Definition WsfArticulatedPart.hpp:439
double GetDZ() const
Definition WsfArticulatedPart.hpp:301
unsigned int GetArticulationUpdateEventEpoch() const
Definition WsfArticulatedPart.hpp:316
void SetCueMode(SlewMode aCueMode)
Set the allowed cueing mode.
Definition WsfArticulatedPart.hpp:191
double mPitch
Definition WsfArticulatedPart.hpp:369
bool ArticulationUpdateEventActive() const
Is an 'Update' event active?
Definition WsfArticulatedPart.hpp:323
bool IsPrivate() const
Definition WsfArticulatedPart.hpp:288
bool TransientCueActive() const
Definition WsfArticulatedPart.hpp:265
double mDZ
Definition WsfArticulatedPart.hpp:377
SlewMode mCueMode
The directions (az and/or el) in which cueing can be performed.
Definition WsfArticulatedPart.hpp:410
int mSlewState
Definition WsfArticulatedPart.hpp:397
double mElSlewRate
Definition WsfArticulatedPart.hpp:386
void SetAzimuthSlewDirection(SlewDirection aAzSlewDirection)
Set the azimuth slew direction.
Definition WsfArticulatedPart.hpp:153
double mMaxAzCue
Definition WsfArticulatedPart.hpp:404
double GetDY() const
Definition WsfArticulatedPart.hpp:300
double GetTilt() const
Definition WsfArticulatedPart.hpp:227
double mTilt
The tilt angle above below the scan plane.
Definition WsfArticulatedPart.hpp:381
double mAzCueRate
The cueing rates and limits of the device with respect to the device coordinate system.
Definition WsfArticulatedPart.hpp:401
void SetCueRates(double aAzCueRate, double aElCueRate)
Set the angular cueing rates.
Definition WsfArticulatedPart.hpp:194
double mCuedAz
The cued azimuth if mCueType == cCUED_TO_ANGLE.
Definition WsfArticulatedPart.hpp:418
double GetMinAzSlew() const
Gets the minimum azimuth slew limit.
Definition WsfArticulatedPart.hpp:122
void SetArticulationUpdateEventActive(bool aUpdateEventActive)
Indicate if the 'Update' event is active.
Definition WsfArticulatedPart.hpp:326
double GetMaxElSlewRate() const
Get the maximum allowable elevation slew rate.
Definition WsfArticulatedPart.hpp:119
double mMinElSlew
Definition WsfArticulatedPart.hpp:391
WsfStringId mMaskingPatternStateId
Definition WsfArticulatedPart.hpp:363
double GetPitch() const
Definition WsfArticulatedPart.hpp:221
void SetAzSlewLimits(double aMinAzSlew, double aMaxAzSlew)
Set the azimuth slew limits.
Definition WsfArticulatedPart.hpp:139
static constexpr double cALMOST_FULL_CIRCLE
Definition WsfArticulatedPart.hpp:39
bool mSlewMethodCoordinated
'true' if slcue rates are dynamically adjusted so the target angles are reached simultaneously.
Definition WsfArticulatedPart.hpp:436
double GetRoll() const
Definition WsfArticulatedPart.hpp:218
@ cMIN_AZ
Definition WsfArticulatedPart.hpp:61
@ cNOT_CUED
Definition WsfArticulatedPart.hpp:60
@ cAT_LIMIT_AZ_MASK
Definition WsfArticulatedPart.hpp:65
@ cMAX_EL
Definition WsfArticulatedPart.hpp:64
@ cMIN_EL
Definition WsfArticulatedPart.hpp:63
@ cCUED_EL
Definition WsfArticulatedPart.hpp:69
@ cCUED_AZ_EL
Definition WsfArticulatedPart.hpp:70
@ cCUED_MASK
Definition WsfArticulatedPart.hpp:71
@ cAT_LIMIT_EL_MASK
Definition WsfArticulatedPart.hpp:66
@ cMAX_AZ
Definition WsfArticulatedPart.hpp:62
@ cCUED_AZ
Definition WsfArticulatedPart.hpp:68
@ cAT_LIMIT_MASK
Definition WsfArticulatedPart.hpp:67
WsfMaskingPattern * mMaskingPatternPtr
The masking factor.
Definition WsfArticulatedPart.hpp:361
void IncrementArticulationUpdateEventEpoch()
Definition WsfArticulatedPart.hpp:320
SlewMode GetSlewMode() const
Get the allowed slewing mode.
Definition WsfArticulatedPart.hpp:109
void SetSlewMode(SlewMode aSlewMode)
Set the allowed slewing mode.
Definition WsfArticulatedPart.hpp:134
double mMaxAzSlewRate
Definition WsfArticulatedPart.hpp:387
void SetAzCueLimits(double aMinAzCue, double aMaxAzCue)
Set the azimuth cueing limits.
Definition WsfArticulatedPart.hpp:201
SlewMode mSlewMode
Definition WsfArticulatedPart.hpp:395
bool FullCircle() const
Definition WsfArticulatedPart.hpp:341
void SetArticulationUpdateInterval(double aUpdateInterval)
Definition WsfArticulatedPart.hpp:310
bool WithinSlewLimits(double aThisToTgtAz, double aThisToTgtEl) const
Definition WsfArticulatedPart.hpp:162
double mDY
Definition WsfArticulatedPart.hpp:376
double mLastAzElUpdateTime
The time when the current az/el were last updated.
Definition WsfArticulatedPart.hpp:431
CueType GetCueType() const
Definition WsfArticulatedPart.hpp:242
SlewMode GetCueMode() const
Get the allowed cueing mode.
Definition WsfArticulatedPart.hpp:175
double mMinAzCue
Definition WsfArticulatedPart.hpp:403
CueType
Definition WsfArticulatedPart.hpp:75
@ cCUED_TO_LOCATION
The part is cued to a specified location.
Definition WsfArticulatedPart.hpp:77
@ cCUED_TO_NOTHING
No cue has been specified.
Definition WsfArticulatedPart.hpp:76
@ cCUED_TO_ANGLE
The part is cued to specified az/el angles.
Definition WsfArticulatedPart.hpp:78
bool mTransientCueActive
'true' if the transient cue is defined
Definition WsfArticulatedPart.hpp:415
double GetMaxAzSlewRate() const
Get the maximum allowable azimuth slew rate.
Definition WsfArticulatedPart.hpp:117
bool IsCued() const
Get the cued status.
Definition WsfArticulatedPart.hpp:245
double GetYaw() const
Definition WsfArticulatedPart.hpp:224
double mDX
The velocity of the part.
Definition WsfArticulatedPart.hpp:375
double mMinElCue
Definition WsfArticulatedPart.hpp:405
double GetArticulationUpdateInterval() const
Definition WsfArticulatedPart.hpp:312
WsfArticulatedPart(const WsfScenario &aScenario, int aPartType)
Definition WsfArticulatedPart.cpp:29
double GetMaxAzSlew() const
Gets the maximum azimuth slew limit.
Definition WsfArticulatedPart.hpp:124
CueType mCueType
Definition WsfArticulatedPart.hpp:414
double mElCueRate
Definition WsfArticulatedPart.hpp:402
double GetMaxElSlew() const
Gets the maximum elevation slew limit.
Definition WsfArticulatedPart.hpp:128
double GetElCueRate() const
Get the elevation cue rate.
Definition WsfArticulatedPart.hpp:180
double mActualCuedAz
The actual cued location, subject to the slewing limits.
Definition WsfArticulatedPart.hpp:424
double GetMinElSlew() const
Gets the minimum elevation slew limit.
Definition WsfArticulatedPart.hpp:126
static constexpr double cINFINITE_SLEW_RATE
Definition WsfArticulatedPart.hpp:38
double GetMinAzCue() const
Gets the minimum azimuth cue limit.
Definition WsfArticulatedPart.hpp:182
double GetMaxElCue() const
Gets the maximum elevation cue limit.
Definition WsfArticulatedPart.hpp:188
void SetMaskingPatternState(WsfStringId aMaskingPatternStateId)
Definition WsfArticulatedPart.hpp:275
double mCuedEl
The cued elevation if mCueType == cCUED_TO_ANGLE.
Definition WsfArticulatedPart.hpp:419
double mCurrentEl
Definition WsfArticulatedPart.hpp:429
void SetElCueLimits(double aMinElCue, double aMaxElCue)
Set the elevation cueing limits.
Definition WsfArticulatedPart.hpp:208
double GetElSlewRate() const
Get the current elevation slew rate.
Definition WsfArticulatedPart.hpp:114
bool mIsPrivate
'true' if the part is considered 'private' and not to visible to external simulations.
Definition WsfArticulatedPart.hpp:442
UtCallbackListN< void(double)> SlewComplete
Definition WsfArticulatedPart.hpp:338
double GetMaxAzCue() const
Gets the maximum azimuth cue limit.
Definition WsfArticulatedPart.hpp:184
void SetIsPrivate(bool aIsPrivate)
Definition WsfArticulatedPart.hpp:287
double mMinAzSlew
Definition WsfArticulatedPart.hpp:389
double mActualCuedEl
Definition WsfArticulatedPart.hpp:425
void OnPlatformUpdated(double, WsfPlatform *) override
Definition WsfArticulatedPart.hpp:103
double mTransientCuedLocationWCS[3]
The transient cue, if mTransientCueActive is true.
Definition WsfArticulatedPart.hpp:420
double mCurrentAz
Definition WsfArticulatedPart.hpp:428
double mCuedLocationWCS[3]
The cued location if mCueType is cCUED_TO_LOCATION.
Definition WsfArticulatedPart.hpp:417
WsfStringId GetMaskingPatternState() const
Definition WsfArticulatedPart.hpp:274
Definition WsfMaskingPattern.hpp:35
const char * GetScriptClassName() const override
Definition WsfPlatformPart.cpp:683
void * QueryInterface(int aRole) override
Definition WsfPlatformPart.cpp:143
WsfPlatformPart & operator=(const WsfPlatformPart &aRhs)=delete
WsfPlatformPart(const WsfScenario &aScenario, int aPartType)
Definition WsfPlatformPart.cpp:62
bool Initialize(double aSimTime) override
Definition WsfPlatformPart.cpp:276
const int * GetComponentRoles() const override
Definition WsfPlatformPart.cpp:137
virtual void SetPlatform(WsfPlatform *aPlatformPtr)
Definition WsfPlatformPart.hpp:113
bool ProcessInput(UtInput &aInput) override
Definition WsfPlatformPart.cpp:347
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
Definition WsfSinglePlatformObserver.hpp:30
Copyrights Multiple, All Rights Reserved