mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[wpilib] Use PH voltage to calc Analog pressure switch threshold (#5115)
The calculated trigger voltages were calculated with a hard coded 5v. This introduces error when the 5V provided to the Analog pressure sensor is not exactly 5v, as the pressure is a ratio of the analog voltage and provided voltage. This should improve https://www.chiefdelphi.com/t/rev-pressure-sensor-enablecompressoranalog-not-reaching-configured-pressure/426868 where the 5v voltage was 4.92 volts, which introduces ~8 PSI of error.
This commit is contained in:
@@ -294,8 +294,8 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
throw new IllegalArgumentException(
|
||||
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
||||
}
|
||||
double minAnalogVoltage = psiToVolts(minPressure, 5);
|
||||
double maxAnalogVoltage = psiToVolts(maxPressure, 5);
|
||||
double minAnalogVoltage = psiToVolts(minPressure, get5VRegulatedVoltage());
|
||||
double maxAnalogVoltage = psiToVolts(maxPressure, get5VRegulatedVoltage());
|
||||
REVPHJNI.setClosedLoopControlAnalog(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
||||
}
|
||||
|
||||
@@ -339,8 +339,8 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
throw new IllegalArgumentException(
|
||||
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
||||
}
|
||||
double minAnalogVoltage = psiToVolts(minPressure, 5);
|
||||
double maxAnalogVoltage = psiToVolts(maxPressure, 5);
|
||||
double minAnalogVoltage = psiToVolts(minPressure, get5VRegulatedVoltage());
|
||||
double maxAnalogVoltage = psiToVolts(maxPressure, get5VRegulatedVoltage());
|
||||
REVPHJNI.setClosedLoopControlHybrid(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user