WSF
WsfSixDOF_Utils.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 WSFSIXDOFUTILS_HPP
13#define WSFSIXDOFUTILS_HPP
14
15#include "wsf_six_dof_export.h"
16
17#include <memory>
18#include <string>
19#include <vector>
20
21#include "UtVec3dX.hpp"
22#include "WsfSixDOF_PID.hpp"
23
24namespace wsf
25{
26namespace six_dof
27{
28namespace utils
29{
36
37WSF_SIX_DOF_EXPORT const SinglePidValueData& GetSinglePidData(Pid::Type aPidType,
38 const AutopilotPidGroupValueData& aPidValues);
39
40std::string OutputDoubleString(double aValue, int aWidth, int aPrecision);
41
42WSF_SIX_DOF_EXPORT int64_t TimeToTime(double aSimTime_sec);
43WSF_SIX_DOF_EXPORT double TimeToTime(int64_t aSimTime_nanosec);
44
45WSF_SIX_DOF_EXPORT double NextGuessFromFalsePosition(double aInputA, double aOutputA, double aInputB, double aOutputB);
46
47WSF_SIX_DOF_EXPORT void UpdateFalsePositionBounds(double& aInputA,
48 double& aOutputA,
49 double& aInputB,
50 double& aOutputB,
51 double aInputC,
52 double aOutputC);
53
54// For reference, these are the "natural" timestep sizes for the mover types
55static constexpr int64_t cDT_RIGID_BODY_NANOSEC = 10000000;
56static constexpr int64_t cDT_POINT_MASS_NANOSEC = 50000000;
57static constexpr double cDT_RIGID_BODY_SEC = (0.000000001 * static_cast<double>(cDT_RIGID_BODY_NANOSEC));
58static constexpr double cDT_POINT_MASS_SEC = (0.000000001 * static_cast<double>(cDT_POINT_MASS_NANOSEC));
59
60// Any delta-T less than or equal to the epsilon value is treated as if it were zero
61static constexpr int64_t cEPSILON_SIMTIME_NANOSEC = 100;
62static constexpr double cEPSILON_SIMTIME_SEC = (0.000000001 * static_cast<double>(cEPSILON_SIMTIME_NANOSEC));
63
64// The gravitational acceleration value used to translate between gs and acceleration
65static constexpr double cREFERENCE_GRAV_ACCEL_MPS2 = 9.80665;
66
67WSF_SIX_DOF_EXPORT void CalcUnitVectors(const UtDCM& aDCM, UtVec3dX& aUnitVecX, UtVec3dX& aUnitVecY, UtVec3dX& aUnitVecZ);
68
69WSF_SIX_DOF_EXPORT void
70CalcLocalNEDVectors(const UtVec3dX& aPos, UtVec3dX& aLocalNorth, UtVec3dX& aLocalEast, UtVec3dX& aLocalDown);
71
72WSF_SIX_DOF_EXPORT void CalcLocalAngles(const UtVec3dX& aLocalNorth,
73 const UtVec3dX& aLocalEast,
74 const UtVec3dX& aLocalDown,
75 const UtVec3dX& aUnitVecX,
76 const UtVec3dX& aUnitVecZ,
77 double& aLocalYaw_rad,
78 double& aLocalPitch_rad,
79 double& aLocalRoll_rad);
80
81WSF_SIX_DOF_EXPORT void InertialToBodyRel(const UtDCM& aMatrix, const UtVec3dX& aInertial, UtVec3dX& aBodyRel);
82
83WSF_SIX_DOF_EXPORT void DCM_InertialToBodyRel(const UtDCM& aMatrix, const UtVec3dX& aInertial, UtVec3dX& aBodyRel);
84
85WSF_SIX_DOF_EXPORT void AlphaBetaFromInertialVel(const UtDCM& aMatrix,
86 const UtVec3dX& aInertialVel_mps,
87 double& aSpeed_fps,
88 double& aAlpha_deg,
89 double& aBeta_deg);
90
91WSF_SIX_DOF_EXPORT void
92AlphaBetaFromBodyRelVel(const UtVec3dX& aVel_fps, double& aAlpha_deg, double& aBeta_deg, double& aSpeed_fps);
93
94WSF_SIX_DOF_EXPORT void AlphaBetaFromBodyRelVel(const UtVec3dX& aVel_fps, double& aAlpha_deg, double& aBeta_deg);
95
96// This limits the aThrottle argument between 0 and 1
97WSF_SIX_DOF_EXPORT void LimitThrottleNormalized(double& aThrottle);
98
99// This limits the aThrottle argument between 0 and 2
100WSF_SIX_DOF_EXPORT void LimitThrottleAfterburner(double& aThrottle);
101}; // namespace utils
102} // namespace six_dof
103} // namespace wsf
104
105#endif
Type
Definition WsfSixDOF_VehicleData.hpp:112
Definition WsfPointMassSixDOF_Utils.hpp:34
static constexpr double cDT_RIGID_BODY_SEC
Definition WsfSixDOF_Utils.hpp:57
WSF_SIX_DOF_EXPORT const SinglePidValueData & GetSinglePidData(Pid::Type aPidType, const AutopilotPidGroupValueData &aPidValues)
Definition WsfSixDOF_Utils.cpp:318
WSF_SIX_DOF_EXPORT void UpdateFalsePositionBounds(double &aInputA, double &aOutputA, double &aInputB, double &aOutputB, double aInputC, double aOutputC)
Definition WsfSixDOF_Utils.cpp:59
WSF_SIX_DOF_EXPORT void LimitThrottleAfterburner(double &aThrottle)
Definition WsfSixDOF_Utils.cpp:313
WSF_SIX_DOF_EXPORT void CalcLocalAngles(const UtVec3dX &aLocalNorth, const UtVec3dX &aLocalEast, const UtVec3dX &aLocalDown, const UtVec3dX &aUnitVecX, const UtVec3dX &aUnitVecZ, double &aLocalYaw_rad, double &aLocalPitch_rad, double &aLocalRoll_rad)
Definition WsfSixDOF_Utils.cpp:110
WSF_SIX_DOF_EXPORT double NextGuessFromFalsePosition(double aInputA, double aOutputA, double aInputB, double aOutputB)
Definition WsfSixDOF_Utils.cpp:54
WSF_SIX_DOF_EXPORT void LimitThrottleNormalized(double &aThrottle)
Definition WsfSixDOF_Utils.cpp:308
std::string OutputDoubleString(double aValue, int aWidth, int aPrecision)
Definition WsfSixDOF_Utils.cpp:29
static constexpr int64_t cDT_RIGID_BODY_NANOSEC
Definition WsfSixDOF_Utils.hpp:55
static constexpr int64_t cEPSILON_SIMTIME_NANOSEC
Definition WsfSixDOF_Utils.hpp:61
static constexpr double cDT_POINT_MASS_SEC
Definition WsfSixDOF_Utils.hpp:58
static constexpr double cEPSILON_SIMTIME_SEC
Definition WsfSixDOF_Utils.hpp:62
WSF_SIX_DOF_EXPORT int64_t TimeToTime(double aSimTime_sec)
Definition WsfSixDOF_Utils.cpp:41
static constexpr double cREFERENCE_GRAV_ACCEL_MPS2
Definition WsfSixDOF_Utils.hpp:65
static constexpr int64_t cDT_POINT_MASS_NANOSEC
Definition WsfSixDOF_Utils.hpp:56
WSF_SIX_DOF_EXPORT void DCM_InertialToBodyRel(const UtDCM &aMatrix, const UtVec3dX &aInertial, UtVec3dX &aBodyRel)
Definition WsfSixDOF_Utils.cpp:199
WSF_SIX_DOF_EXPORT void AlphaBetaFromInertialVel(const UtDCM &aMatrix, const UtVec3dX &aInertialVel_mps, double &aSpeed_fps, double &aAlpha_deg, double &aBeta_deg)
Definition WsfSixDOF_Utils.cpp:220
WSF_SIX_DOF_EXPORT void InertialToBodyRel(const UtDCM &aMatrix, const UtVec3dX &aInertial, UtVec3dX &aBodyRel)
Definition WsfSixDOF_Utils.cpp:178
WSF_SIX_DOF_EXPORT void CalcLocalNEDVectors(const UtVec3dX &aPos, UtVec3dX &aLocalNorth, UtVec3dX &aLocalEast, UtVec3dX &aLocalDown)
Definition WsfSixDOF_Utils.cpp:93
CanFlyAtReturnValue
Definition WsfSixDOF_Utils.hpp:31
@ CAN_FLY
Definition WsfSixDOF_Utils.hpp:34
@ CONTROL_FAIL
Definition WsfSixDOF_Utils.hpp:33
@ CAN_NOT_FLY
Definition WsfSixDOF_Utils.hpp:32
WSF_SIX_DOF_EXPORT void AlphaBetaFromBodyRelVel(const UtVec3dX &aVel_fps, double &aAlpha_deg, double &aBeta_deg, double &aSpeed_fps)
Definition WsfSixDOF_Utils.cpp:244
WSF_SIX_DOF_EXPORT void CalcUnitVectors(const UtDCM &aDCM, UtVec3dX &aUnitVecX, UtVec3dX &aUnitVecY, UtVec3dX &aUnitVecZ)
Definition WsfSixDOF_Utils.cpp:78
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfSixDOF_VehicleData.hpp:140
Definition WsfSixDOF_VehicleData.hpp:96
Copyrights Multiple, All Rights Reserved