Package edu.wpi.first.wpilibj.simulation
Class PDPSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.PDPSim
Class to control a simulated Power Distribution Panel (PDP).
-
Constructor Summary
ConstructorDescriptionPDPSim()
Constructs for the default PDP.PDPSim
(int module) Constructs from a PDP module number (CAN ID).PDPSim
(PowerDistribution pdp) Constructs from a PowerDistribution object. -
Method Summary
Modifier and TypeMethodDescriptiondouble
getCurrent
(int channel) Read the current in one of the PDP channels.boolean
Check whether the PDP has been initialized.double
Check the temperature of the PDP.double
Check the PDP voltage.registerCurrentCallback
(int channel, NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the current of a specific channel changes.registerInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the PDP is initialized.registerTemperatureCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the PDP temperature changes.registerVoltageCallback
(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the PDP voltage changes.void
Reset all PDP simulation data.void
setCurrent
(int channel, double current) Change the current in the given channel.void
setInitialized
(boolean initialized) Define whether the PDP has been initialized.void
setTemperature
(double temperature) Define the PDP temperature.void
setVoltage
(double voltage) Set the PDP voltage.
-
Constructor Details
-
PDPSim
public PDPSim()Constructs for the default PDP. -
PDPSim
Constructs from a PDP module number (CAN ID).- Parameters:
module
- module number
-
PDPSim
Constructs from a PowerDistribution object.- Parameters:
pdp
- PowerDistribution to simulate
-
-
Method Details
-
registerInitializedCallback
Register a callback to be run when the PDP is initialized.- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitialized
Check whether the PDP has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether the PDP has been initialized.- Parameters:
initialized
- whether this object is initialized
-
registerTemperatureCallback
Register a callback to be run whenever the PDP temperature changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getTemperature
Check the temperature of the PDP.- Returns:
- the PDP temperature
-
setTemperature
Define the PDP temperature.- Parameters:
temperature
- the new PDP temperature
-
registerVoltageCallback
Register a callback to be run whenever the PDP voltage changes.- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getVoltage
Check the PDP voltage.- Returns:
- the PDP voltage.
-
setVoltage
Set the PDP voltage.- Parameters:
voltage
- the new PDP voltage
-
registerCurrentCallback
public CallbackStore registerCurrentCallback(int channel, NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the current of a specific channel changes.- Parameters:
channel
- the channelcallback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback.
-
getCurrent
Read the current in one of the PDP channels.- Parameters:
channel
- the channel to check- Returns:
- the current in the given channel
-
setCurrent
Change the current in the given channel.- Parameters:
channel
- the channel to editcurrent
- the new current for the channel
-
resetData
Reset all PDP simulation data.
-