Boeing Simulation 3.1 API Specification

worldsimulator
Class SimulatorUCAV

java.lang.Object
  |
  +--objects.WhatWhere
        |
        +--objects.MovableWhatWhere
              |
              +--worldsimulator.SimulatorUCAV
All Implemented Interfaces:
Component, Extensible, Locatable, Movable, Runnable, Serializable, UCAV

public class SimulatorUCAV
extends MovableWhatWhere
implements UCAV, Runnable, Component, Serializable

A component version of the UCAV.

Version:
$Revision: 1.35 $
Author:
Dave Jurgens
, Jim Adamich
See Also:
Serialized Form

Field Summary
private  boolean debug
          Flag for enabling debug message output.
protected static double DISTANCE_PER_PERIOD
          The maximum percentage of the world that the UAV can move in one update cycle.
private  objects.Locatable goal
          The location where this UCAV will attept to go towards.
private  Long id
          The unique ID used to distinguish this UAV from another UAV.
private  util.Queue imageQueue
          A queue that hold the images sent from the ComponentizedSimulator that have not been sent to the attached ObjectLocater
private  connect.ChannelBundle managerConnection
          The channels over which this UCAV will communicate with the UCAVManager.
private  int num
           
private static long serialVersionUID
           
private  connect.ChannelBundle simulatorConnection
          The channels over which this UCAV will communicate with the Simulator.
private  util.ConsumerQueue simulatorQueue
          The multithreaded queue for reading in objects from the server.
private  boolean started
          Flag for whether the ucav has begun executing periodic movements.
protected static long STEP_COST
          The time in milliseconds in which at step method can start and finish its execution.
protected static objects.Dimension UCAV_DIM
           
private static int ucavNum
           
protected static long UPDATE_PERIOD
          The time in milliseconds at which this UCAV will update it's movement.
 
Fields inherited from class objects.WhatWhere
dim, loc
 
Constructor Summary
SimulatorUCAV(connect.CreatesConnection toUCAVManager, connect.CreatesConnection toSimulator)
           
SimulatorUCAV(objects.Location loc, connect.CreatesConnection toUCAVManager, connect.CreatesConnection toSimulator)
          Constructor that takes in the location of the UCAV
 
Method Summary
protected  boolean allowMethod(util.MethodRequest request)
          Returns true due to undefined behavior at this point.
 void connect(connect.CreatesConnection host)
          This method will write out UAVImages that are in the imageQueue.
private  void debug(String s)
          Emits a message if the debug flag is enabled.
 void dropBomb()
          Notifies the ComponentizedSimulator that a bomb is to be droped at the UCAVs current location.
 boolean equals(Object other)
          Returns true if the object is a SimulatorUCAV and has the same ID value.
 connect.CreatesConnection getConnection()
          return the CreatesConnection that would allow another component to connect.
 objects.Locatable getGoal()
           
 long getID()
          Returns the unique ID for this UCAV.
 worldsimulator.SimulatorUCAV getUCAV()
          Returns an instance of this.
 int hashCode()
          Returns the hash code based on its ID.
 void receiveImage(uav.UAVImage image)
           
 void run()
          Calls the periodic step function.
 void setGoal(objects.Locatable loc)
          Sets the goal toward which this object will move.
 void startPeriodicMovements()
          Starts the WorkerThread that moves this UCAV.
 void startProcessingThread()
          This method handles MethodRequest objects that are sent to this object.
 void step()
          Moves the UCAV one step towards the goal.
 String toString()
           
 
Methods inherited from class objects.MovableWhatWhere
setLoc, setLoc
 
Methods inherited from class objects.WhatWhere
bound, getCenter, getDimensions, getDistance, getHeight, getLoc, getWidth, isEastOf, isNorthOf, isSouthOf, isWestOf, overlaps
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface objects.Movable
setLoc, setLoc
 
Methods inherited from interface objects.Locatable
getDistance, getLoc, isEastOf, isNorthOf, isSouthOf, isWestOf
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

UCAV_DIM

protected static final objects.Dimension UCAV_DIM

managerConnection

private transient connect.ChannelBundle managerConnection
The channels over which this UCAV will communicate with the UCAVManager.


simulatorConnection

private transient connect.ChannelBundle simulatorConnection
The channels over which this UCAV will communicate with the Simulator.


goal

private objects.Locatable goal
The location where this UCAV will attept to go towards.


DISTANCE_PER_PERIOD

protected static final double DISTANCE_PER_PERIOD
The maximum percentage of the world that the UAV can move in one update cycle.

See Also:
Constant Field Values

UPDATE_PERIOD

protected static final long UPDATE_PERIOD
The time in milliseconds at which this UCAV will update it's movement.

See Also:
Constant Field Values

STEP_COST

protected static final long STEP_COST
The time in milliseconds in which at step method can start and finish its execution.

See Also:
Constant Field Values

id

private final Long id
The unique ID used to distinguish this UAV from another UAV.


imageQueue

private final transient util.Queue imageQueue
A queue that hold the images sent from the ComponentizedSimulator that have not been sent to the attached ObjectLocater


started

private boolean started
Flag for whether the ucav has begun executing periodic movements.


debug

private boolean debug
Flag for enabling debug message output.


simulatorQueue

private transient util.ConsumerQueue simulatorQueue
The multithreaded queue for reading in objects from the server.


ucavNum

private static int ucavNum

num

private final int num
Constructor Detail

SimulatorUCAV

public SimulatorUCAV(connect.CreatesConnection toUCAVManager,
                     connect.CreatesConnection toSimulator)

SimulatorUCAV

public SimulatorUCAV(objects.Location loc,
                     connect.CreatesConnection toUCAVManager,
                     connect.CreatesConnection toSimulator)
Constructor that takes in the location of the UCAV

Method Detail

getGoal

public objects.Locatable getGoal()

run

public final void run()
Calls the periodic step function.

Specified by:
run in interface Runnable
See Also:
step()

setGoal

public void setGoal(objects.Locatable loc)
Sets the goal toward which this object will move.


step

public void step()
Moves the UCAV one step towards the goal. It then write requests to the simulator to update its location in the model and for an updated image of the world. The image is necessary so that the UCAV can be displayed on screen. If it did not have an image containing only itself, it would needed to be within range of a UAV at all times.


startPeriodicMovements

public void startPeriodicMovements()
Starts the WorkerThread that moves this UCAV.


dropBomb

public void dropBomb()
Notifies the ComponentizedSimulator that a bomb is to be droped at the UCAVs current location. This is done through a MethodRequest for the remote invocation of the Simulator method "notifyBombDrop"

Specified by:
dropBomb in interface UCAV

receiveImage

public void receiveImage(uav.UAVImage image)

startProcessingThread

public void startProcessingThread()
This method handles MethodRequest objects that are sent to this object.


connect

public void connect(connect.CreatesConnection host)
This method will write out UAVImages that are in the imageQueue.

Specified by:
connect in interface Component

allowMethod

protected boolean allowMethod(util.MethodRequest request)
Returns true due to undefined behavior at this point.


debug

private void debug(String s)
Emits a message if the debug flag is enabled.


getConnection

public connect.CreatesConnection getConnection()
Description copied from interface: Component
return the CreatesConnection that would allow another component to connect. Implementations should be aware that this object may be passed across a stream thereby breaking any JVM specific CreatesConnection. More documentation on this can be seen in the CreatesConnection class.

Specified by:
getConnection in interface Component

getID

public long getID()
Description copied from interface: UCAV
Returns the unique ID for this UCAV.

Specified by:
getID in interface UCAV

getUCAV

public worldsimulator.SimulatorUCAV getUCAV()
Returns an instance of this. This method is used by remote compentents such as the ComponentizedSimulator.


equals

public boolean equals(Object other)
Returns true if the object is a SimulatorUCAV and has the same ID value. Note that this is not completely safe among distrubed systems since two SimulatorUCAVs may get the same ID. However the chance of that happening is n * (1 / (263 -1)), where n is the total number of SimulatorUCAVs.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns the hash code based on its ID.

Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Boeing Simulation 3.1 API Specification

To submit a bug or feature email the author of that class. Funding for this research was provided by Boeing and DARPA.