Class mil.navy.nps.dis.EntityStatePdu
java.lang.Object
|
+----mil.navy.nps.dis.PduElement
|
+----mil.navy.nps.dis.ProtocolDataUnit
|
+----mil.navy.nps.dis.EntityStatePdu
- public class EntityStatePdu
- extends ProtocolDataUnit
- Version:
- 1.0
- Author:
- Don McGregor (http://www.stl.nps.navy.mil/~mcgredo)
- Location:
-
http://www.stl.nps.navy.mil/dis-java-vrml/mil/navy/nps/dis/EntityStatePdu.java
- Hierarchy Diagram:
- Summary:
- This Class implements an Entity State PDU which in turn stores information about an entity
in a DIS format, such as velocity, orientation, dead reckoning parameter etc.
- Explanation:
- The entity state PDU communicates information about an entity, such as
its location, its appearance, and how it appears to others.
This is a subclass of the abstract ProtocolDataUnit class, and
overrides the serialization, deSerialization, and clone methods.
ProtocolDataUnit encompasses the PDU Header information, such as
the protocol version, PDU Type, etc.
This is pretty simple stuff. You can really go to sleep writing it.
It screams out for automation and an algorithm to do all this automatically.
Can you say dial-a-protocol?
- Note:
- We have flattened the Dead Reckoning record.
There are some additionnal easy to use accessor methods to modify in a simple way,
fields that are nested in records and that are frequently accessed.
Note that we do not define an Entity Marking Record. It is replaced by CharacterSet and by Marking.
At last, we have an articulationParameter list whose accessor methods are addArticulationParameter() and
articulationParameterCount().
- History:
- 17Oct96 /Don McGregor /New
- 25Oct96 /Don McGregor /changed full-fledged Float objects to mere float instance variables
- 06Mar97 /Don McGregor /javadoc changes, swapped in entityType and altEntityType in place of
individual fields
- 16Apr97 /Don McGregor /PrintStream passed to printValues
- 12Aug97 /Don McGregor /elaborated printValues
19Aug97 /Don McGregor /Made "multicast" terminology consistent
- 8Dec97 /Ronan Fauglas /changes for documentation templates + complements in documentation
- 11Dec97 /Ronan Fauglas /changed access methods: thisVariable() --> getThisVariable()
- References:
- DIS Data Dictionary :
Entity State PDU
- DIS-Java-VRML Working Group:
http://www.stl.nps.navy.mil/dis-java-vrml/
- DIS specification : IEEE 1278.1, Section 5.4.3.1, 4.4.2, 4.4.5
- See Also:
- ProtocolDataUnit, PduElement, mil.navy.nps.util.SerializationInterface, CollisionPdu
Field Summary
|
EntityType
|
alternativeEntityType
Alternate Entity Type - This field shall identify the entity type to be displayed by
members of forces other than that of the issuing entity.
|
java.util.Vector
|
articulationParameters
The number of articulation parameters and the Articulation Paramater record are being wrapped
in Vectors.
|
mil.navy.nps.util.UnsignedInt
|
capabilities
A collection of boolean fields which describe the capabilities of the Entity.
|
mil.navy.nps.util.UnsignedByte
|
characterSet
This field represents the Character set used in representing the Entity Marking Record.
|
mil.navy.nps.util.UnsignedByte
|
deadReckoningAlgorithm
Dead Reckoning Algorithm - This field shall specify the dead reckoning algorithm in use by the issuing
entity.
|
byte[]
|
deadReckoningParameters
Other Parameters - This field shall specify other required dead reckoning parameters to be determined.
|
static boolean
|
DEBUG
Debugging flag;
when set true, turns on verbose diagnostic, statements that prints in the java console.
|
AngularVelocity
|
entityAngularVelocity
Entity Angular Velocity - This field shall specify an entity's angular velocity.
|
mil.navy.nps.util.UnsignedInt
|
entityAppearance
Entity Appearance - This field shall specify the dynamic changes to the entity's
appearance attributes.
|
EntityID
|
entityID
Entity Identification - This field shall identify the entity issuing the PDU.
|
LinearAcceleration
|
entityLinearAcceleration
Entity Linear Acceleration - This field shall specify an entity's linear acceleration.
|
LinearVelocity
|
entityLinearVelocity
Entity Linear Velocity - This field shall specify an entity's linear velocity.
|
WorldCoordinate
|
entityLocation
Entity Location - This field shall specify an entity's physical location in the simulated world.
|
EulerAngle
|
entityOrientation
Entity Orientation - This field shall specify an entity's orientation.
|
EntityType
|
entityType
Entity Type - This field shall identify the entity type to be displayed
by members of the same force as the issuing entity.
|
static EntityStatePdu
|
exemplar
An "examplar" object, which is filled out to the state that is needed most of the time.
|
mil.navy.nps.util.UnsignedByte
|
forceID
Force Identification - This field shall identify the force to which the issuing entity belongs.
|
java.lang.String
|
marking
This is a String used to designate the Entity Marking.
|
static int
|
sizeOf
Constant value--size of an Entity State PDU without headder.
|
Constructor Summary
|
EntityStatePdu()
Default constructor--fills with zeros for all values.
|
Methods inherited from class mil.navy.nps.dis.ProtocolDataUnit
|
, clone, datagramToPdu, deSerialize, getExerciseID, getPduType, getProtocolFamily, getProtocolVersion, getTimestamp, getVRMLTimestamp, length, makeTimestampCurrent, PDUName, printValues, serialize, setExerciseID, setExerciseID, setPduType, setPduType, setProtocolFamily, setProtocolFamily, setProtocolVersion, setProtocolVersion, setSimulationStartTime, setTimestamp, setTimestamp |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEBUG
public static final boolean DEBUG
- Debugging flag;
when set true, turns on verbose diagnostic, statements that prints in the java console.
Default is false.
entityID
protected EntityID entityID
- Entity Identification - This field shall identify the entity issuing the PDU.
forceID
protected mil.navy.nps.util.UnsignedByte forceID
- Force Identification - This field shall identify the force to which the issuing entity belongs.
- Value:
- Enumeration, see references below for further information.
- References:
- DIS Data Dictionary:
Force ID Field
- See Section 4 in Document IST-CR-93-19
entityType
protected EntityType entityType
- Entity Type - This field shall identify the entity type to be displayed
by members of the same force as the issuing entity.
- References:
- See Section 6 in Document IST-CR-93-19
alternativeEntityType
protected EntityType alternativeEntityType
- Alternate Entity Type - This field shall identify the entity type to be displayed by
members of forces other than that of the issuing entity.
- References:
- See Section 4 in Document IST-CR-93-19.
entityLinearVelocity
protected LinearVelocity entityLinearVelocity
- Entity Linear Velocity - This field shall specify an entity's linear velocity.
The coordinate system for an entities' linear velocity depends on the
dead reckoning algorithm used.
entityLocation
protected WorldCoordinate entityLocation
- Entity Location - This field shall specify an entity's physical location in the simulated world.
entityOrientation
protected EulerAngle entityOrientation
- Entity Orientation - This field shall specify an entity's orientation.
entityAppearance
protected mil.navy.nps.util.UnsignedInt entityAppearance
- Entity Appearance - This field shall specify the dynamic changes to the entity's
appearance attributes.
- References:
- DIS Data Dictionary:
Entity Appearance Record
- See Section 3 in Document IST-CR-93-19.
- DIS specification : IEEE 1278.1, Section 5.3.12
deadReckoningAlgorithm
protected mil.navy.nps.util.UnsignedByte deadReckoningAlgorithm
- Dead Reckoning Algorithm - This field shall specify the dead reckoning algorithm in use by the issuing
entity.
- Value:
- Enumeration; see references below.
- References:
- See Section 7 in Document IST-CR-93-19.
- DIS Data Dictionary:
Dead Reckoning Parameter Record,
Dead Reckoning Algorithm Field.
deadReckoningParameters
protected byte[] deadReckoningParameters
- Other Parameters - This field shall specify other required dead reckoning parameters to be determined.
This field shall consist of 120 bits.
- Note:
- we don't respect our syntax
- References:
- See Section 7 in Document IST-CR-93-19.
- DIS Data Dictionary:
Dead Reckoning Parameter Record,
Dead Reckoning Other Parameters Field.
entityLinearAcceleration
protected LinearAcceleration entityLinearAcceleration
- Entity Linear Acceleration - This field shall specify an entity's linear acceleration.
entityAngularVelocity
protected AngularVelocity entityAngularVelocity
- Entity Angular Velocity - This field shall specify an entity's angular velocity.
characterSet
protected mil.navy.nps.util.UnsignedByte characterSet
- This field represents the Character set used in representing the Entity Marking Record.
- References:
- DIS specification : IEEE 1278.1, 5.3.15
- DIS Data Dictionary:
Entity Marking record,
Entity Marking String Record.
- See Also:
- marking
marking
protected java.lang.String marking
- This is a String used to designate the Entity Marking.
It is not more than 11 characters.
Besides it can't be more than 11 bytes when serializing.
- Explanation
The Entity Marking record has been flatened here into the marking and the characterSet fields.
In general, this record is used to specify the character set used in the marking
and the string of characters to be interpreted for display.
- Note:
- In Java, Strings are NOT the same as byte arrays. Strings use
use unicode characters of two bytes each, unlike in C,
where there's a direct 1-byte=1 char mapping. We get around
this by taking only the low-order byte of the two-byte unicode
char when serializing. One of the side effects of this is that
we can SET unicode strings, but can't transmit them. This is a
wart, but it makes the code a bit easier.
- References:
- DIS specification : IEEE 1278.1, 5.3.15
- DIS Data Dictionary:
Entity Marking record,
Entity Marking String Record.
- See Also:
- characterset
capabilities
protected mil.navy.nps.util.UnsignedInt capabilities
- A collection of boolean fields which describe the capabilities of the Entity.
Note: The record is being flatened here in one field.
- References:
- See Section 4 in Document IST-CR-93-19.
- DIS Data Dictionary:
Entity Capabilities Record,
Dead Reckoning Algorithm Field.
- DIS specification : IEEE 1278.1, 5.3.13
articulationParameters
protected java.util.Vector articulationParameters
- The number of articulation parameters and the Articulation Paramater record are being wrapped
in Vectors. It makes the interface look better.
- References:
- See Section 4 in Document IST-CR-93-19.
- DIS Data Dictionary:
Number of Articulation Parameters Field,
Articulation Parameter Record
- DIS specification : IEEE 1278.1, Annex A, 5.3.5
sizeOf
public static final int sizeOf
- Constant value--size of an Entity State PDU without headder.
sizeOf = 132 bytes
exemplar
protected static EntityStatePdu exemplar
- An "examplar" object, which is filled out to the state that is needed most of the time.
- Explanation
- A brand new object has to have most of its values set,
such as the forceID, protocol version, and so on. This lets the user fill
out most of the values, save it in the class, then retrieve a copy of it
as needed.
EntityStatePdu
public EntityStatePdu()
- Default constructor--fills with zeros for all values.
serialize
public void serialize(java.io.DataOutputStream outputStream)
- Throws:
- java.lang.RuntimeException - when io error occurs.
fileEncoding ensures we convert string to local system encoding properly.
- Overrides:
- serialize in class ProtocolDataUnit
deSerialize
public void deSerialize(java.io.DataInputStream dataInputStream)
- Throws:
- java.lang.RuntimeException - when io error occurs.
fileEncoding ensures we convert string to local system encoding properly.
- Overrides:
- deSerialize in class ProtocolDataUnit
clone
public java.lang.Object clone()
- Overrides:
- clone in class ProtocolDataUnit
length
public int length()
- Overrides:
- length in class ProtocolDataUnit
PDUName
public java.lang.String PDUName()
- Overrides:
- PDUName in class ProtocolDataUnit
printValues
public void printValues(int indentLevel,
java.io.PrintStream printStream)
- Overrides:
- printValues in class ProtocolDataUnit
getExemplar
public static EntityStatePdu getExemplar()
setExemplar
public static void setExemplar(EntityStatePdu newExemplar)
getEntityID
public EntityID getEntityID()
setEntityID
public void setEntityID(EntityID pEntityID)
setEntityID
public void setEntityID(short pSiteID,
short pApplicationID,
short pEntityID)
getForceID
public mil.navy.nps.util.UnsignedByte getForceID()
setForceID
public void setForceID(mil.navy.nps.util.UnsignedByte pForceID)
setForceID
public void setForceID(int pForceID)
articulationParameterCount
public mil.navy.nps.util.UnsignedByte articulationParameterCount()
- Returns the number of articulation parameter in this Entity State PDU.
- Returns:
- the number of articulation parameter
getEntityType
public EntityType getEntityType()
setEntityType
public void setEntityType(EntityType pEntityType)
getEntityTypeKind
public mil.navy.nps.util.UnsignedByte getEntityTypeKind()
setEntityTypeKind
public void setEntityTypeKind(mil.navy.nps.util.UnsignedByte pEntityKind)
setEntityTypeKind
public void setEntityTypeKind(int pEntityKind)
getEntityTypeDomain
public mil.navy.nps.util.UnsignedByte getEntityTypeDomain()
setEntityTypeDomain
public void setEntityTypeDomain(mil.navy.nps.util.UnsignedByte pEntityDomain)
setEntityDomain
public void setEntityDomain(int pEntityDomain)
getEntityTypeCountry
public mil.navy.nps.util.UnsignedShort getEntityTypeCountry()
setEntityTypeCountry
public void setEntityTypeCountry(mil.navy.nps.util.UnsignedShort pEntityCountry)
setEntityTypeCountry
public void setEntityTypeCountry(int pEntityCountry)
getEntityTypeCategory
public mil.navy.nps.util.UnsignedByte getEntityTypeCategory()
setEntityTypeCategory
public void setEntityTypeCategory(mil.navy.nps.util.UnsignedByte pEntityCategory)
setEntityTypeCategory
public void setEntityTypeCategory(int pEntityCategory)
getEntityTypeSubcategory
public mil.navy.nps.util.UnsignedByte getEntityTypeSubcategory()
setEntityTypeSubcategory
public void setEntityTypeSubcategory(mil.navy.nps.util.UnsignedByte pEntitySubcategory)
setEntityTypeSubcategory
public void setEntityTypeSubcategory(int pEntitySubcategory)
getEntityTypeSpecific
public mil.navy.nps.util.UnsignedByte getEntityTypeSpecific()
setEntityTypeSpecific
public void setEntityTypeSpecific(mil.navy.nps.util.UnsignedByte pEntitySpecific)
setEntityTypeSpecific
public void setEntityTypeSpecific(int pEntitySpecific)
getEntityTypeExtra
public mil.navy.nps.util.UnsignedByte getEntityTypeExtra()
setEntityTypeExtra
public void setEntityTypeExtra(mil.navy.nps.util.UnsignedByte pEntityExtra)
setEntityTypeExtra
public void setEntityTypeExtra(int pEntityExtra)
getAlternativeEntityType
public EntityType getAlternativeEntityType()
setAlternativeEntityType
public void setAlternativeEntityType(EntityType pNewAltEntity)
getAlternativeEntityTypeKind
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeKind()
setAlternativeEntityTypeKind
public void setAlternativeEntityTypeKind(mil.navy.nps.util.UnsignedByte pEntityKind)
setAlternativeEntityTypeKind
public void setAlternativeEntityTypeKind(int pEntityKind)
getAlternativeEntityTypeDomain
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeDomain()
setAlternativeEntityTypeDomain
public void setAlternativeEntityTypeDomain(mil.navy.nps.util.UnsignedByte pEntityDomain)
setAlternativeEntityDomain
public void setAlternativeEntityDomain(int pEntityDomain)
getAlternativeEntityTypeCountry
public mil.navy.nps.util.UnsignedShort getAlternativeEntityTypeCountry()
setAlternativeEntityTypeCountry
public void setAlternativeEntityTypeCountry(mil.navy.nps.util.UnsignedShort pEntityCountry)
setAlternativeEntityCountry
public void setAlternativeEntityCountry(int pEntityCountry)
getAlternativeEntityTypeCategory
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeCategory()
setAlternativeEntityTypeCategory
public void setAlternativeEntityTypeCategory(mil.navy.nps.util.UnsignedByte pEntityCategory)
setAlternativeEntityTypeCategory
public void setAlternativeEntityTypeCategory(int pEntityCategory)
getAlternativeEntityTypeSubcategory
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeSubcategory()
setAlternativeEntityTypeSubcategory
public void setAlternativeEntityTypeSubcategory(mil.navy.nps.util.UnsignedByte pEntitySubcategory)
setAlternativeEntityTypeSubcategory
public void setAlternativeEntityTypeSubcategory(int pEntitySubcategory)
getAlternativeEntityTypeSpecific
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeSpecific()
setAlternativeEntityTypeSpecific
public void setAlternativeEntityTypeSpecific(mil.navy.nps.util.UnsignedByte pEntitySpecific)
setAlternativeEntityTypeSpecific
public void setAlternativeEntityTypeSpecific(int pEntitySpecific)
getAlternativeEntityTypeExtra
public mil.navy.nps.util.UnsignedByte getAlternativeEntityTypeExtra()
setAlternativeEntityTypeExtra
public void setAlternativeEntityTypeExtra(mil.navy.nps.util.UnsignedByte pEntityExtra)
setAlternativeEntityTypeExtra
public void setAlternativeEntityTypeExtra(int pEntityExtra)
getEntityLinearVelocity
public LinearVelocity getEntityLinearVelocity()
setEntityLinearVelocity
public void setEntityLinearVelocity(LinearVelocity pVelocity)
getEntityLinearVelocityX
public float getEntityLinearVelocityX()
setEntityLinearVelocityX
public void setEntityLinearVelocityX(float pVelocityX)
getEntityLinearVelocityY
public float getEntityLinearVelocityY()
setEntityLinearVelocityY
public void setEntityLinearVelocityY(float pVelocityY)
getEntityLinearVelocityZ
public float getEntityLinearVelocityZ()
setEntityLinearVelocityZ
public void setEntityLinearVelocityZ(float pVelocityZ)
getEntityLocation
public WorldCoordinate getEntityLocation()
setEntityLocation
public void setEntityLocation(WorldCoordinate pLocation)
getEntityLocationX
public double getEntityLocationX()
setEntityLocationX
public void setEntityLocationX(double pLocationX)
getEntityLocationY
public double getEntityLocationY()
setEntityLocationY
public void setEntityLocationY(double pLocationY)
getEntityLocationZ
public double getEntityLocationZ()
setEntityLocationZ
public void setEntityLocationZ(double pLocationZ)
getEntityOrientation
public EulerAngle getEntityOrientation()
setEntityOrientation
public void setEntityOrientation(EulerAngle pNewOrientation)
getEntityOrientationPsi
public float getEntityOrientationPsi()
setEntityOrientationPsi
public void setEntityOrientationPsi(float pPsi)
getEntityOrientationTheta
public float getEntityOrientationTheta()
setEntityOrientationTheta
public void setEntityOrientationTheta(float pTheta)
getEntityOrientationPhi
public float getEntityOrientationPhi()
setEntityOrientationPhi
public void setEntityOrientationPhi(float pPhi)
getEntityAppearance
public mil.navy.nps.util.UnsignedInt getEntityAppearance()
setEntityAppearance
public void setEntityAppearance(mil.navy.nps.util.UnsignedInt pEntityAppearance)
setEntityAppearance
public void setEntityAppearance(int pEntityAppearance)
getDeadReckoningAlgorithm
public mil.navy.nps.util.UnsignedByte getDeadReckoningAlgorithm()
setDeadReckoningAlgorithm
public void setDeadReckoningAlgorithm(mil.navy.nps.util.UnsignedByte pDeadReckoningAlgorithm)
setDeadReckoningAlgorithm
public void setDeadReckoningAlgorithm(int pDeadReckoningAlgorithm)
getDeadReckoningParameters
public byte[] getDeadReckoningParameters()
setDeadReckoningParameters
public void setDeadReckoningParameters(byte[] pDeadReckoningParameters)
- Throws:
- java.lang.RuntimeException - if Dead Reckoning parameters are too long
getEntityLinearAcceleration
public LinearAcceleration getEntityLinearAcceleration()
setEntityLinearAcceleration
public void setEntityLinearAcceleration(LinearAcceleration pAcceleration)
setEntityLinearAcceleration
public void setEntityLinearAcceleration(float pX,
float pY,
float pZ)
getEntityLinearAccelerationX
public float getEntityLinearAccelerationX()
setEntityLinearAccelerationX
public void setEntityLinearAccelerationX(float pEntityAcceleration)
getEntityLinearAccelerationY
public float getEntityLinearAccelerationY()
setEntityLinearAccelerationY
public void setEntityLinearAccelerationY(float pEntityAcceleration)
getEntityLinearAccelerationZ
public float getEntityLinearAccelerationZ()
setEntityLinearAccelerationZ
public void setEntityLinearAccelerationZ(float pEntityAcceleration)
getEntityAngularVelocity
public AngularVelocity getEntityAngularVelocity()
setEntityAngularVelocity
public void setEntityAngularVelocity(AngularVelocity pAngV)
setEntityAngularVelocity
public void setEntityAngularVelocity(float pX,
float pY,
float pZ)
getEntityAngularVelocityX
public float getEntityAngularVelocityX()
setEntityAngularVelocityX
public void setEntityAngularVelocityX(float pEntityAngularVelocity)
getEntityAngularVelocityY
public float getEntityAngularVelocityY()
setEntityAngularVelocityY
public void setEntityAngularVelocityY(float pEntityAngularVelocity)
getEntityAngularVelocityZ
public float getEntityAngularVelocityZ()
setEntityAngularVelocityZ
public void setEntityAngularVelocityZ(float pEntityAngularVelocity)
getCharacterSet
public mil.navy.nps.util.UnsignedByte getCharacterSet()
setCharacterSet
public void setCharacterSet(mil.navy.nps.util.UnsignedByte pCharacterSet)
setCharacterSet
public void setCharacterSet(int pCharacterSet)
getMarking
public java.lang.String getMarking()
setMarking
public void setMarking(java.lang.String pMarking)
getCapabilities
public mil.navy.nps.util.UnsignedInt getCapabilities()
setCapabilities
public void setCapabilities(mil.navy.nps.util.UnsignedInt pCapabilities)
setCapabilities
public void setCapabilities(int pCapabilities)
getArticulationParameterAt
public ArticulationParameter getArticulationParameterAt(int pIdx)
- Returns the articulation parameter pointed at the given index.
- Parameters:
pIdx
- the index of the articulation parameter we want to get.
- Returns:
- the articulation paramter at the given index.
addArticulationParameter
public void addArticulationParameter(ArticulationParameter pParameter)
- Inserts a new articulation parameter in the list.
- Parameters:
pParameter
- the articulation parameter to insert in the list.