WSF
WsfTargetPointOptions.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 2020 Infoscitex, a DCS 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 WSFTARGETPOINTOPTIONS_HPP
13#define WSFTARGETPOINTOPTIONS_HPP
14
15#include <sstream>
16#include <stdexcept>
17#include <type_traits>
18
19#include "UtCloneablePtr.hpp"
20#include "UtLog.hpp"
21class UtInput;
22#include "wsf_space_export.h"
23
24#include "UtOrbitalPropagatorBase.hpp"
25#include "WsfLibrationPoint.hpp"
31#include "WsfSimulation.hpp"
32#include "WsfTrackId.hpp"
33
34namespace wsf
35{
36namespace space
37{
38
47class WSF_SPACE_EXPORT TargetPointOptions
48{
49public:
50 explicit TargetPointOptions(const WsfTrackId& aLocalTrackId);
52 TargetPointOptions(const UtVec3d& aPosition, const UtVec3d& aVelocity);
53 TargetPointOptions(const TargetPointOptions& aOther) = default;
55
56 enum class Type
57 {
58 cPLATFORM,
59 cTRACK,
60 cLIBRATION_POINT,
61 cPROVIDED_TARGET,
62 cKINEMATIC_STATE,
63 };
64
65 bool ProcessInput(UtInput& aInput);
66
67 std::unique_ptr<OrbitalTargetPoint> InstantiatePoint(const UtCalendar& aEpoch) const;
68
70 bool HasPlatformTarget() const { return mTargetType == Type::cPLATFORM; }
71
73 bool HasTrackTarget() const { return mTargetType == Type::cTRACK; }
74
76 bool HasLibrationPointTarget() const { return mTargetType == Type::cLIBRATION_POINT; }
77
79 bool HasProvidedTarget() const { return mTargetType == Type::cPROVIDED_TARGET; }
80
82 bool HasKinematicStateTarget() const { return mTargetType == Type::cKINEMATIC_STATE; }
83
85 bool IsValid() const;
86
88 bool HasPositionOffset() const { return mHasPositionOffset; }
89
91 bool HasVelocityOffset() const { return mHasVelocityOffset; }
92
95
97 const UtVec3d& GetPositionOffset() const { return mPositionOffset; }
98
100 const UtVec3d& GetVelocityOffset() const { return mVelocityOffset; }
101
103 const std::string& GetPositionOffsetUnits() const { return mPositionOffsetUnits; }
104
106 const std::string& GetVelocityOffsetUnits() const { return mVelocityOffsetUnits; }
107
109 wsf::space::OrbitalReferenceFrame GetPositionOffsetFrame() const { return mPositionOffsetFrame; }
110
112 wsf::space::OrbitalReferenceFrame GetVelocityOffsetFrame() const { return mVelocityOffsetFrame; }
113
115 UtVec3d GetPositionOffsetInUnits() const;
116
118 UtVec3d GetVelocityOffsetInUnits() const;
119
121 const std::string& GetPlatformName() const { return mPlatformName; }
122
124 const WsfTrackId& GetLocalTrackId() const { return mLocalTrackId; }
125
128
130 wsf::space::LibrationPoint::Point GetLP_Point() const { return mLP_Point; }
131
133 const UtVec3d& GetKinematicStatePosition() const { return mKinematicStatePosition; }
134
137 UtVec3d GetKinematicStatePositionInUnits() const;
138
141 const std::string& GetKinematicStatePositionUnits() const { return mKinematicStatePositionUnits; }
142
145 const UtVec3d& GetKinematicStateVelocity() const { return mKinematicStateVelocity; }
146
149 UtVec3d GetKinematicStateVelocityInUnits() const;
150
153 const std::string& GetKinematicStateVelocityUnits() const { return mKinematicStateVelocityUnits; }
154
156 const UtOrbitalPropagatorBase* GetTargetPropagator() const { return mTargetPropagator.get(); }
157
166 void SetPositionOffset(const UtVec3d& aOffset,
167 const std::string& aOffsetUnits,
169
178 void SetVelocityOffset(const UtVec3d& aOffset,
179 const std::string& aOffsetUnits,
181
183 void ClearPositionOffset();
184
186 void ClearVelocityOffset();
187
189 bool HasOffsetTime() const { return mHasOffsetTime; }
190
193 const UtTimeValue& GetOffsetTime() const { return mOffsetTime; }
194
196 void SetOffsetTime(const UtTimeValue& aTimeOffset);
197
199 void ClearOffsetTime();
200
202 bool HasLagTime() const { return mHasLagTime; }
203
206 const UtTimeValue& GetLagTime() const { return mLagTime; }
207
209 void SetLagTime(const UtTimeValue& aLagTime);
210
212 void ClearLagTime();
213
215 void SetPlatformName(const std::string& aPlatformName);
216
218 void SetLocalTrackId(const WsfTrackId& aTrackId);
219
221 void SetLibrationPoint(wsf::space::LibrationPoint::System aSystem, wsf::space::LibrationPoint::Point aPoint);
222
224 void SetTargetPoint(std::unique_ptr<wsf::space::OrbitalTargetPoint> aTargetPoint);
225
227 void SetKinematicState(const UtVec3d& aPositionInertial,
228 const std::string& aPositionUnits,
229 const UtVec3d& aVelocityInertial,
230 const std::string& aVelocityUnits);
231
233 bool RequiresTargetPropagator() const { return mTargetType == Type::cPLATFORM || mTargetType == Type::cTRACK; }
234
236 void SetTargetPropagator(std::unique_ptr<UtOrbitalPropagatorBase> aTargetPropagatorPtr)
237 {
238 mTargetPropagator = std::move(aTargetPropagatorPtr);
239 }
240
243
245 void SetManeuveringPropagator(std::unique_ptr<UtOrbitalPropagatorBase> aManeuveringPropagatorPtr)
246 {
247 mManeuveringPropagator = std::move(aManeuveringPropagatorPtr);
248 }
249
251 bool ValidateParameterRanges(const std::string& aExecutingPlatformName, const std::string& aManeuverType) const;
252
254 static bool ValidOffsetFrame(wsf::space::OrbitalReferenceFrame aFrame);
255
256private:
257 std::unique_ptr<OrbitalTargetPoint> FormInitialTarget(const UtCalendar& aEpoch) const;
258 std::unique_ptr<OrbitalTargetPoint> FormOffsetTarget(std::unique_ptr<OrbitalTargetPoint> aPointPtr) const;
259 std::unique_ptr<OrbitalTargetPoint> FormKinematicOffsetTarget(std::unique_ptr<OrbitalTargetPoint> aTargetPtr) const;
260
261 Type mTargetType{Type::cTRACK};
262 UtVec3d mPositionOffset{};
263 std::string mPositionOffsetUnits{};
265 UtVec3d mVelocityOffset{};
266 std::string mVelocityOffsetUnits{};
268 UtTimeValue mOffsetTime{0.0};
269 UtTimeValue mLagTime{0.0};
270 std::string mPlatformName{};
271 WsfTrackId mLocalTrackId{};
274 UtVec3d mKinematicStatePosition{};
275 std::string mKinematicStatePositionUnits{};
276 UtVec3d mKinematicStateVelocity{};
277 std::string mKinematicStateVelocityUnits{};
278 mutable ut::CloneablePtr<wsf::space::OrbitalTargetPoint> mTargetPoint{nullptr};
279 mutable ut::CloneablePtr<UtOrbitalPropagatorBase> mTargetPropagator{nullptr};
280 ut::CloneablePtr<UtOrbitalPropagatorBase> mManeuveringPropagator{nullptr};
281 bool mHasPositionOffset{false};
282 bool mHasVelocityOffset{false};
283 bool mHasOffsetTime{false};
284 bool mHasLagTime{false};
285};
286
287} // namespace space
288} // namespace wsf
289
290#endif // WSFTARGETPOINTOPTIONS_HPP
Definition WsfTrackId.hpp:33
System
The supported primary-secondary body pairs.
Definition WsfLibrationPoint.hpp:44
@ cUNKNOWN
Definition WsfLibrationPoint.hpp:48
Point
Identifiers for the five libration points.
Definition WsfLibrationPoint.hpp:53
@ cUNKNOWN
Definition WsfLibrationPoint.hpp:59
Type
Definition WsfTargetPointOptions.hpp:57
@ cPLATFORM
Definition WsfTargetPointOptions.hpp:58
@ cTRACK
Definition WsfTargetPointOptions.hpp:59
@ cKINEMATIC_STATE
Definition WsfTargetPointOptions.hpp:62
@ cPROVIDED_TARGET
Definition WsfTargetPointOptions.hpp:61
@ cLIBRATION_POINT
Definition WsfTargetPointOptions.hpp:60
const UtVec3d & GetKinematicStateVelocity() const
Definition WsfTargetPointOptions.hpp:145
const std::string & GetPositionOffsetUnits() const
Return a string giving the units with which this object's position offset was configured.
Definition WsfTargetPointOptions.hpp:103
bool HasTrackTarget() const
Return if this object is configured with a track-based target.
Definition WsfTargetPointOptions.hpp:73
void SetTargetPropagator(std::unique_ptr< UtOrbitalPropagatorBase > aTargetPropagatorPtr)
Set the target propagator.
Definition WsfTargetPointOptions.hpp:236
bool HasKinematicStateTarget() const
Return if this object is configured with a certain kinematic state as the target.
Definition WsfTargetPointOptions.hpp:82
bool HasKinematicOffset() const
Return if this object is configured with a position or velocity offset.
Definition WsfTargetPointOptions.hpp:94
wsf::space::OrbitalReferenceFrame GetPositionOffsetFrame() const
Return the frame in which this object's position offset is specified.
Definition WsfTargetPointOptions.hpp:109
const UtVec3d & GetPositionOffset() const
Return the position offset in meters with which this object is configured.
Definition WsfTargetPointOptions.hpp:97
bool RequiresTargetPropagator() const
Return if these options imply a need for a targeting propagator to successfully instantiate the targe...
Definition WsfTargetPointOptions.hpp:233
TargetPointOptions(const TargetPointOptions &aOther)=default
void SetManeuveringPropagator(std::unique_ptr< UtOrbitalPropagatorBase > aManeuveringPropagatorPtr)
Set the maneuvering propagator.
Definition WsfTargetPointOptions.hpp:245
const UtTimeValue & GetLagTime() const
Definition WsfTargetPointOptions.hpp:206
bool HasPositionOffset() const
Return if this object is configured with a position offset.
Definition WsfTargetPointOptions.hpp:88
bool HasOffsetTime() const
Return if this object has an offset time configured.
Definition WsfTargetPointOptions.hpp:189
const std::string & GetKinematicStatePositionUnits() const
Definition WsfTargetPointOptions.hpp:141
bool HasVelocityOffset() const
Return if this object is configured with a velocity offset.
Definition WsfTargetPointOptions.hpp:91
const UtOrbitalPropagatorBase * GetTargetPropagator() const
Return the target propagator defined on this object.
Definition WsfTargetPointOptions.hpp:156
bool HasLibrationPointTarget() const
Return if this object is configured with a libration point target.
Definition WsfTargetPointOptions.hpp:76
const std::string & GetVelocityOffsetUnits() const
Return a string giving the units with which this object's velocity offset was configured.
Definition WsfTargetPointOptions.hpp:106
wsf::space::OrbitalReferenceFrame GetVelocityOffsetFrame() const
Return the frame in which this object's velocity offset is specified.
Definition WsfTargetPointOptions.hpp:112
wsf::space::LibrationPoint::System GetLP_System() const
Return the libration point system being targeted. Valid only when HasLibrationPointTarget returns tru...
Definition WsfTargetPointOptions.hpp:127
bool RequiresManeuveringPropagator() const
Return if these options imply a need for a maneuvering propagator to successfully instantiate the tar...
Definition WsfTargetPointOptions.hpp:242
const UtVec3d & GetKinematicStatePosition() const
Return the position in meters of the kinematic state being targeted. Valid only when HasKinematicStat...
Definition WsfTargetPointOptions.hpp:133
bool HasProvidedTarget() const
Return if this object is configured with a provided target point.
Definition WsfTargetPointOptions.hpp:79
const std::string & GetKinematicStateVelocityUnits() const
Definition WsfTargetPointOptions.hpp:153
TargetPointOptions(const WsfTrackId &aLocalTrackId)
Definition WsfTargetPointOptions.cpp:30
const UtTimeValue & GetOffsetTime() const
Definition WsfTargetPointOptions.hpp:193
wsf::space::LibrationPoint::Point GetLP_Point() const
Return the libration point being targeted. Valid only when HasLibrationPointTarget returns true.
Definition WsfTargetPointOptions.hpp:130
bool HasPlatformTarget() const
Return if this object is configured with a platform target.
Definition WsfTargetPointOptions.hpp:70
const WsfTrackId & GetLocalTrackId() const
Return the track id of the track being targeted. Valid only when HasTrackTarget returns true.
Definition WsfTargetPointOptions.hpp:124
const std::string & GetPlatformName() const
Return the name of the platform being targeted. Valid only when HasPlatformTarget returns true.
Definition WsfTargetPointOptions.hpp:121
bool HasLagTime() const
Return if this object has a lag time configured.
Definition WsfTargetPointOptions.hpp:202
const UtVec3d & GetVelocityOffset() const
Return the velocity offset in meters per second with which this object is configured.
Definition WsfTargetPointOptions.hpp:100
Definition WsfAtmosphere.cpp:23
OrbitalReferenceFrame
Definition WsfOrbitalReferenceFrame.hpp:25
@ cUNKNOWN
Definition WsfOrbitalReferenceFrame.hpp:29
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved