demo.helicopter
Class HeloActionInterpreterTeam

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

public class HeloActionInterpreterTeam
extends java.lang.Thread

Coordinate frame


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


Field Summary
 int HOLD
          HOLD.
 int MOUNT_HELO
          MOUNT_HELO.
 double MOUNTED
          MOUNTED.
 int NONE
          NONE.
 int UNMOUNT_HELO
          UNMOUNT_HELO.
 double UNMOUNTED
          UNMOUNTED.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
HeloActionInterpreterTeam(java.lang.String ipAddr, int portNum, int timeToLive, short siteNum, short appNum, short idNum, java.lang.String marking, boolean rtpHeaderEnabled, HeloPanel parent, boolean independent, BehaviorStreamBufferUDP bsb, CollisionDetectionTerrainReader ter)
          Constructor
 
Method Summary
 void checkCollision(EntityStatePdu entityPdu)
           
 void checkFirePdu(FirePdu shot)
          Function Works as Follows : 1.
 void checkForGroundCollision()
          checkForGroundCollision
 void checkForReload()
          checkForReload
 void collectFirePdus()
           
 void collectMountedPdus()
          collectMountedPdus
 float getAttitude()
          getAttitude - returns attitude in degrees
 float getAttitudeRad()
          getAttitudeRad - returns attitude in radians
 EntityStatePdu getEspdu()
          getEspdu
 boolean getFlying()
          getFlying
 java.lang.String getFrameHeaderInfo()
          getFrameHeaderInfo
 boolean getIsCollided()
          getIsCollided
 EntityStatePdu getMountedEspdu()
          getMountedEspdu returns the aggregation entity's current entity state protocol data unit
 double getSpeed()
          getSpeed - returns speed in meters per second
 float getTorque()
          getTorque
 void hover()
           
 void leftPedalTurn()
           
 void lowerNose()
          lowerNose
 void raiseNose()
          raiseNose
 void reset()
           
 void rightPedalTurn()
           
 void run()
          run - start sending espdus, called from the helicopter control panel
 void selfDestruct()
          selfDestruct
 void sendFirePdu()
           
 void setAttitude(float angle)
          setAttitude
 void setBankAngle(float bankAngle)
          setBankAngle - called by the helicopter control panel whenever the bankAngle scrollbar on the control panel is adjusted.
 void setFlying(boolean setValue)
          setFlying
 double setIndependence(boolean aggregated)
          setIndependence
 void setIsCollided(boolean setValue)
          setIsCollided
 void setMovementOrder(int formationIndicator)
          setMovementOrder
 void setSpeed(float newSpeed)
          setSpeed is called by helicopter control panel 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 EntityStatePdu.
 void setTorque(float tor)
          setTorque - 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()
          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

MOUNTED

public final double MOUNTED
MOUNTED. Mounted code.

See Also:
Constant Field Values

UNMOUNTED

public final double UNMOUNTED
UNMOUNTED. Mounted code.

See Also:
Constant Field Values

MOUNT_HELO

public final int MOUNT_HELO
MOUNT_HELO. movementOrder.

See Also:
Constant Field Values

UNMOUNT_HELO

public final int UNMOUNT_HELO
UNMOUNT_HELO. movementOrder.

See Also:
Constant Field Values

HOLD

public final int HOLD
HOLD. movementOrder.

See Also:
Constant Field Values

NONE

public final int NONE
NONE. movementOrder.

See Also:
Constant Field Values
Constructor Detail

HeloActionInterpreterTeam

public HeloActionInterpreterTeam(java.lang.String ipAddr,
                                 int portNum,
                                 int timeToLive,
                                 short siteNum,
                                 short appNum,
                                 short idNum,
                                 java.lang.String marking,
                                 boolean rtpHeaderEnabled,
                                 HeloPanel parent,
                                 boolean independent,
                                 BehaviorStreamBufferUDP bsb,
                                 CollisionDetectionTerrainReader ter)
Constructor

Method Detail

run

public void run()
run - start sending espdus, called from the helicopter control panel

Returns:
void

setIsCollided

public void setIsCollided(boolean setValue)
setIsCollided

Returns:
void

getIsCollided

public boolean getIsCollided()
getIsCollided

Returns:
boolean isCollided

setFlying

public void setFlying(boolean setValue)
setFlying

Returns:
void

getFlying

public boolean getFlying()
getFlying

Returns:
boolean flying

setSpeed

public void setSpeed(float newSpeed)
setSpeed is called by helicopter control panel 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 EntityStatePdu. The new values are then sent as part of the espdu the next time the startFlying() method loops.

Parameters:
newSpeed -
Returns:
void

raiseNose

public void raiseNose()
raiseNose

Returns:
void

lowerNose

public void lowerNose()
lowerNose

Returns:
void

setAttitude

public void setAttitude(float angle)
setAttitude

Returns:
void

getSpeed

public double getSpeed()
getSpeed - returns speed in meters per second

Returns:
double speed

getAttitude

public float getAttitude()
getAttitude - returns attitude in degrees

Returns:
float attitude

getAttitudeRad

public float getAttitudeRad()
getAttitudeRad - returns attitude in radians

Returns:
float attitude

setTorque

public void setTorque(float tor)
setTorque - 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.

Parameters:
tor -
Returns:
void

setIndependence

public double setIndependence(boolean aggregated)
setIndependence

Returns:
double - an articulated parameter for an aggregation entity

getTorque

public float getTorque()
getTorque

Returns:
float torque

setBankAngle

public void setBankAngle(float bankAngle)
setBankAngle - called by the helicopter control panel 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.

Parameters:
bankAngle -
Returns:
void

getEspdu

public EntityStatePdu getEspdu()
getEspdu

Returns:
EntityStatePdu

getMountedEspdu

public EntityStatePdu getMountedEspdu()
getMountedEspdu returns the aggregation entity's current entity state protocol data unit

Returns:
EntityStatePDU

startFlying

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

Returns:
void

checkForGroundCollision

public void checkForGroundCollision()
checkForGroundCollision

Returns:
void

checkForReload

public void checkForReload()
checkForReload

Returns:
void

selfDestruct

public void selfDestruct()
selfDestruct

Returns:
void

getFrameHeaderInfo

public java.lang.String getFrameHeaderInfo()
getFrameHeaderInfo

Returns:
String

stopRun

public void stopRun()
stopRun

Returns:
String

setMovementOrder

public void setMovementOrder(int formationIndicator)
setMovementOrder

Returns:
void

reset

public void reset()

sendFirePdu

public void sendFirePdu()

hover

public void hover()

leftPedalTurn

public void leftPedalTurn()

rightPedalTurn

public void rightPedalTurn()

collectMountedPdus

public void collectMountedPdus()
collectMountedPdus

Returns:
void

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)