BatterySim¶
- class wpilib.simulation.BatterySim¶
Bases:
pybind11_object
A utility class to simulate the robot battery.
- static calculate(*args, **kwargs)¶
Overloaded function.
calculate(nominalVoltage: volts, resistance: ohms, currents: List[amperes]) -> volts
Calculate the loaded battery voltage. Use this with RoboRioSim::SetVInVoltage(double) to set the simulated battery voltage, which can then be retrieved with the RobotController::GetBatteryVoltage() method.
- Parameters:
nominalVoltage – The nominal battery voltage. Usually 12v.
resistance – The forward resistance of the battery. Most batteries are at or below 20 milliohms.
currents – The currents drawn from the battery.
- Returns:
The battery’s voltage under load.
calculate(currents: List[amperes]) -> volts
Calculate the loaded battery voltage. Use this with RoboRioSimSetVInVoltage(double) to set the simulated battery voltage, which can then be retrieved with the RobotController::GetBatteryVoltage() method. This function assumes a nominal voltage of 12V and a resistance of 20 milliohms (0.020 ohms).
- Parameters:
currents – The currents drawn from the battery.
- Returns:
The battery’s voltage under load.