demo.helicopter
Class TeamActionInterpreter

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

public class TeamActionInterpreter
extends java.lang.Thread

Class TeamActionInterpreter

Version:
1.0 Last Modification 20 September 2000 The TeamActionInterpreter.java file contains the logic that supports and interprets user input from the TeamPanel.java. This file also supports the aggregation and disaggregation of an independent human entity to a group, and allows the user the ability to order coordinated, tactical actions among human and non-human entities.
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
(package private)  double groundHeight
           
(package private)  EntityStatePdu heloPDU
          heloPDU - data structure to hold the aggregated helicopter entity's state
(package private)  double[] normalHeight
           
 double NOTHING
          Visibility code.
 double verticalOffset
          Meters above local terrain for entity's geometric center.
 double VISIBLE
          Visibility code.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TeamActionInterpreter(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short idNum, java.lang.String marking, boolean rtpHeaderEnabled, TeamPanel panel, BehaviorStreamBufferUDP bsb, CollisionDetectionTerrainReader ter)
          Constructor Constructor
 
Method Summary
 void brake()
           
 void calculatePosition()
           
 void checkCollision(EntityStatePdu entityPdu)
           
 void checkFirePdu(FirePdu shot)
          Function Works as Follows : 1.
 void collectFirePdus()
           
 void doBound()
          doBound
 void doLoadHelo()
          doLoadHelo
 void doUnloadHelo()
          doUnloadHelo
 EntityStatePdu getEspdu()
          getEspdu returns the vehicles current entity state protocol data unit
 java.lang.String getFrameHeaderInfo()
          getFrameHeaderInfo
 boolean getIsCollided()
           
 boolean getLiving()
           
 double getSpeed()
          getSpeed
 void reset()
          reset
 void run()
           
 void selfDestruct()
          selfDestruct
 void setBound(boolean newValue)
           
 void setClimbRate(float climbRate)
           
 void setIndependence(double indy, short id)
          setIndependence
 void setIsCollided(boolean setValue)
           
 void setLiving(boolean setValue)
           
 void setLoad(boolean newValue)
           
 void setSpeed(float spd)
          setSpeed
 void setTurnAngle(float turnAngle)
           
 void setUnloadAndDirection(boolean newValue, boolean direction)
           
 void setVisibility()
          setVisibilty
 void startLiving()
          startLiving loops indefinitely sending espdus as needed.
 void stopRun()
          stopRun
 
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

heloPDU

EntityStatePdu heloPDU
heloPDU - data structure to hold the aggregated helicopter entity's state


verticalOffset

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


NOTHING

public final double NOTHING
Visibility code. NOTHING.

See Also:
Constant Field Values

VISIBLE

public final double VISIBLE
Visibility code. VISIBLE.

See Also:
Constant Field Values

groundHeight

double groundHeight

normalHeight

double[] normalHeight
Constructor Detail

TeamActionInterpreter

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

Method Detail

run

public void run()

setIsCollided

public void setIsCollided(boolean setValue)

getIsCollided

public boolean getIsCollided()

setLiving

public void setLiving(boolean setValue)

getLiving

public boolean getLiving()

setSpeed

public void setSpeed(float spd)
setSpeed

Returns:
void

getSpeed

public double getSpeed()
getSpeed

Returns:
double - the entity's speed in knots

setClimbRate

public void setClimbRate(float climbRate)

setVisibility

public void setVisibility()
setVisibilty

Returns:
void

setTurnAngle

public void setTurnAngle(float turnAngle)

getEspdu

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

Returns:
EntityStatePDU

setIndependence

public void setIndependence(double indy,
                            short id)
setIndependence

Returns:
EntityStatePDU

startLiving

public void startLiving()
startLiving loops indefinitely sending espdus as needed. This loop runs on its own thread

Returns:
void

doBound

public void doBound()
doBound

Returns:
void

doLoadHelo

public void doLoadHelo()
doLoadHelo

Returns:
void

doUnloadHelo

public void doUnloadHelo()
doUnloadHelo

Returns:
void

stopRun

public void stopRun()
stopRun

Returns:
void

selfDestruct

public void selfDestruct()
selfDestruct

Returns:
void

getFrameHeaderInfo

public java.lang.String getFrameHeaderInfo()
getFrameHeaderInfo

Returns:
void

reset

public void reset()
reset

Returns:
void

brake

public void brake()

setBound

public void setBound(boolean newValue)

setLoad

public void setLoad(boolean newValue)

setUnloadAndDirection

public void setUnloadAndDirection(boolean newValue,
                                  boolean direction)

collectFirePdus

public void collectFirePdus()

checkFirePdu

public void checkFirePdu(FirePdu shot)
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 tank at launch. 5. Get X, Y, Z location of this tank at launch. 6. Calculate the distance between this tank and the launch point. 7. Calculate the relative velocity of the fire with respect to this tank. 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.

checkCollision

public void checkCollision(EntityStatePdu entityPdu)

calculatePosition

public void calculatePosition()