-
Notifications
You must be signed in to change notification settings - Fork 20
DISSendComponent
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).
class UDISSendComponent
: public UActorComponent- CoreMinimal
- TimerManager.h
- DISEnumsAndStructs.h
- PDUMasterInclude.h
- UDPSubsystem.h
- Components/ActorComponent.h
| Name | Description | |||
|---|---|---|---|---|
| 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 | |
| Private | ADISGameManager* | DISGameManager | A reference to the DIS game manager | |
| Public | float | DISHeartbeatSeconds | How often an Entity State PDU should be sent out for this entity | |
| Public | int32 | EntityAppearance | Specifies the dynamic changes to the entities appearance attributes | |
| Public | int32 | EntityCapabilities | The DIS Capabilities that the entity should have | |
| Public | EForceID | EntityForceID | Specifies the team or side the DIS entity is on | |
| Public | FEntityID | EntityID | The Entity ID of the associated entity | |
| Public | FString | 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 | |
| Public | FEntityType | EntityType | pecifies 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 | |
| Private | AGeoReferencingSystem* | GeoReferencingSystem | A reference to Unreal Engine's GeoReferencing system | |
| Private | FVector | LastCalculatedAngularVelocity | The angluar velocity at the last calculation step | |
| Private | FVector | LastCalculatedBodyLinearAcceleration | The body linear acceleration at the last calculation step | |
| Private | FVector | LastCalculatedBodyLinearVelocity | The body linear velocity at the last calculation step | |
| Private | FVector | LastCalculatedECEFLinearAcceleration | The ECEF linear acceleration at the last calculation step | |
| Private | FVector | LastCalculatedECEFLinearVelocity | The ECEF linear velocity at the last calculation step | |
| Private | FVector | LastCalculatedUnrealLinearVelocity | The Unreal linear velocity at the last calculation step | |
| Private | FVector | LastCalculatedUnrealLocation | The Unreal location at the last calculation step | |
| Private | FRotator | LastCalculatedUnrealRotation | The Unreal rotation at the last calculation step | |
| Public | FEntityStatePDU | MostRecentDeadReckonedEntityStatePDU | The most recent Dead Reckoned Entity State PDU that has been calculated | |
| Public | FEntityStatePDU | MostRecentEntityStatePDU | The most recent Entity State PDU that has been received | |
| Private | float | TimeOfLastParametersCalculation | The time at which the last parameter was calculated in seconds since game start | |
| Private | UUDPSubSystem* | UDPSubsystem | A reference to the UDP subsystem | |
| Private | FTimerHandle | UpdateEntityStateCalculationsHandle | A handle to the time that triggers entity state update calculations |
| Name | Description | |
|---|---|---|
| Public | UDISSendComponent() | Default constructor |
| Name | Description | |||
|---|---|---|---|---|
| Protected | virtual | void | BeginPlay() | Called when the game starts |
| Public | FVector | CalculateAngularVelocity() | Calculates the Angular Velocity of the entity that this component is attached to | |
| Public | void | CalculateBodyLinearVelocityAndAcceleration(FVector AngularVelocity, FVector& BodyLinearVelocity, FVector& BodyLinearAcceleration) | Calculates the Linear Velocity and Linear Acceleration of the entity that this component is attached to | |
| Public | void | CalculateECEFLinearVelocityAndAcceleration(FVector& ECEFLinearVelocity, FVector& 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(FEntityStatePDU pduToSend) | Takes in an Entity State PDU and emits it as an Entity State or Entity State Update PDU | |
| Protected | virtual | void | EndPlay(const EEndPlayReason::Type EndPlayReason) | Overridable function called whenever this actor is being removed from a level |
| Public | FEntityStatePDU | FormEntityStatePDU() | Forms an Entity State PDU based on current known information about the Entity | |
| 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(int32 NewEntityAppearance) | Updates the appearance of the entity | |
| Public | void | SetEntityCapabilities(int32 NewEntityCapabilities) | Updates the Capabilities that the entity has | |
| Public | virtual | void | TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) | Function called every frame on this ActorComponent |
| Protected | void | UpdateEntityStateCalculations() | Updates last calculated linear velocity, linear acceleration, and angular velocity |
public EDeadReckoningAlgorithm DeadReckoningAlgorithm = EDeadReckoningAlgorithm::StaticCategory: GRILL DIS|DIS Send Component|DIS Settings
The dead reckoning algorithm to use.
public float DeadReckoningOrientationThresholdDegrees = 3Category: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0
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.
public float DeadReckoningPositionThresholdMeters = 1Category: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0
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.
private float DeltaTimeSinceLastPDU = 0The time in seconds since the last PDU was recieved for this entity.
private ADISGameManager* DISGameManagerA reference to the DIS game manager.
public float DISHeartbeatSeconds = 5.0fCategory: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0
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).
public int32 EntityAppearance = 0Category: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0
Specifies the dynamic changes to the entities appearance attributes.
public int32 EntityCapabilities = 0Category: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0
The DIS Capabilities that the entity should have. Int representation of a collection of boolean fields which describe the capabilities of the entity.
public EForceID EntityForceIDCategory: GRILL DIS|DIS Send Component|DIS Info
The Force ID of the associated entity. Specifies the team or side the DIS entity is on.
public FEntityID EntityIDCategory: GRILL DIS|DIS Send Component|DIS Info
The Entity ID of the associated entity. Each Entity ID should be unique to an entity in the sim.
public FString EntityMarkingCategory: GRILL DIS|DIS Send Component|DIS Info
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.
public float EntityStateCalculationRate = 0.1fCategory: GRILL DIS|DIS Send Component|DIS Settings
Minimum Value: 0.01
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.
public EEntityStateSendingMode EntityStatePDUSendingModeCategory: GRILL DIS|DIS Send Component|DIS Settings
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.
public FEntityType EntityTypeCategory: GRILL DIS|DIS Send Component|DIS Info
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.
private AGeoReferencingSystem* GeoReferencingSystemA reference to Unreal Engine's GeoReferencing system.
private FVector LastCalculatedAngularVelocityThe angluar velocity at the last calculation step.
private FVector LastCalculatedBodyLinearAccelerationThe body linear acceleration at the last calculation step.
private FVector LastCalculatedBodyLinearVelocityThe body linear velocity at the last calculation step.
private FVector LastCalculatedECEFLinearAccelerationThe ECEF linear acceleration at the last calculation step.
private FVector LastCalculatedECEFLinearVelocityThe ECEF linear velocity at the last calculation step.
private FVector LastCalculatedUnrealLinearVelocityThe Unreal linear velocity at the last calculation step.
private FVector LastCalculatedUnrealLocationThe Unreal location at the last calculation step.
private FRotator LastCalculatedUnrealRotationThe Unreal rotation at the last calculation step.
public FEntityStatePDU MostRecentDeadReckonedEntityStatePDUCategory: GRILL DIS|DIS Receive Component|DIS Info
The most recent Dead Reckoned Entity State PDU that has been calculated.
public FEntityStatePDU MostRecentEntityStatePDUCategory: GRILL DIS|DIS Receive Component|DIS Info
The most recent Entity State PDU that has been received.
private float TimeOfLastParametersCalculationThe time at which the last parameter was calculated in seconds since game start.
private UUDPSubsystem* UDPSubsystemA reference to the UDP subsystem.
private FTimerHandle UpdateEntityStateCalculationsHandleA handle to the time that triggers entity state update calculations.
public UDISSendComponent()Default constructor.
virtual void BeginPlay() overrideCalled when the game starts.
public FVector CalculateAngularVelocity()Category: GRILL DIS|DIS Send Component
Calculates the Angular Velocity of the entity that this component is attached to.
Returns an FVector containing the angular velocity in radians per second.
public void CalculateBodyLinearVelocityAndAcceleration
(
FVector AngularVelocity,
FVector& BodyLinearVelocity,
FVector& BodyLinearAcceleration
)Category: GRILL DIS|DIS Send Component
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 |
public void CalculateECEFLinearVelocityAndAcceleration
(
FVector& ECEFLinearVelocity,
FVector& ECEFLinearAcceleration
)Category: GRILL DIS|DIS Send Component
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 |
public bool CheckDeadReckoningThreshold()Category: GRILL DIS|DIS Send Component
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 |
public bool CheckOrientationMatrixThreshold()Category: GRILL DIS|DIS Send Component
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 |
public bool CheckOrientationQuaternionThreshold()Category: GRILL DIS|DIS Send Component
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 |
protected bool EmitAppropriatePDU
(
FEntityStatePDU 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 |
protected virtual void EndPlay
(
const EEndPlayReason::Type EndPlayReason
) overrideOverridable function called whenever this actor is being removed from a level.
| Parameter | Description |
|---|---|
| EndPlayReason |
public FEntityStatePDU FormEntityStatePDU()Category: GRILL DIS|DIS Send Component
Forms an Entity State PDU based on current known information about the Entity.
| Returns |
|---|
| The Entity State PDU that was formed |
public bool SendEntityStatePDU()Category: GRILL DIS|DIS Send Component
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 |
public void SetDeadReckoningAlgorithm
(
EDeadReckoningAlgorithm NewDeadReckoningAlgorithm
)Category: GRILL DIS|DIS Send Component
Updates the Dead Reckoning algorithm being used by the Send Component.
| Parameter | Description |
|---|---|
| NewDeadReckoningAlgorithm | The new dead reckoning algorithm to use |
public void SetEntityAppearance
(
int32 NewEntityAppearance
)Category: GRILL DIS|DIS Send Component
Updates the appearance of the entity.
| Parameter | Description |
|---|---|
| NewEntityAppearance | The new appearance that the entity has |
public void SetEntityCapabilities
(
int32 NewEntityCapabilities
)Updates the Capabilities that the entity has.
| Parameter | Description |
|---|---|
| NewEntityCapabilities | The new DIS capabilities that the entity has |
public virtual void TickComponent
(
float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction* ThisTickFunction
) overrideFunction called every frame on this ActorComponent.
See Unreal Engine|TickComponent for more information.
| Parameter | Description |
|---|---|
| DeltaTime | The time since the last tick |
| TickType | The kind of tick this is, for example, are we paused, or 'simulating' in the editor |
| ThisTickFunction | Internal tick function struct that caused this to run |
protected void UpdateEntityStateCalculations()Updates last calculated linear velocity, linear acceleration, and angular velocity.