demo.helicopter
Class AgentHeloActionInterpreter

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

public class AgentHeloActionInterpreter
extends java.lang.Thread

Coordinate frame

                 -Z
                  |
                  |____ X
                 /
                Y
 


Field Summary
static int DEFENSIVE
           
static int OFFENSIVE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AgentHeloActionInterpreter(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short id, java.lang.String marking, boolean rtpHeaderEnabled, AgentHeloControlPanel parent)
           
 
Method Summary
 void checkCollision(EntityStatePdu entityPdu)
           
 void checkFirePdu(FirePdu shot)
          Function Works as Follows : 1.
 void checkForGroundCollision()
           
 void checkForReload()
           
 void collectSensorPdus()
           
 double determineRange(EntityStatePdu firstEspu, EntityStatePdu secondEspdu)
           
 void flyToHere(EntityStatePdu here)
           
 float getAttitude()
           
 float getAttitudeRad()
           
 boolean getDefensive()
           
 EntityStatePdu getEspdu()
           
 void getFlag(EntityStatePdu enemyFlagEspdu)
           
 boolean getFlying()
           
 java.lang.String getFrameHeaderInfo()
           
 boolean getIsCollided()
           
 boolean getOffensive()
           
 double getSpeed()
           
 float getTorque()
           
 void hover()
           
 int interceptAngle(EntityStatePdu me, EntityStatePdu target)
           
 void interpretProtocol(java.util.Vector receivedData)
           
 void leftPedalTurn()
           
 void lowerNose()
           
 void raiseNose()
           
 void reset()
           
 void rightPedalTurn()
           
 void run()
           
 void runAgent()
           
 void selfDestruct()
           
 void sendFirePdu()
           
 void setAttitude(float angle)
           
 void setBankAngle(float bankAngle)
           
 void setDefensive()
           
 void setFlying(boolean setValue)
           
 void setIsCollided(boolean setValue)
           
 void setOffensive()
           
 void setSpeed(float newSpeed)
           
 void setTorque(float tor)
           
 void startFlying()
           
 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

AgentHeloActionInterpreter

public AgentHeloActionInterpreter(java.lang.String ipAddr,
                                  int portNum,
                                  int timeToLive,
                                  short siteNum,
                                  short appNum,
                                  short id,
                                  java.lang.String marking,
                                  boolean rtpHeaderEnabled,
                                  AgentHeloControlPanel parent)
Method Detail

run

public void run()

setIsCollided

public void setIsCollided(boolean setValue)

getIsCollided

public boolean getIsCollided()

setFlying

public void setFlying(boolean setValue)

getFlying

public boolean getFlying()

setSpeed

public void setSpeed(float newSpeed)

raiseNose

public void raiseNose()

lowerNose

public void lowerNose()

setAttitude

public void setAttitude(float angle)

getSpeed

public double getSpeed()

getAttitude

public float getAttitude()

getAttitudeRad

public float getAttitudeRad()

setTorque

public void setTorque(float tor)

getTorque

public float getTorque()

setBankAngle

public void setBankAngle(float bankAngle)

getEspdu

public EntityStatePdu getEspdu()

startFlying

public void startFlying()

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)

flyToHere

public void flyToHere(EntityStatePdu here)

interceptAngle

public int interceptAngle(EntityStatePdu me,
                          EntityStatePdu target)

determineRange

public double determineRange(EntityStatePdu firstEspu,
                             EntityStatePdu secondEspdu)

checkForGroundCollision

public void checkForGroundCollision()

checkForReload

public void checkForReload()

selfDestruct

public void selfDestruct()

getFrameHeaderInfo

public java.lang.String getFrameHeaderInfo()

stopRun

public void stopRun()

reset

public void reset()

sendFirePdu

public void sendFirePdu()

hover

public void hover()

leftPedalTurn

public void leftPedalTurn()

rightPedalTurn

public void rightPedalTurn()

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