Class SimHooks
java.lang.Object
org.wpilib.simulation.SimHooks
Simulation hooks.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturns true if the user program has started.static voidgetProgramState(ControlWord controlWord) Gets the user program state (control word).static booleanCheck if the simulator time is paused.static voidPause the simulator time.static voidRestart the simulator time.static voidResume the simulator time.static voidsetHALRuntimeType(int type) Override the HAL runtime type (simulated/real).static voidsetProgramStarted(boolean started) Sets flag that indicates if the user program has started.static voidsetProgramState(ControlWord controlWord) Sets the user program state (control word).static voidstepTiming(double delta) Advance the simulator time and wait for all notifiers to run.static voidstepTimingAsync(double delta) Advance the simulator time and return immediately.static voidWaits until the user program has started and the first notifier alarm has been armed.static voidwaitForProgramStart(boolean waitForFirstNotifier) Waits until the user program has started.
-
Method Details
-
setHALRuntimeType
public static void setHALRuntimeType(int type) Override the HAL runtime type (simulated/real).- Parameters:
type- runtime type
-
waitForProgramStart
public static void waitForProgramStart()Waits until the user program has started and the first notifier alarm has been armed. -
waitForProgramStart
public static void waitForProgramStart(boolean waitForFirstNotifier) Waits until the user program has started.- Parameters:
waitForFirstNotifier- wait for the first notifier alarm to be armed
-
setProgramStarted
public static void setProgramStarted(boolean started) Sets flag that indicates if the user program has started.- Parameters:
started- true if started
-
getProgramStarted
public static boolean getProgramStarted()Returns true if the user program has started.- Returns:
- True if the user program has started.
-
setProgramState
Sets the user program state (control word).- Parameters:
controlWord- control word
-
getProgramState
Gets the user program state (control word).- Parameters:
controlWord- control word (output)
-
restartTiming
public static void restartTiming()Restart the simulator time. -
pauseTiming
public static void pauseTiming()Pause the simulator time. -
resumeTiming
public static void resumeTiming()Resume the simulator time. -
isTimingPaused
public static boolean isTimingPaused()Check if the simulator time is paused.- Returns:
- true if paused
-
stepTiming
public static void stepTiming(double delta) Advance the simulator time and wait for all notifiers to run.- Parameters:
delta- the amount to advance in seconds
-
stepTimingAsync
public static void stepTimingAsync(double delta) Advance the simulator time and return immediately.- Parameters:
delta- the amount to advance in seconds
-