Package edu.wpi.first.wpilibj.simulation
Class RelaySim
java.lang.Object
edu.wpi.first.wpilibj.simulation.RelaySim
Class to control a simulated relay.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Check whether the forward direction is active.boolean
Check whether the forward direction has been initialized.boolean
Check whether the reverse direction has been initialized.boolean
Check whether the reverse direction is active.registerForwardCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the forward direction changes state.registerInitializedForwardCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the forward direction is initialized.registerInitializedReverseCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the reverse direction is initialized.registerReverseCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the reverse direction changes state.void
Reset all simulation data.void
setForward
(boolean forward) Set whether the forward direction is active.void
setInitializedForward
(boolean initializedForward) Define whether the forward direction has been initialized.void
setInitializedReverse
(boolean initializedReverse) Define whether the reverse direction has been initialized.void
setReverse
(boolean reverse) Set whether the reverse direction is active.
-
Constructor Details
-
RelaySim
Constructs from a Relay object.- Parameters:
relay
- Relay to simulate
-
RelaySim
Constructs from a relay channel number.- Parameters:
channel
- Channel number
-
-
Method Details
-
registerInitializedForwardCallback
public CallbackStore registerInitializedForwardCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the forward direction is initialized.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitializedForward
Check whether the forward direction has been initialized.- Returns:
- true if initialized
-
setInitializedForward
Define whether the forward direction has been initialized.- Parameters:
initializedForward
- whether this object is initialized
-
registerInitializedReverseCallback
public CallbackStore registerInitializedReverseCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the reverse direction is initialized.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitializedReverse
Check whether the reverse direction has been initialized.- Returns:
- true if initialized
-
setInitializedReverse
Define whether the reverse direction has been initialized.- Parameters:
initializedReverse
- whether this object is initialized
-
registerForwardCallback
Register a callback to be run when the forward direction changes state.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getForward
Check whether the forward direction is active.- Returns:
- true if active
-
setForward
Set whether the forward direction is active.- Parameters:
forward
- true to make active
-
registerReverseCallback
Register a callback to be run when the reverse direction changes state.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getReverse
Check whether the reverse direction is active.- Returns:
- true if active
-
setReverse
Set whether the reverse direction is active.- Parameters:
reverse
- true to make active
-
resetData
Reset all simulation data.
-