pub struct PowerDistributionPanel { /* private fields */ }
Expand description
An interface to the PDP for getting information about robot power.
Implementations§
Source§impl PowerDistributionPanel
impl PowerDistributionPanel
Sourcepub fn new() -> HalResult<PowerDistributionPanel>
pub fn new() -> HalResult<PowerDistributionPanel>
Initalizes a PDP using the default module, which is 0, according to WPILibC.
Sourcepub fn new_with_module(module: i32) -> HalResult<PowerDistributionPanel>
pub fn new_with_module(module: i32) -> HalResult<PowerDistributionPanel>
Create a new PDP interface on the specified module.
Sourcepub fn temperature(&self) -> HalMaybe<f64>
pub fn temperature(&self) -> HalMaybe<f64>
Get the PDP’s temperature, in degrees Celsius.
§Errors
The HalMaybe
returned will have an error most commonly
in the case of a CAN timeout. (In Fact, this is the only
error WPILib will ever report!).
Sourcepub fn current(&self, channel: i32) -> HalMaybe<f64>
pub fn current(&self, channel: i32) -> HalMaybe<f64>
Get the current on a specific channel on the PDP, in amps.
§Errrors
If channel
is invalid, the return value will contain
NAN
and `HalError(0).
The HalMaybe
returned will have an error most commonly
in the case of a CAN timeout. (In Fact, this is the only
error WPILib will ever report!).
Sourcepub fn total_current(&self) -> HalMaybe<f64>
pub fn total_current(&self) -> HalMaybe<f64>
Get the total current drawn from the PDP, in amps.
§Errors
The HalMaybe
returned will have an error most commonly
in the case of a CAN timeout. (In Fact, this is the only
error WPILib will ever report!).
Sourcepub fn total_power(&self) -> HalMaybe<f64>
pub fn total_power(&self) -> HalMaybe<f64>
Get the total power drawn from the PDP, in watts.
§Errors
The HalMaybe
returned will have an error most commonly
in the case of a CAN timeout. (In Fact, this is the only
error WPILib will ever report!).
Sourcepub fn total_energy(&self) -> HalMaybe<f64>
pub fn total_energy(&self) -> HalMaybe<f64>
Get the total energy expended by the PDP, in joules.
§Errors
The HalMaybe
returned will have an error most commonly
in the case of a CAN timeout. (In Fact, this is the only
error WPILib will ever report!).
Sourcepub fn reset_total_energy(&self) -> HalResult<()>
pub fn reset_total_energy(&self) -> HalResult<()>
Reset the total energy count so far to zero.
§Errors
Errors in the case of a CAN timeout. (In Fact, this is the only error WPILib will ever report!).
Sourcepub fn clear_sticky_faults(&self) -> HalResult<()>
pub fn clear_sticky_faults(&self) -> HalResult<()>
Clear sticky faults in the PDP.
§Errors
Errors in the case of a CAN timeout. (In Fact, this is the only error WPILib will ever report!).