Package com.flarerobotics.lib
Class BatteryUpdater
java.lang.Object
com.flarerobotics.lib.BatteryUpdater
A static battery simulation class to update the WPILib's
BatterySim
class.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
registerCurrentDrawer
(Supplier<Double> currentSupplier) Registers a current drawer (an object that draws current), such as a mechanism or subsystem.static void
setBatteryResistance
(double resistanceOhms) Sets the resistance.static void
setNominalVoltage
(double nominalVoltage) Sets the nominal voltage of the battery.static void
update()
Updates the battery simulation.
-
Constructor Details
-
BatteryUpdater
public BatteryUpdater()
-
-
Method Details
-
registerCurrentDrawer
Registers a current drawer (an object that draws current), such as a mechanism or subsystem.- Parameters:
currentSupplier
- The current supplier.
-
update
public static void update()Updates the battery simulation. Call periodically to update. -
setNominalVoltage
public static void setNominalVoltage(double nominalVoltage) Sets the nominal voltage of the battery. Defaults to 12.5V.- Parameters:
nominalVoltage
- The voltage.
-
setBatteryResistance
public static void setBatteryResistance(double resistanceOhms) Sets the resistance. Defaults to 0.02.- Parameters:
resistanceOhms
- The resistance in Ohms.
-