demo.helicopter
Class HumanActionInterpreterTeam

java.lang.Object
  extended byjava.lang.Thread
      extended bydemo.helicopter.HumanActionInterpreterTeam
All Implemented Interfaces:
java.lang.Runnable

public class HumanActionInterpreterTeam
extends java.lang.Thread

Class HumanActionInterpreterTeam

Version:
1.0 Last Modification 20 September 2000 The HumanActionInterpreterTeam.java file contains the logic that supports and interprets user input from the HumanPanel.java. This file also supports the aggregation and disaggregation of an independent human entity to a group, to perform coordinated, tactical actions.
Entity coordinate systems (right-hand rule applies):

          DIS                 VRML

      -Z entity up         Y entity up
           ^                   ^
           |                   |
           |                   |
           |                   |
           +------> X          +-------> X    nose of entity body ( North )
          /                   /
         /                   /
        /                   /
       Y                   Z
         right-hand side
         of entity body ( East )

  Rotation angle axes (right-hand rule applies):

           DIS        VRML      Angle of rotation

  Roll      X          X         phi
  Pitch     Y          Z        theta
  Yaw       Z         -Y         psi
Author:
- Thomas E. Miller

Field Summary
 int COLUMN
          COLUMN.
 int HOLD
          HOLD.
 double JUMP
          JUMP.
 double KNEEL
          KNEEL.
 int LINE
          LINE.
 int MOUNT_HELO
          MOUNT_HELO.
 double MOUNTED
          MOUNTED.
 int NONE
          NONE.
 double NOTHING
          NOTHING.
 double RUN
          RUN.
 double STAND
          STAND.
 int UNMOUNT_HELO
          UNMOUNT_HELO.
 double UNMOUNTED
          UNMOUNTED.
 double verticalOffset
          verticalOffset - Meters above local terrain for entity's geometric center.
 double WALK
          WALK.
 int WEDGE
          WEDGE.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HumanActionInterpreterTeam(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short idNum, java.lang.String marking, boolean rtpHeaderEnabled, HumanPanel panel, boolean independent, BehaviorStreamBufferUDP bsb, CollisionDetectionTerrainReader ter)
          Constructor
 
Method Summary
 void brake()
          brake - stops the Human
 void calculatePosition(double offset, double angleOff)
          calculatePosition - calulates the vector from the entity's current position to its goal position and orientation as determined by its rule set
 void checkCollision(EntityStatePdu entityPdu)
          checkCollision - checks to see if two entities geomentry have intersected
 void checkFirePdu(FirePdu shot)
          checkFirePDUs Function Works as Follows : 1.
 void checkForReload()
          checkForReload checks for the ability to reload ammunition
 void collectFirePdus()
          collectFirePDUs - collects the fire PDUs from the stream buffer
 void collectMountedPdus()
          collectMountedPdus - reads the stream buffer to get the aggregation entity's latest Espdu
 void column()
          column - the column rule set
 void findMagAndAng(double theXComp, double theYComp)
          findMagAndAng - finds the distance and angle to a goal position taking X and Y component offsets as arguments
 void findMagnitudeAndAngle(EntityStatePdu to, EntityStatePdu from)
          findMagnitudeAndAngle - finds the distance and angle to a goal position taking Espdus as arguments
 EntityStatePdu getEspdu()
          getEspdu returns the vehicles current entity state protocol data unit
 java.lang.String getFrameHeaderInfo()
          getFrameHeaderInfo - provides the frame header information
 boolean getIsCollided()
          getIsCollided - returns the isCollided state boolean
 boolean getLiving()
          getLiving - returns the active state of the entity
 EntityStatePdu getMountedEspdu()
          getMountedEspdu returns the aggregation entity's current entity state protocol data unit
 double getSpeed()
          getSpeed - returns the entity's speed
 void kneel()
          kneel - Makes the Human kneel
 void line()
          line - the line rule set
 void loadHelo()
          loadHelo - the mount helicopter rule set
 void reset()
          reset - handles input from the reset button
 void run()
          run - start sending espdus calls startLiving () which is an infinite espdu sending loop
 void selfDestruct()
          selfDestruct - causes the entity to self destruct
 void sendFirePdu()
          sendFirePDU - send fire PDU information for hit determination
 double setIndependence(boolean inSquad)
          setIndependence - sets the mounted state of the entity and provides the correct true or relative position
 void setIsCollided(boolean setValue)
          setIsCollided - sets the isCollided state boolean
 void setLiving(boolean setValue)
          setLiving - makes the entity active
 void setMovementOrder(int formationIndicator)
          setMovementOrder - sets the active movement order to initiate group actions
 void setSpeed(float spd)
          setSpeed - sets the speed of the entity from user input Also determines the behavior code based off speed
 void setTurnAngle(float turnAngle)
          setTurnAngle - sets the angle of turn of the entity based off user inputs
 void startLiving()
          startLiving loops indefinitely sending espdus every 500 ms or so.
 void stopRun()
          stopRun - stops the simulation run for this entity
protected  void trace(java.lang.String pDiagnostic)
          trace Guaranteed trace output routine.
 void unloadHelo()
          unloadHelo - the unmount helicopter rule set
 void wedge()
          wedge - the wedge rule set
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

verticalOffset

public double verticalOffset
verticalOffset - Meters above local terrain for entity's geometric center.


NOTHING

public final double NOTHING
NOTHING. Behavior code - enumeration of the individual behaviors.

See Also:
Constant Field Values

STAND

public final double STAND
STAND. Behavior code.

See Also:
Constant Field Values

WALK

public final double WALK
WALK. Behavior code.

See Also:
Constant Field Values

RUN

public final double RUN
RUN. Behavior code.

See Also:
Constant Field Values

JUMP

public final double JUMP
JUMP. Behavior code.

See Also:
Constant Field Values

KNEEL

public final double KNEEL
KNEEL. Behavior code.

See Also:
Constant Field Values

MOUNTED

public final double MOUNTED
MOUNTED. Mounted code.

See Also:
Constant Field Values

UNMOUNTED

public final double UNMOUNTED
UNMOUNTED. Mounted code.

See Also:
Constant Field Values

COLUMN

public final int COLUMN
COLUMN. movementOrder.

See Also:
Constant Field Values

LINE

public final int LINE
LINE. movementOrder.

See Also:
Constant Field Values

WEDGE

public final int WEDGE
WEDGE. movementOrder.

See Also:
Constant Field Values

MOUNT_HELO

public final int MOUNT_HELO
MOUNT_HELO. movementOrder.

See Also:
Constant Field Values

UNMOUNT_HELO

public final int UNMOUNT_HELO
UNMOUNT_HELO. movementOrder.

See Also:
Constant Field Values

HOLD

public final int HOLD
HOLD. movementOrder.

See Also:
Constant Field Values

NONE

public final int NONE
NONE. movementOrder.

See Also:
Constant Field Values
Constructor Detail

HumanActionInterpreterTeam

public HumanActionInterpreterTeam(java.lang.String ipAddr,
                                  int portNum,
                                  int timeToLive,
                                  short siteNum,
                                  short appNum,
                                  short idNum,
                                  java.lang.String marking,
                                  boolean rtpHeaderEnabled,
                                  HumanPanel panel,
                                  boolean independent,
                                  BehaviorStreamBufferUDP bsb,
                                  CollisionDetectionTerrainReader ter)
Constructor

Method Detail

run

public void run()
run - start sending espdus calls startLiving () which is an infinite espdu sending loop

Returns:
void

setIsCollided

public void setIsCollided(boolean setValue)
setIsCollided - sets the isCollided state boolean

Returns:
void

getIsCollided

public boolean getIsCollided()
getIsCollided - returns the isCollided state boolean

Returns:
boolean isCollided

setLiving

public void setLiving(boolean setValue)
setLiving - makes the entity active

Returns:
void

getLiving

public boolean getLiving()
getLiving - returns the active state of the entity

Returns:
boolean alive

setSpeed

public void setSpeed(float spd)
setSpeed - sets the speed of the entity from user input Also determines the behavior code based off speed

Returns:
void

getSpeed

public double getSpeed()
getSpeed - returns the entity's speed

Returns:
double speed - the magnitude of the entity's velocity

setIndependence

public double setIndependence(boolean inSquad)
setIndependence - sets the mounted state of the entity and provides the correct true or relative position

Returns:
double - an articulated parameter for an aggregation entity

setTurnAngle

public void setTurnAngle(float turnAngle)
setTurnAngle - sets the angle of turn of the entity based off user inputs

Returns:
void

getEspdu

public EntityStatePdu getEspdu()
getEspdu returns the vehicles current entity state protocol data unit

Returns:
EntityStatePDU

getMountedEspdu

public EntityStatePdu getMountedEspdu()
getMountedEspdu returns the aggregation entity's current entity state protocol data unit

Returns:
EntityStatePDU

startLiving

public void startLiving()
startLiving loops indefinitely sending espdus every 500 ms or so. This loop runs on its own thread. Determines the entity's correct positional and velocity states in either the relative or true coordinate systems

Returns:
void

column

public void column()
column - the column rule set

Returns:
void

line

public void line()
line - the line rule set

Returns:
void

wedge

public void wedge()
wedge - the wedge rule set

Returns:
void

loadHelo

public void loadHelo()
loadHelo - the mount helicopter rule set

Returns:
void

unloadHelo

public void unloadHelo()
unloadHelo - the unmount helicopter rule set

Returns:
void

calculatePosition

public void calculatePosition(double offset,
                              double angleOff)
calculatePosition - calulates the vector from the entity's current position to its goal position and orientation as determined by its rule set

Returns:
void

stopRun

public void stopRun()
stopRun - stops the simulation run for this entity

Returns:
void

setMovementOrder

public void setMovementOrder(int formationIndicator)
setMovementOrder - sets the active movement order to initiate group actions

Returns:
void

findMagnitudeAndAngle

public void findMagnitudeAndAngle(EntityStatePdu to,
                                  EntityStatePdu from)
findMagnitudeAndAngle - finds the distance and angle to a goal position taking Espdus as arguments

Returns:
void

findMagAndAng

public void findMagAndAng(double theXComp,
                          double theYComp)
findMagAndAng - finds the distance and angle to a goal position taking X and Y component offsets as arguments

Returns:
void

checkForReload

public void checkForReload()
checkForReload checks for the ability to reload ammunition

Returns:
void

selfDestruct

public void selfDestruct()
selfDestruct - causes the entity to self destruct

Returns:
void

getFrameHeaderInfo

public java.lang.String getFrameHeaderInfo()
getFrameHeaderInfo - provides the frame header information

Returns:
void

collectMountedPdus

public void collectMountedPdus()
collectMountedPdus - reads the stream buffer to get the aggregation entity's latest Espdu

Returns:
void

reset

public void reset()
reset - handles input from the reset button

Returns:
void

sendFirePdu

public void sendFirePdu()
sendFirePDU - send fire PDU information for hit determination

Returns:
void

brake

public void brake()
brake - stops the Human

Returns:
void

kneel

public void kneel()
kneel - Makes the Human kneel

Returns:
void

collectFirePdus

public void collectFirePdus()
collectFirePDUs - collects the fire PDUs from the stream buffer

Returns:
void

checkFirePdu

public void checkFirePdu(FirePdu shot)
checkFirePDUs Function Works as Follows : 1. Get X, Y, Z components of launch velocity. 2. Calculate launch velocity vector. 3. Get X, Y, Z location of the launch. 4. Get X, Y, Z velocity componets of this human at launch. 5. Get X, Y, Z location of this human at launch. 6. Calculate the distance between this human and the launch point. 7. Calculate the relative velocity of the fire with respect to this human. 8. Find the time to fly for this distance. 9. Find the actual X, Y, Z location for the fire after "time to fly". 10. Calculate the distance between this tank and the new location of the fire after "time to fly. 11. If the distance is equal to or less than HIT_RADIUS a hit has occured.

Parameters:
shot - Fire PDU that is being checked.
Returns:
void

checkCollision

public void checkCollision(EntityStatePdu entityPdu)
checkCollision - checks to see if two entities geomentry have intersected

Returns:
void

trace

protected void trace(java.lang.String pDiagnostic)
trace Guaranteed trace output routine. Pass in a string, and it gets printed out on the console. You can pass in strings such as "foo " + bar.getName(). Text output appears in the Java Console (CosmoPlayer browser) or in the VRML console (WorldView browser).

Can't be static or all entities look the same.

Returns:
void