demo.helicopter
Class HeloActionInterpreter

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

public class HeloActionInterpreter
extends java.lang.Thread

Coordinate frame


                 -Z
                  |
                  |
                  |
                  |
                  |_________ X
                 /
                /
               /
              Y
 


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HeloActionInterpreter(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short id, java.lang.String marking, boolean rtpHeaderEnabled, HeloControlPanel parent)
           
 
Method Summary
 void checkCollision(EntityStatePdu entityPdu)
           
 void checkFirePdu(FirePdu shot)
          Function Works as Follows : 1.
 void checkForGroundCollision()
           
 void checkForReload()
           
 void collectFirePdus()
           
 float getAttitude()
           
 float getAttitudeRad()
           
 EntityStatePdu getEspdu()
           
 boolean getFlying()
           
 java.lang.String getFrameHeaderInfo()
           
 boolean getIsCollided()
           
 double getSpeed()
           
 float getTorque()
           
 void hover()
           
 void leftPedalTurn()
           
 void lowerNose()
           
 void raiseNose()
           
 void reset()
           
 void rightPedalTurn()
           
 void run()
           
 void selfDestruct()
           
 void sendFirePdu()
           
 void setAttitude(float angle)
           
 void setBankAngle(float bankAngle)
          called by TestFrame.java whenever the bankAngle scrollbar on the control panel is adjusted.
 void setFlying(boolean setValue)
           
 void setIsCollided(boolean setValue)
           
 void setSpeed(float newSpeed)
          setSpeed is called by TestFrame.java whenever the airspeed scrollbar on the control panel is adjusted This method calculates new X & Y linear velocities and sets the new values in the entity state Pdu.
 void setTorque(float tor)
          called by TestFrame.java whenever the collective(power) scrollbar on the control panel is adjusted.
 void startFlying()
          startFlying loops indefinitely sending espdus in its own thread.
 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

HeloActionInterpreter

public HeloActionInterpreter(java.lang.String ipAddr,
                             int portNum,
                             int timeToLive,
                             short siteNum,
                             short appNum,
                             short id,
                             java.lang.String marking,
                             boolean rtpHeaderEnabled,
                             HeloControlPanel 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)
setSpeed is called by TestFrame.java whenever the airspeed scrollbar on the control panel is adjusted This method calculates new X & Y linear velocities and sets the new values in the entity state Pdu. The new values are then sent as part of the espdu the next time the startFlying() method loops.


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)
called by TestFrame.java whenever the collective(power) scrollbar on the control panel is adjusted. This method calculates new Z linear velocity and sets the new value in the entity state Pdu. The new value is then sent as part of the espdu the next time the startFlying() method loops.


getTorque

public float getTorque()

setBankAngle

public void setBankAngle(float bankAngle)
called by TestFrame.java whenever the bankAngle scrollbar on the control panel is adjusted. This method calculates new Z angular velocity and sets the new value in the entity state Pdu. The new bank angle (Phi) is also set into the espdu. The new values are then sent as part of the espdu the next time the startFlying() method loops.


getEspdu

public EntityStatePdu getEspdu()

startFlying

public void startFlying()
startFlying loops indefinitely sending espdus in its own thread.


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

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