public abstract class Execution extends Object implements Runnable, JoystickEventListener
Modifier and Type | Class and Description |
---|---|
static interface |
Execution.IdleHandler
An object which implements this interface will do something (or nothing) with the time it is given.
|
Modifier and Type | Field and Description |
---|---|
protected JAXBElement<?> |
currentCommandElement
XML (AVCL) or text command currently being executed
|
protected int |
currentCommandIndex |
DriverInterface |
drivers
Intended as a driver interface that can control the vehicle -- SG
|
Dynamics |
dynamics
Reference to the Dynamics module if running in virtual world--must be initialized by inheriting class
|
List<String> |
dynamicsArgs
Temporary container for arguments that must be passed to Dynamics
|
protected EnvironmentCustomer |
environmentCustomer
Updater object.
|
String |
executionKey
Unique key identifying this execution instance
|
protected boolean |
firstTime
We only want this to happen on the first call of this flag
|
CommunicationsHandler |
interVehicleCommunicationsHandler
Reference to the handler for inter-vehicle communications
|
EnumMap<JoystickEvent.CommandType,JoystickEvent> |
joystickEventHashMap
If under manual control, the joystick or other device will send events from
a separate thread.
|
static String |
KILL_CMD |
boolean |
killRun
Whether kill signal (stop mission) command received from workbench interface
|
Mission |
mission
parsed XML (AVCL) mission script (if utilized) and mission results--must be initialized by inheriting class
|
static String |
MULTIPLELOOPSMISSION_CMD |
static String |
PAUSE_CMD |
static String |
REALTIME_CMD |
static String |
RESUME_CMD |
RuntimeFlags |
runtimeFlags
global run-time parameters
|
protected WorkbenchCommunicator |
stateReportChannel
The above reference can be hijacked by telemetry missions to send back different stuff than is done in this
base class.
|
StateVector |
stateVector
state elements from virtual world--must be initialized by inheriting class
|
Strategic |
strategicLevel
Reference to the strategic level object (used with an agenda-based mission)
|
Thread |
strategicThread |
TacticalConnection |
tacticalConnection
network connection between vehicle and tactical level--must be initialized by inheriting class
|
Tactical |
tacticalLevel
Reference to the tactical level object (used with an agenda-based mission)
|
Thread |
tacticalThread |
protected String |
vehicleShortName
"uuv, uav, etc." -- initialized by inheriting class
|
VWConnection |
virtualWorldConnection
network connection between vehicle and virtual world--must be initialized by inheriting class
|
WorkbenchCommunicator |
workbenchCommunicator
provides a communications capability between the execution and dynamics objects and the workbench
|
Constructor and Description |
---|
Execution()
Creates a new instance of Vehicle
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
act() |
protected abstract Mission |
buildNewMission(boolean writeResults) |
boolean |
checkKill(String workbenchDirective)
Check whether to log killing an execution mission.
|
boolean |
checkMultipleLoopsMission(String workbenchDirective)
Toggle whether multipleLoopsMission mode is true or not for this mission
|
void |
checkPauseResume(String workbenchDirective)
Toggle whether paused or whether execution has resumed
|
boolean |
checkPauseSeparateJvm()
// TODO simplify, handle singleJvm
Routine to watch Sys input for pause and kill commands.
|
boolean |
checkRealtime(String workbenchDirective)
Toggle whether timing mode is real time (i.e. system clock time) or simulation time (as fast as possible)
|
protected void |
cleanUpFollowingMissionLoopCompletion() |
protected abstract void |
decide()
Determines appropriate action needed to complete current command,
using controller to compute
|
protected void |
decideExternal()
Determines what appropriate action to complete current command, using external process.
|
protected void |
endPositionReports() |
protected void |
endStateReports() |
protected abstract ControlParameters |
getControlParameters() |
protected long |
getEnvironmentalUpdatePeriodMs() |
JoystickEvent |
getNextJoystickEvent()
Returns the next joystick event from the queue, or null if there are no events.
|
protected long |
getPositionUpdatePeriod() |
abstract StateVector |
getState() |
protected long |
getStateReportUpdatePeriod() |
protected String |
getTabDelimitedFormattedStateFieldNames() |
protected String |
getTabDelimitedStateValues() |
TacticalConnection |
getTacticalConnection()
Returns a reference to the tactical level communications object
|
abstract int |
getVehicleType() |
WorkbenchCommunicator |
getWorkbenchCommunicator() |
protected void |
initializeEnvironmentUpdates()
Build the update object.
|
boolean |
isOneThreadedJvmForAllMissions() |
boolean |
isRunning() |
protected abstract void |
missionFinished()
Notification of mission completion
|
protected void |
missionSimulationLoopHouseKeepingFinal(ControlParameters controlParameters)
Cleanup and setup required at the end of each timestep closed-loop iteration,
including checks to see if there is another command to handle
|
protected void |
missionSimulationLoopHouseKeepingInitial(ControlParameters controlParameters)
Setup required at the beginning of each iteration of the closed loop
|
protected void |
missionSimulationLoopsRunFullMission(ControlParameters controlParameters)
Mission execution closed-loop control.
|
void |
notifyCommandComplete()
Notifies the tactical level if the currently executing command is complete
|
void |
receiveJoystickEvent(JoystickEvent controllerEvent,
JoystickObserver dispatcher)
Receives an event from the joystick controller and adds it to a
thread-safe queue for retrieval by the Execution object.
|
void |
reset()
Resets all component objects and variables to start over.
|
void |
run()
This is where the execution thread begins, initiated by the enclosing thread from DynamicsExecutionThread2.
|
protected abstract void |
sense() |
protected void |
setAgendaLaunchXY(Mission mis) |
void |
setVehicleCharacteristics(VehicleCharacteristics chars)
Sets the vehicle characteristics object
|
protected static boolean |
shouldUseSingleJvm(String[] commandLineArgs)
Returns true if the commandLineArgs passed in contain the argument
"singleJvm", false otherwise.
|
protected void |
startEnvironmentalUpdates(double starttime) |
protected void |
startPositionReports() |
protected void |
startStateReports() |
protected void |
stopEnviroUpdates()
Signal to stop or pause environmental updates.
|
void |
useMetric(boolean setting)
Used to switch between metric and English units of measure
|
void |
useRadians(boolean setting)
Used to switch between radian and degree angular measurements
|
public WorkbenchCommunicator workbenchCommunicator
public final EnumMap<JoystickEvent.CommandType,JoystickEvent> joystickEventHashMap
protected WorkbenchCommunicator stateReportChannel
public CommunicationsHandler interVehicleCommunicationsHandler
public StateVector stateVector
public Mission mission
public RuntimeFlags runtimeFlags
public VWConnection virtualWorldConnection
public TacticalConnection tacticalConnection
public Dynamics dynamics
public String executionKey
public Tactical tacticalLevel
public Thread tacticalThread
public Strategic strategicLevel
public Thread strategicThread
public static String PAUSE_CMD
public static String RESUME_CMD
public static String KILL_CMD
public static String REALTIME_CMD
public static String MULTIPLELOOPSMISSION_CMD
public List<String> dynamicsArgs
public DriverInterface drivers
public boolean killRun
protected JAXBElement<?> currentCommandElement
protected int currentCommandIndex
protected boolean firstTime
protected String vehicleShortName
protected EnvironmentCustomer environmentCustomer
protected abstract ControlParameters getControlParameters()
protected abstract Mission buildNewMission(boolean writeResults)
protected abstract void missionFinished()
protected abstract void sense()
protected abstract void decide()
protected abstract void act()
public abstract int getVehicleType()
Dynamics.AGENDA
, Dynamics.UAV
, Dynamics.UGV
, Dynamics.USV
, Dynamics.UUV
, Dynamics.MUNITION
, Dynamics.ROV
public abstract StateVector getState()
protected void setAgendaLaunchXY(Mission mis)
public void receiveJoystickEvent(JoystickEvent controllerEvent, JoystickObserver dispatcher)
JoystickEventListener
receiveJoystickEvent
in interface JoystickEventListener
controllerEvent
- latest event from joystickdispatcher
- The object sending the event (usually the joystick object)public JoystickEvent getNextJoystickEvent()
protected long getEnvironmentalUpdatePeriodMs()
public void notifyCommandComplete()
public void reset()
public void run()
public boolean isRunning()
protected void missionSimulationLoopsRunFullMission(ControlParameters controlParameters)
controlParameters
- control parametersprotected void missionSimulationLoopHouseKeepingInitial(ControlParameters controlParameters)
controlParameters
- control parametersprotected void missionSimulationLoopHouseKeepingFinal(ControlParameters controlParameters)
controlParameters
- protected void cleanUpFollowingMissionLoopCompletion()
public TacticalConnection getTacticalConnection()
public void useMetric(boolean setting)
setting
- true if metric units of measure are to be usedpublic void useRadians(boolean setting)
setting
- true if metric units of measure are to be usedprotected void decideExternal()
public boolean checkPauseSeparateJvm()
public boolean checkKill(String workbenchDirective)
workbenchDirective
- Execution.enumeration triggered by AUVW user interface: kill, pause, resume, real time, etc.public void setVehicleCharacteristics(VehicleCharacteristics chars)
public boolean checkMultipleLoopsMission(String workbenchDirective)
workbenchDirective
- Execution.enumeration triggered by AUVW user interface: kill, pause, resume, realtime, multiple loops, etc.public boolean checkRealtime(String workbenchDirective)
workbenchDirective
- Execution.enumeration triggered by AUVW user interface: kill, pause, resume, realtime, multiple loops, etc.public void checkPauseResume(String workbenchDirective)
workbenchDirective
- Execution.enumeration triggered by AUVW user interface: kill, pause, resume, realtime, multiple loops, etc.public WorkbenchCommunicator getWorkbenchCommunicator()
protected void startPositionReports()
protected void endPositionReports()
protected long getPositionUpdatePeriod()
protected void startStateReports()
protected void endStateReports()
protected long getStateReportUpdatePeriod()
protected String getTabDelimitedFormattedStateFieldNames()
protected String getTabDelimitedStateValues()
protected void initializeEnvironmentUpdates()
protected void startEnvironmentalUpdates(double starttime)
protected void stopEnviroUpdates()
public boolean isOneThreadedJvmForAllMissions()
protected static boolean shouldUseSingleJvm(String[] commandLineArgs)
commandLineArgs
- the command line arguments passed into main() in the execution subclass