demo.helicopter
Class TankActionInterpreter

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

public class TankActionInterpreter
extends java.lang.Thread


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TankActionInterpreter(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short idNum, java.lang.String marking, boolean rtpHeaderEnabled, TankControlPanel panel)
           
 
Method Summary
 void brake()
           
 void checkCollision(EntityStatePdu entityPdu)
           
 void checkFirePdu(FirePdu shot)
          Function Works as Follows : 1.
 void checkForGroundCollision()
           
 void checkForGunElevate()
           
 void checkForReload()
           
 void checkForTurretTurn()
           
 void collectFirePdus()
           
 void depressGun()
           
 void elevateGun()
           
 boolean getDriving()
           
 EntityStatePdu getEspdu()
           
 java.lang.String getFrameHeaderInfo()
           
 boolean getIsCollided()
           
 double getSpeed()
           
 void leftTurretTurn()
           
 void reset()
           
 void rightTurretTurn()
           
 void run()
           
 void selfDestruct()
           
 void sendFirePdu()
           
 void sendMainFirePdu()
           
 void setDriving(boolean setValue)
           
 void setIsCollided(boolean setValue)
           
 void setSpeed(float spd)
           
 void setTurnAngle(float turnAngle)
           
 void startDriving()
           
 void 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
 

Constructor Detail

TankActionInterpreter

public TankActionInterpreter(java.lang.String ipAddr,
                             int portNum,
                             int timeToLive,
                             short siteNum,
                             short appNum,
                             short idNum,
                             java.lang.String marking,
                             boolean rtpHeaderEnabled,
                             TankControlPanel panel)
Method Detail

run

public void run()

setIsCollided

public void setIsCollided(boolean setValue)

getIsCollided

public boolean getIsCollided()

setDriving

public void setDriving(boolean setValue)

getDriving

public boolean getDriving()

setSpeed

public void setSpeed(float spd)

getSpeed

public double getSpeed()

setTurnAngle

public void setTurnAngle(float turnAngle)

getEspdu

public EntityStatePdu getEspdu()

startDriving

public void startDriving()

checkForGroundCollision

public void checkForGroundCollision()

stopRun

public void stopRun()

checkForGunElevate

public void checkForGunElevate()

checkForTurretTurn

public void checkForTurretTurn()

checkForReload

public void checkForReload()

selfDestruct

public void selfDestruct()

getFrameHeaderInfo

public java.lang.String getFrameHeaderInfo()

reset

public void reset()

sendFirePdu

public void sendFirePdu()

sendMainFirePdu

public void sendMainFirePdu()

brake

public void brake()

leftTurretTurn

public void leftTurretTurn()

rightTurretTurn

public void rightTurretTurn()

elevateGun

public void elevateGun()

depressGun

public void depressGun()

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)