mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilib, hal] High Level REV PH changes (#3792)
More functionality was implemented at the HAL level, so expose that to the wpilib level. This also does units changes for all the PH related functionality.
This commit is contained in:
@@ -95,7 +95,14 @@ class Compressor : public wpi::Sendable,
|
||||
*
|
||||
* @return The current through the compressor, in amps
|
||||
*/
|
||||
double GetCurrent() const;
|
||||
units::ampere_t GetCurrent() const;
|
||||
|
||||
/**
|
||||
* Query the analog input voltage (on channel 0) (if supported).
|
||||
*
|
||||
* @return The analog input voltage, in volts
|
||||
*/
|
||||
units::volt_t GetAnalogVoltage() const;
|
||||
|
||||
/**
|
||||
* Disable the compressor.
|
||||
@@ -115,7 +122,8 @@ class Compressor : public wpi::Sendable,
|
||||
* @param minAnalogVoltage The minimum voltage to enable compressor
|
||||
* @param maxAnalogVoltage The maximum voltage to disable compressor
|
||||
*/
|
||||
void EnableAnalog(double minAnalogVoltage, double maxAnalogVoltage);
|
||||
void EnableAnalog(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage);
|
||||
|
||||
/**
|
||||
* Enable compressor closed loop control using hybrid input.
|
||||
@@ -125,7 +133,8 @@ class Compressor : public wpi::Sendable,
|
||||
* @param minAnalogVoltage The minimum voltage to enable compressor
|
||||
* @param maxAnalogVoltage The maximum voltage to disable compressor
|
||||
*/
|
||||
void EnableHybrid(double minAnalogVoltage, double maxAnalogVoltage);
|
||||
void EnableHybrid(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage);
|
||||
|
||||
CompressorConfigType GetConfigType() const;
|
||||
|
||||
|
||||
@@ -26,17 +26,17 @@ class PneumaticHub : public PneumaticsBase {
|
||||
|
||||
void EnableCompressorDigital() override;
|
||||
|
||||
void EnableCompressorAnalog(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) override;
|
||||
void EnableCompressorAnalog(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) override;
|
||||
|
||||
void EnableCompressorHybrid(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) override;
|
||||
void EnableCompressorHybrid(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) override;
|
||||
|
||||
CompressorConfigType GetCompressorConfigType() const override;
|
||||
|
||||
bool GetPressureSwitch() const override;
|
||||
|
||||
double GetCompressorCurrent() const override;
|
||||
units::ampere_t GetCompressorCurrent() const override;
|
||||
|
||||
void SetSolenoids(int mask, int values) override;
|
||||
|
||||
@@ -65,6 +65,68 @@ class PneumaticHub : public PneumaticsBase {
|
||||
int reverseChannel) override;
|
||||
Compressor MakeCompressor() override;
|
||||
|
||||
struct Version {
|
||||
uint32_t FirmwareMajor;
|
||||
uint32_t FirmwareMinor;
|
||||
uint32_t FirmwareFix;
|
||||
uint32_t HardwareMinor;
|
||||
uint32_t HardwareMajor;
|
||||
uint32_t UniqueId;
|
||||
};
|
||||
|
||||
Version GetVersion() const;
|
||||
|
||||
struct Faults {
|
||||
uint32_t Channel0Fault : 1;
|
||||
uint32_t Channel1Fault : 1;
|
||||
uint32_t Channel2Fault : 1;
|
||||
uint32_t Channel3Fault : 1;
|
||||
uint32_t Channel4Fault : 1;
|
||||
uint32_t Channel5Fault : 1;
|
||||
uint32_t Channel6Fault : 1;
|
||||
uint32_t Channel7Fault : 1;
|
||||
uint32_t Channel8Fault : 1;
|
||||
uint32_t Channel9Fault : 1;
|
||||
uint32_t Channel10Fault : 1;
|
||||
uint32_t Channel11Fault : 1;
|
||||
uint32_t Channel12Fault : 1;
|
||||
uint32_t Channel13Fault : 1;
|
||||
uint32_t Channel14Fault : 1;
|
||||
uint32_t Channel15Fault : 1;
|
||||
uint32_t CompressorOverCurrent : 1;
|
||||
uint32_t CompressorOpen : 1;
|
||||
uint32_t SolenoidOverCurrent : 1;
|
||||
uint32_t Brownout : 1;
|
||||
uint32_t CanWarning : 1;
|
||||
uint32_t HardwareFault : 1;
|
||||
};
|
||||
|
||||
Faults GetFaults() const;
|
||||
|
||||
struct StickyFaults {
|
||||
uint32_t CompressorOverCurrent : 1;
|
||||
uint32_t CompressorOpen : 1;
|
||||
uint32_t SolenoidOverCurrent : 1;
|
||||
uint32_t Brownout : 1;
|
||||
uint32_t CanWarning : 1;
|
||||
uint32_t CanBusOff : 1;
|
||||
uint32_t HasReset : 1;
|
||||
};
|
||||
|
||||
StickyFaults GetStickyFaults() const;
|
||||
|
||||
void ClearStickyFaults();
|
||||
|
||||
units::volt_t GetInputVoltage() const;
|
||||
|
||||
units::volt_t Get5VRegulatedVoltage() const;
|
||||
|
||||
units::ampere_t GetSolenoidsTotalCurrent() const;
|
||||
|
||||
units::volt_t GetSolenoidsVoltage() const;
|
||||
|
||||
units::volt_t GetAnalogVoltage(int channel) const override;
|
||||
|
||||
private:
|
||||
class DataStore;
|
||||
friend class DataStore;
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <units/current.h>
|
||||
#include <units/time.h>
|
||||
#include <units/voltage.h>
|
||||
|
||||
#include "frc/CompressorConfigType.h"
|
||||
#include "frc/PneumaticsModuleType.h"
|
||||
@@ -23,17 +25,17 @@ class PneumaticsBase {
|
||||
|
||||
virtual bool GetPressureSwitch() const = 0;
|
||||
|
||||
virtual double GetCompressorCurrent() const = 0;
|
||||
virtual units::ampere_t GetCompressorCurrent() const = 0;
|
||||
|
||||
virtual void DisableCompressor() = 0;
|
||||
|
||||
virtual void EnableCompressorDigital() = 0;
|
||||
|
||||
virtual void EnableCompressorAnalog(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) = 0;
|
||||
virtual void EnableCompressorAnalog(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) = 0;
|
||||
|
||||
virtual void EnableCompressorHybrid(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) = 0;
|
||||
virtual void EnableCompressorHybrid(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) = 0;
|
||||
|
||||
virtual CompressorConfigType GetCompressorConfigType() const = 0;
|
||||
|
||||
@@ -59,6 +61,8 @@ class PneumaticsBase {
|
||||
|
||||
virtual void UnreserveCompressor() = 0;
|
||||
|
||||
virtual units::volt_t GetAnalogVoltage(int channel) const = 0;
|
||||
|
||||
virtual Solenoid MakeSolenoid(int channel) = 0;
|
||||
virtual DoubleSolenoid MakeDoubleSolenoid(int forwardChannel,
|
||||
int reverseChannel) = 0;
|
||||
|
||||
@@ -26,17 +26,17 @@ class PneumaticsControlModule : public PneumaticsBase {
|
||||
|
||||
void EnableCompressorDigital() override;
|
||||
|
||||
void EnableCompressorAnalog(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) override;
|
||||
void EnableCompressorAnalog(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) override;
|
||||
|
||||
void EnableCompressorHybrid(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) override;
|
||||
void EnableCompressorHybrid(units::volt_t minAnalogVoltage,
|
||||
units::volt_t maxAnalogVoltage) override;
|
||||
|
||||
CompressorConfigType GetCompressorConfigType() const override;
|
||||
|
||||
bool GetPressureSwitch() const override;
|
||||
|
||||
double GetCompressorCurrent() const override;
|
||||
units::ampere_t GetCompressorCurrent() const override;
|
||||
|
||||
bool GetCompressorCurrentTooHighFault() const;
|
||||
bool GetCompressorCurrentTooHighStickyFault() const;
|
||||
@@ -72,6 +72,8 @@ class PneumaticsControlModule : public PneumaticsBase {
|
||||
|
||||
void UnreserveCompressor() override;
|
||||
|
||||
units::volt_t GetAnalogVoltage(int channel) const override;
|
||||
|
||||
Solenoid MakeSolenoid(int channel) override;
|
||||
DoubleSolenoid MakeDoubleSolenoid(int forwardChannel,
|
||||
int reverseChannel) override;
|
||||
|
||||
Reference in New Issue
Block a user