demo.helicopter
Class AgentTankActionInterpreter

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

public class AgentTankActionInterpreter
extends java.lang.Thread


Field Summary
static int DEFENSIVE
           
static int OFFENSIVE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AgentTankActionInterpreter(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short idNum, java.lang.String marking, boolean rtpHeaderEnabled, AgentTankControlPanel 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 collectSensorPdus()
           
 void depressGun()
           
 double determineRange(EntityStatePdu firstEspu, EntityStatePdu secondEspdu)
           
 void driveToHere(EntityStatePdu here)
           
 void elevateGun()
           
 void engageEnemy(EntityStatePdu enemyUnitEspdu)
           
 boolean getDefensive()
           
 boolean getDriving()
           
 EntityStatePdu getEspdu()
           
 void getFlag(EntityStatePdu enemyFlagEspdu)
           
 java.lang.String getFrameHeaderInfo()
           
 boolean getIsCollided()
           
 boolean getOffensive()
           
 double getSpeed()
           
 int interceptAngle(EntityStatePdu me, EntityStatePdu target)
           
 void interpretProtocol(java.util.Vector receivedData)
           
 void leftTurretTurn()
           
 void protectFlag(EntityStatePdu friendlyFlagEspdu)
           
 int relativeTurretAngle()
           
 void reset()
           
 void resetTurret()
           
 void rightTurretTurn()
           
 void run()
           
 void runAgent()
           
 void selfDestruct()
           
 void sendFirePdu()
           
 void sendMainFirePdu()
           
 void setDefensive()
           
 void setDriving(boolean setValue)
           
 void setIsCollided(boolean setValue)
           
 void setOffensive()
           
 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
 

Field Detail

OFFENSIVE

public static final int OFFENSIVE
See Also:
Constant Field Values

DEFENSIVE

public static final int DEFENSIVE
See Also:
Constant Field Values
Constructor Detail

AgentTankActionInterpreter

public AgentTankActionInterpreter(java.lang.String ipAddr,
                                  int portNum,
                                  int timeToLive,
                                  short siteNum,
                                  short appNum,
                                  short idNum,
                                  java.lang.String marking,
                                  boolean rtpHeaderEnabled,
                                  AgentTankControlPanel 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()

setOffensive

public void setOffensive()

setDefensive

public void setDefensive()

getOffensive

public boolean getOffensive()

getDefensive

public boolean getDefensive()

runAgent

public void runAgent()

getFlag

public void getFlag(EntityStatePdu enemyFlagEspdu)

protectFlag

public void protectFlag(EntityStatePdu friendlyFlagEspdu)

engageEnemy

public void engageEnemy(EntityStatePdu enemyUnitEspdu)

resetTurret

public void resetTurret()

driveToHere

public void driveToHere(EntityStatePdu here)

interceptAngle

public int interceptAngle(EntityStatePdu me,
                          EntityStatePdu target)

relativeTurretAngle

public int relativeTurretAngle()

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()

collectSensorPdus

public void collectSensorPdus()

interpretProtocol

public void interpretProtocol(java.util.Vector receivedData)

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)

determineRange

public double determineRange(EntityStatePdu firstEspu,
                             EntityStatePdu secondEspdu)