Skip to content

DISSendComponent

Quintin edited this page May 16, 2023 · 2 revisions

DIS Send Component

The DISSendComponent handles basic sending DIS functionality.
It should be attached to actors where sending DIS is desired.

By default the DISSendComponent offers automatic Entity State PDU sending
for the associated DIS Entity. Maintains a list of appropriate
DIS variables (such as Entity ID).

public class DISSendComponent 
  : MonoBehaviour

Includes

Back to Top


Members

Access Type Name Description
Public EntityIDEditor CurrentEntityID The Entity ID of the associated entity
Public EntityTypeEditor CurrentEntityType The Entity Type of the associated entity. Specifies the kind of entity, the country of design, the domain, the specific identification of the entity, and any extra information necessary for describing the entity.
Public EDeadReckoningAlgorithm DeadReckoningAlgorithm The dead reckoning algorithm to use
Public float DeadReckoningOrientationThresholdDegrees If the dead reckoning orientation deviates more than this value away from the actual orientation, a new Entity State PDU will be sent
Public float DeadReckoningPositionThresholdMeters If the dead reckoning position deviates more than this value away from the actual position in any axis, a new Entity State PDU will be sent
Private float DeltaTimeSinceLastPDU The time in seconds since the last PDU was recieved for this entity
Public GameObject DISGameManager A reference to the DIS game manager game object
Private DISGameManager disGameManagerScript A reference to the DISGameManager script
Public float DISHeartbeatSeconds How often an Entity State PDU should be sent out for this entity
Public int EntityAppearance Specifies the dynamic changes to the entities appearance attributes
Public int EntityCapabilities The DIS Capabilities that the entity should have
Public EForceID EntityForceID Specifies the team or side the DIS entity is on
Public string EntityMarking Designates a friendly name for the DIS entity
Public float EntityStateCalculationRate The rate at which the timer that calculates the current linear velocity, linear acceleration, and angular acceleration of the entity gets executed
Public EEntityStateSendingMode EntityStatePDUSendingMode Dictates if none are sent, Entity State PDUs are sent, or Entity State Update PDUs are sent
Private GeoreferenceSystem georeferenceScript A reference to the GeoreferenceSystem script.
Private Vector3 LastCalculatedAngularVelocity The angluar velocity at the last calculation step
Private Vector3 LastCalculatedBodyLinearAcceleration The body linear acceleration at the last calculation step
Private Vector3 LastCalculatedBodyLinearVelocity The body linear velocity at the last calculation step
Private Vector3 LastCalculatedECEFLinearAcceleration The ECEF linear acceleration at the last calculation step
Private Vector3 LastCalculatedECEFLinearVelocity The ECEF linear velocity at the last calculation step
Private Vector3 LastCalculatedUnityLinearVelocity The Unity linear velocity at the last calculation step
Private Vector3 LastCalculatedUnityLocation The Unity location at the last calculation step
Private Quaternion LastCalculatedUnityRotation The Unity rotation at the last calculation step
Public EntityStatePdu MostRecentDeadReckoningPDU The most recent Dead Reckoned Entity State PDU that has been calculated
Public EntityStatePdu MostRecentEntityStatePDU The most recent Entity State PDU that has been received
Private PDUSender pduSenderScript A reference to the PDUSender script.
Private float TimeOfLastParametersCalculation The time at which the last parameter was calculated in seconds since game start

Back to Top


Functions

Access Return Name Description
Public Vector3 CalculateAngularVelocity() Calculates the Angular Velocity of the entity that this component is attached to
Public void CalculateBodyLinearVelocityAndAcceleration(Vector3 AngularVelocity, out Vector3 BodyLinearVelocity, out Vector3 BodyLinearAcceleration) Calculates the Linear Velocity and Linear Acceleration of the entity that this component is attached to
Public void CalculateECEFLinearVelocityAndAcceleration(out Vector3 ECEFLinearVelocity, out Vector3 ECEFLinearAcceleration) Calculates the Linear Velocity and Linear Acceleration of the entity that this component is attached to
Public bool CheckDeadReckoningThreshold() Compares the current Dead Reckoning location/orientation to the actual location/orientation of the entity
Public bool CheckOrientationMatrixThreshold() Checks whether or not the orientation threshold between the actual orientation and Dead Reckoning orientation has been exceeded
Public bool CheckOrientationQuaternionThreshold() Checks whether or not the orientation threshold between the actual orientation and Dead Reckoning orientation has been exceeded
Protected bool EmitAppropriatePDU(EntityStatePdu pduToSend) Takes in an Entity State PDU and emits it as an Entity State or Entity State Update PDU
Public EntityStatePdu FormEntityStatePDU() Forms an Entity State PDU based on current known information about the Entity
Private void OnDestroy() This function is called when the MonoBehaviour will be destroyed.
Public bool SendEntityStatePDU() Attempts to send an updated Entity State or Entity State Update PDU
Public void SetDeadReckoningAlgorithm(EDeadReckoningAlgorithm NewDeadReckoningAlgorithm) Updates the Dead Reckoning algorithm being used by the Send Component
Public void SetEntityAppearance(int NewEntityAppearance) Updates the appearance of the entity
Public void SetEntityCapabilities(int NewEntityCapabilities) Updates the Capabilities that the entity has
Private void Start() Start is called on the frame when a script is enabled just before any of the Update methods are called the first time.
Private void Update() Update is called every frame, if the MonoBehaviour is enabled.
Protected void UpdateEntityStateCalculations() Updates last calculated linear velocity, linear acceleration, and angular velocity

Back to Top


Details

CurrentEntityID

public FEntityID EntityID

The Entity ID of the associated entity. Each Entity ID should be unique to an entity in the sim.

Back to Top


CurrentEntityType

public EntityIDEditor EntityType

The Entity Type of the associated entity. Specifies the kind of entity, the country of design, the domain, the specific identification of the entity, and any extra information necessary for describing the entity.

Back to Top


DeadReckoningAlgorithm

public EDeadReckoningAlgorithm DeadReckoningAlgorithm = EDeadReckoningAlgorithm.Static

The dead reckoning algorithm to use.

Back to Top


DeadReckoningOrientationThresholdDegrees

public float DeadReckoningOrientationThresholdDegrees = 3

The orientation threshold to use for dead reckoning. If the dead reckoning orientation deviates more than this value away from the actual orientation, a new Entity State PDU will be sent.
This value should be in degrees.

Minimum Value: 0

Back to Top


DeadReckoningPositionThresholdMeters

public float DeadReckoningPositionThresholdMeters = 1

The position threshold to use for dead reckoning. If the dead reckoning position deviates more than this value away from the actual position in any axis, a new Entity State PDU will be sent.
This value should be in meters.

Minimum Value: 0

Back to Top


DeltaTimeSinceLastPDU

private float DeltaTimeSinceLastPDU = 0

The time in seconds since the last PDU was recieved for this entity.

Back to Top


DISGameManager

public GameObject DISGameManager

A reference to the DIS game manager.

Back to Top


DISGameManagerScript

private Coroutine DISHeartbeatCoroutine

A reference to the DISGameManager script

Back to Top


DISHeartbeatSeconds

public float DISHeartbeatSeconds = 5.0f

How often an Entity State PDU should be sent out for this entity.
Timer gets reset if an Entity State PDU gets sent out by this component by another means (ex: threshold clipping).

Minimum Value: 0

Back to Top


EntityAppearance

public int EntityAppearance = 0

Specifies the dynamic changes to the entities appearance attributes.

Minimum Value: 0

Back to Top


EntityCapabilities

public int EntityCapabilities = 0

The DIS Capabilities that the entity should have. Int representation of a collection of boolean fields which describe the capabilities of the entity.

Minimum Value: 0

Back to Top


EntityForceID

public EForceID EntityForceID

The Force ID of the associated entity. Specifies the team or side the DIS entity is on.

Back to Top


EntityMarking

public string EntityMarking

The Entity Marking of the associated entity. Designates a friendly name for the DIS entity.
Max of 11 characters should be used. If more than 11 are used, it will be truncated.

Back to Top


EntityStateCalculationRate

public float EntityStateCalculationRate = 0.1f

The rate at which the timer that calculates the current linear velocity, linear acceleration, and angular acceleration of the entity gets executed.
The values calculated by this timer get utilized when forming an Entity State PDU.

Minimum Value: 0.01

Back to Top


EntityStatePDUSendingMode

public EEntityStateSendingMode EntityStatePDUSendingMode = EEntityStateSendingMode.None

The sending mode that this entity should use for Entity State PDUs.
Dictates if none are sent, Entity State PDUs are sent, or Entity State Update PDUs are sent.
Distribution of Entity State PDUs are handled internally by the DIS Component via the overridable "SendEntityStatePDU" function.

Back to Top


GeoreferenceScript

public GeoreferenceSystem georeferenceScript

A reference to the GeoreferenceSystem script.

Back to Top


LastCalculatedAngularVelocity

private Vector3 LastCalculatedAngularVelocity

The angluar velocity at the last calculation step.

Back to Top


LastCalculatedBodyLinearAcceleration

private Vector3 LastCalculatedBodyLinearAcceleration

The body linear acceleration at the last calculation step.

Back to Top


LastCalculatedBodyLinearVelocity

private Vector3 LastCalculatedBodyLinearVelocity

The body linear velocity at the last calculation step.

Back to Top


LastCalculatedECEFLinearAcceleration

private Vector3 LastCalculatedECEFLinearAcceleration

The ECEF linear acceleration at the last calculation step.

Back to Top


LastCalculatedECEFLinearVelocity

private Vector3 LastCalculatedECEFLinearVelocity

The ECEF linear velocity at the last calculation step.

Back to Top


LastCalculatedUnityLinearVelocity

private Vector3 LastCalculatedUnityLinearVelocity

The Unity linear velocity at the last calculation step.

Back to Top


LastCalculatedUnityLocation

private Vector3 LastCalculatedUnityLocation

The Unity location at the last calculation step.

Back to Top


LastCalculatedUnityRotation

private FRotator LastCalculatedUnityRotation

The Unity rotation at the last calculation step.

Back to Top


MostRecentDeadReckoningPDU

public EntityStatePdu MostRecentDeadReckoningPDU

The most recent Dead Reckoned Entity State PDU that has been calculated.

Back to Top


MostRecentEntityStatePDU

public EntityStatePdu MostRecentEntityStatePDU

The most recent Entity State PDU that has been received.

Back to Top


PDUSenderScript

A reference to the PDUSender script.

Back to Top


TimeOfLastParametersCalculation

private float TimeOfLastParametersCalculation

The time at which the last parameter was calculated in seconds since game start.

Back to Top


CalculateAngularVelocity

public Vector3 CalculateAngularVelocity()

Calculates the Angular Velocity of the entity that this component is attached to.
Returns an Vector3 containing the angular velocity in radians per second.

Back to Top


CalculateBodyLinearVelocityAndAcceleration

public void CalculateBodyLinearVelocityAndAcceleration
(
  Vector3 AngularVelocity,
  out Vector3 BodyLinearVelocity,
  out Vector3 BodyLinearAcceleration
)

Calculates the Linear Velocity and Linear Acceleration of the entity that this component is attached to. Calculates them in terms of entity body coordinates.

Parameter Description
AngularVelocity The current angular velocity of the entity
BodyLinearVelocity The linear velocity of the entity in Body coordinates
BodyLinearAcceleration The linear acceleration of the entity in Body coordinates

Back to Top


CalculateECEFLinearVelocityAndAcceleration

public void CalculateECEFLinearVelocityAndAcceleration
(
  out Vector3 ECEFLinearVelocity,
  out Vector3 ECEFLinearAcceleration
)

Calculates the Linear Velocity and Linear Acceleration of the entity that this component is attached to. Calculates them in terms of ECEF coordinates.

Parameter Description
ECEFLinearVelocity The linear velocity of the entity in ECEF coordinates
ECEFLinearAcceleration The linear acceleration of the entity in ECEF coordinates

Back to Top


CheckDeadReckoningThreshold

public bool CheckDeadReckoningThreshold()

Compares the current Dead Reckoning location/orientation to the actual location/orientation of the entity.

Returns
True if the comparison is outside of the Dead Reckoning threshold

Back to Top


CheckOrientationMatrixThreshold

public bool CheckOrientationMatrixThreshold()

Checks whether or not the orientation threshold between the actual orientation and Dead Reckoning orientation has been exceeded. Utilizes matrices to calculate it.

Returns
True if the comparison is outside of the orientation threshold

Back to Top


CheckOrientationQuaternionThreshold

public bool CheckOrientationQuaternionThreshold()

Checks whether or not the orientation threshold between the actual orientation and Dead Reckoning orientation has been exceeded. Utilizes quaternions to calculate it.

Returns
True if the comparison is outside of the orientation threshold

Back to Top


EmitAppropriatePDU

bool EmitAppropriatePDU
(
  EntityStatePdu pduToSend
)

Takes in an Entity State PDU and emits it as an Entity State or Entity State Update PDU. Decides based on what EntityStatePDUSendingMode is set to.

Parameter Description
pduToSend The Entity State PDU to emit
Returns
True if packets were sent correctly

Back to Top


FormEntityStatePDU

public EntityStatePdu FormEntityStatePDU()

Forms an Entity State PDU based on current known information about the Entity.

Returns
The Entity State PDU that was formed

Back to Top


OnDestroy

private void OnDestroy()

This function is called when the MonoBehaviour will be destroyed.

https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnDestroy.html

Back to Top


SendEntityStatePDU

public bool SendEntityStatePDU()

Attempts to send an updated Entity State or Entity State Update PDU. Checks Dead Reckoning threshold prior to sending.

Returns
True if an entity state PDU or entity state update PDU was sent

Back to Top


SetDeadReckoningAlgorithm

public void SetDeadReckoningAlgorithm
(
  EDeadReckoningAlgorithm NewDeadReckoningAlgorithm
)

Updates the Dead Reckoning algorithm being used by the Send Component.

Parameter Description
NewDeadReckoningAlgorithm The new dead reckoning algorithm to use

Back to Top


SetEntityAppearance

public void SetEntityAppearance
(
  int NewEntityAppearance
)

Updates the appearance of the entity.

Parameter Description
NewEntityAppearance The new appearance that the entity has

Back to Top


SetEntityCapabilities

public void SetEntityCapabilities
(
  int NewEntityCapabilities
)

Updates the Capabilities that the entity has.

Parameter Description
NewEntityCapabilities The new DIS capabilities that the entity has

Back to Top


Start

private void Start()

Start is called on the frame when a script is enabled just before any of the Update methods are called the first time.

https://docs.unity3d.com/ScriptReference/MonoBehaviour.Start.html

Back to Top


Update

void Update()

Update is called every frame, if the MonoBehaviour is enabled.

https://docs.unity3d.com/ScriptReference/MonoBehaviour.Update.html

Back to Top


UpdateEntityStateCalculations

void UpdateEntityStateCalculations()

Updates last calculated linear velocity, linear acceleration, and angular velocity.

Back to Top


Clone this wiki locally