mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpilib] Use PSI for compressor config and sensor reading (#3847)
This adds the REV Analog Pressure Sensor PSI to volt (and vice versa) conversion to allow setting the compressor config in PSI and getting the sensor reading in PSI. Also adds input validation for pressure values at the higher level. Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f401ea9aae
commit
7c09f44898
@@ -97,14 +97,16 @@ void PneumaticsControlModule::EnableCompressorDigital() {
|
||||
}
|
||||
|
||||
void PneumaticsControlModule::EnableCompressorAnalog(
|
||||
units::volt_t minAnalogVoltage, units::volt_t maxAnalogVoltage) {
|
||||
units::pounds_per_square_inch_t minPressure,
|
||||
units::pounds_per_square_inch_t maxPressure) {
|
||||
int32_t status = 0;
|
||||
HAL_SetCTREPCMClosedLoopControl(m_handle, true, &status);
|
||||
FRC_CheckErrorStatus(status, "Module {}", m_module);
|
||||
}
|
||||
|
||||
void PneumaticsControlModule::EnableCompressorHybrid(
|
||||
units::volt_t minAnalogVoltage, units::volt_t maxAnalogVoltage) {
|
||||
units::pounds_per_square_inch_t minPressure,
|
||||
units::pounds_per_square_inch_t maxPressure) {
|
||||
int32_t status = 0;
|
||||
HAL_SetCTREPCMClosedLoopControl(m_handle, true, &status);
|
||||
FRC_CheckErrorStatus(status, "Module {}", m_module);
|
||||
@@ -265,6 +267,11 @@ units::volt_t PneumaticsControlModule::GetAnalogVoltage(int channel) const {
|
||||
return units::volt_t{0};
|
||||
}
|
||||
|
||||
units::pounds_per_square_inch_t PneumaticsControlModule::GetPressure(
|
||||
int channel) const {
|
||||
return 0_psi;
|
||||
}
|
||||
|
||||
Solenoid PneumaticsControlModule::MakeSolenoid(int channel) {
|
||||
return Solenoid{m_module, PneumaticsModuleType::CTREPCM, channel};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user