-
Notifications
You must be signed in to change notification settings - Fork 5
DeadReckoningLibrary
Dead Reckoning Blueprint Function Library. Houses functions for performing dead reckoning.
public class DeadReckoningLibrary
Access | Type | Name | Description | |
---|---|---|---|---|
Private | Static Const | double | ALLOWABLE_FLOATING_POINT_ERROR | The minimum offset a floating point number can have to be approximately equal. |
Private | Static Const | double | MIN_ROTATION_RATE | Minimum significant rotation rate = 1deg/5sec. |
Access | Return | Name | Description | |
---|---|---|---|---|
Public | Static | Orientation | CalculateBodyDeadReckonedPosition(dvec3 entityLocation, dvec3 entityLinearVelocity, dvec3 entityLinearAcceleration, dvec3 entityAngularVelocity, Orientation entityOrientation, float deltaTime) | Calculates the new position vector using the given velocity, acceleration, and time increment given in body coordinates |
Public | Static | Orientation | CalculateDeadReckonedOrientation(Orientation entityOrientation, dvec3 entityAngularVelocity, float deltaTime) | Calculates the new orientation vector using the given velocity, acceleration, and time increment |
Public | Static | dvec3 | CalculateDeadReckonedPosition(dvec3 PositionVector, dvec3 VelocityVector, dvec3 AccelerationVector, float DeltaTime) | Calculates the new position vector using the given velocity, acceleration, and time increment |
Public | Static | Orientation | CalculateOrientationFromQuaternion(dvec3 AngularVelocity, Quaternion localQuaternion, float deltaTime) | Converts a Quaternion into an OpenDIS Orientation (Psi, Theta, Phi). |
Public | Static | dmat3(dvec3 AngularVelocityVector, double DeltaTime) | Calculates and returns the dead reckoning matrix used for calculating entity rotation | |
Public | Static | Quaternion | CreateDeadReckoningQuaternion(dvec3 AngularVelocityVector, double DeltaTime) | Calculates and returns the dead reckoning quaternion used for calculating entity rotation |
Public | Static | bool | DeadReckoning(EntityStatePdu EntityPduToDeadReckon, float DeltaTime, ref EntityStatePdu DeadReckonedPdu) | Performs dead reckoning on the given Entity PDU |
Public | Static | byte[] | FormOtherParameters(EDeadReckoningAlgorithm DeadReckoningAlgorithm, Orientation EntityPsiThetaPhiRadians, Vector3Double EntityECEFLocation) | Forms the Other Parameters section utilized in Dead Reckoning Parameters |
Public | Static | dmat3 | GetEntityOrientationMatrix(Orientation entityOrientation) | Calculates a DIS entity's orientation matrix from the provided Euler angles |
Public | Static | Quaternion | GetEntityOrientationQuaternion(double PsiRadians, double ThetaRadians, double PhiRadians) | Calculates a DIS entity's orientation quaternion from the provided Euler angles |
Public | Static | bool | GetLocalEulerAngles(byte[] otherParameters, out Orientation localRotation) | Gets the local yaw, pitch, and roll from the other parameters structure. The yaw, pitch, and roll act on the entity's local North, East, Down vectors |
Public | Static | bool | GetLocalQuaternionAngles(byte[] otherParameters, out Quaternion localRotation) | Gets the local entity orientation as a quaternion from the dead reckoning other parameters |
private static readonly double ALLOWABLE_FLOATING_POINT_ERROR = 1e-7
The minimum offset a floating point number can have to be approximately equal.
private static readonly double MIN_ROTATION_RATE = 0.2 * Math.PI / 180
Minimum significant rotation rate = 1deg/5sec.
public static dvec3 CalculateBodyDeadReckonedPosition
(
dvec3 entityLocation,
dvec3 entityLinearVelocity,
dvec3 entityLinearAcceleration,
dvec3 entityAngularVelocity,
Orientation entityOrientation,
float deltaTime
)
Calculates the new position vector using the given velocity, acceleration, and time increment given in body coordinates.
Parameter | Description |
---|---|
entityLocation | The initial position of the entity in body coordinates. |
entityLinearVelocity | The initial velocity in body coordinates. |
entityLinearAcceleration | The initial linear acceleration in body coordinates. |
entityAngularVelocity | The initial angular acceleration in body coordinates. |
entityOrientation | The orientation of the entity in radians. |
deltaTime | The time increment for dead reckoning calculation. |
Returns |
---|
The position vector in body coordinates. |
public static Orientation CalculateDeadReckonedOrientation
(
Orientation entityOrientation,
dvec3 entityAngularVelocity,
float deltaTime
)
Calculates the new orientation vector using the given velocity, acceleration, and time increment.
Parameter | Description |
---|---|
entityOrientation | The rotation about the Z axis in radians |
entityAngularVelocity | The rotation about the Y axis in radians |
deltaTime | The rotation about the X axis in radians |
Returns |
---|
The dead reckoning orientation matrix based off the given Entity Orientation and Entity Angular Velocity. |
public static dvec3 CalculateDeadReckonedPosition
(
dvec3 entityLocation,
dvec3 entityLinearVelocity,
dvec3 entityAcceleration,
float deltaTime
)
Calculates the new position vector using the given velocity, acceleration, and time increment.
Parameter | Description |
---|---|
entityLocation | The initial position of the entity in world coordinates |
entityLinearVelocity | The initial velocity in world coordinates |
entityAcceleration | The initial acceleration in world coordinates |
deltaTime | The time increment for dead reckoning calculation |
Returns |
---|
The calulated dead reckoned position. |
public static Orientation CalculateOrientationFromQuaternion
(
dvec3 AngularVelocity,
Quaternion localQuaternion,
float deltaTime
)
Calculates the new position vector using the given velocity, acceleration, and time increment.
Parameter | Description |
---|---|
AngularVelocity | The Entity PDU being dead reckoned. |
localQuaternion | The Quaternion to convert into an Orientation (Psi, Theta, Phi). |
deltaTime | The time increment for dead reckoning calculation. |
Returns |
---|
The OpenDIS Orientation. |
public static Quaternion CreateDeadReckoningQuaternion
(
dvec3 AngularVelocityVector,
double DeltaTime
)
Calculates and returns the dead reckoning quaternion used for calculating entity rotation.
Parameter | Description |
---|---|
AngularVelocityVector | The angular velocity vector in body coordinates |
DeltaTime | The time increment for dead reckoning calculations |
Returns |
---|
The dead reckoning quaternion used for calculating entity rotation |
public static bool DeadReckoning
(
EntityStatePdu EntityPduToDeadReckon,
float DeltaTime,
ref EntityStatePdu DeadReckonedPdu
)
Performs dead reckoning on the given Entity PDU.
Parameter | Description |
---|---|
EntityPDUToDeadReckon | The Entity State PDU to perform dead reckoning on |
DeltaTime | The time elapsed in seconds that dead reckoning should be calculated for |
DeadReckonedPdu | The resulting dead reckoned EntityStatePDU that contains all of the dead reckoning information |
Returns |
---|
True if dead reckoning algorithm is supported and dead reckoning was performed. False otherwise. |
public static byte[] FormOtherParameters
(
EDeadReckoningAlgorithm DeadReckoningAlgorithm,
Orientation EntityPsiThetaPhiRadians,
Vector3Double EntityECEFLocation
)
Forms the Other Parameters section utilized in Dead Reckoning Parameters.
Parameter | Description |
---|---|
DeadReckoningAlgorithm | The dead reckoning algorithm being used |
EntityPsiThetaPhiRadians | The Psi, Theta, Phi orientation of the entity |
EntityECEFLocation | The ECEF location of the entity |
Returns |
---|
An array of 15 bytes representing the Other Parameters of the Dead Reckoning PDU |
public static dmat3 GetEntityOrientationMatrix
(
Orientation entityOrientation
)
Calculates a DIS entity's orientation matrix from the provided Euler angles.
Parameter | Description |
---|---|
entityOrientation | The orientation of the entity in radians |
Returns |
---|
Orientation matrix from the provided Euler angles of a DIS entity |
public static Quaternion GetEntityOrientationQuaternion
(
double PsiRadians,
double ThetaRadians,
double PhiRadians
)
Calculates a DIS entity's orientation quaternion from the provided Euler angles.
Parameter | Description |
---|---|
PsiRadians | The rotation about the Z axis in radians |
ThetaRadians | The rotation about the Y axis in radians |
PhiRadians | The rotation about the X axis in radians |
Returns |
---|
A DIS entity's orientation quaternion from the provided Euler angles |
public static bool GetLocalEulerAngles
(
byte[] otherParameters,
out Orientation localRotation
)
Gets the local yaw, pitch, and roll from the other parameters structure. The yaw, pitch, and roll act on the entity's local North, East, Down vectors.
Parameter | Description |
---|---|
otherParameters | The 120 bits sent as part of the dead reckoning parameters marked as other parameters sent as an array of bytes |
localRotation | The local yaw, pitch, and roll of the entity in radians. Yaw is the heading from true north, positive to the right. Pitch is the elevation angle above or below the local horizon, positive up. Roll is the bank angle from the local horizontal, positive tile to the right |
Returns |
---|
False if OtherDeadReckoningParameters has a length less than 15 or the Dead Reckoning Parameter Type (OtherDeadReckoningParameters[0] ) is not set to 1. True otherwise. |
public static bool GetLocalQuaternionAngles
(
byte[] otherParameters,
out Quaternion localRotation
)
Gets the local entity orientation as a quaternion from the dead reckoning other parameters.
Parameter | Description |
---|---|
otherParameters | The 120 bits sent as part of the dead reckoning parameters marked as other parameters sent as an array of bytes |
localRotation | The four-valued unit quaternion that represents the entity's orientation |
Returns |
---|
False if OtherDeadReckoningParameters has a length less than 15 or the Dead Reckoning Parameter Type (OtherDeadReckoningParameters[0] ) is not set to 2. True otherwise. |