mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
Correctly set smart dashboard type for AnalogGyro and ADXRS450_Gyro.
The GetSmartDashboardType() function defined by GyroBase was returning the correct "Gyro", but the overrides in AnalogGyro and ADXRS450_Gyro were incorrectly changing this, resulting in SmartDashboard not recognizing these as being gyros. Additionally, AddSensor in the C++ AnalogGyro was setting the name to Gyro rather than AnalogGyro. Change-Id: Ib2e31cd2712cc2bc26c8082ed760175d0ee80fb6
This commit is contained in:
@@ -36,8 +36,6 @@ class ADXRS450_Gyro : public GyroBase {
|
||||
void Reset() override;
|
||||
void Calibrate() override;
|
||||
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
private:
|
||||
SPI m_spi;
|
||||
|
||||
|
||||
@@ -54,8 +54,6 @@ class AnalogGyro : public GyroBase {
|
||||
virtual void InitGyro();
|
||||
void Calibrate() override;
|
||||
|
||||
std::string GetSmartDashboardType() const override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<AnalogInput> m_analog;
|
||||
|
||||
|
||||
@@ -151,7 +151,3 @@ float ADXRS450_Gyro::GetAngle() const {
|
||||
double ADXRS450_Gyro::GetRate() const {
|
||||
return (double)m_spi.GetAccumulatorLastValue() * kDegreePerSecondPerLSB;
|
||||
}
|
||||
|
||||
std::string ADXRS450_Gyro::GetSmartDashboardType() const {
|
||||
return "ADXRS450_Gyro";
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void AnalogGyro::InitGyro() {
|
||||
SetPIDSourceType(PIDSourceType::kDisplacement);
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_Gyro, m_analog->GetChannel());
|
||||
LiveWindow::GetInstance()->AddSensor("Gyro", m_analog->GetChannel(), this);
|
||||
LiveWindow::GetInstance()->AddSensor("AnalogGyro", m_analog->GetChannel(), this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -251,5 +251,3 @@ void AnalogGyro::SetDeadband(float volts) {
|
||||
(1 << m_analog->GetOversampleBits());
|
||||
m_analog->SetAccumulatorDeadband(deadband);
|
||||
}
|
||||
|
||||
std::string AnalogGyro::GetSmartDashboardType() const { return "AnalogGyro"; }
|
||||
|
||||
@@ -163,8 +163,4 @@ public class ADXRS450_Gyro extends GyroBase implements Gyro, PIDSource, LiveWind
|
||||
if (m_spi == null) return 0.0;
|
||||
return m_spi.getAccumulatorLastValue() * kDegreePerSecondPerLSB;
|
||||
}
|
||||
|
||||
public String getSmartDashboardType() {
|
||||
return "ADXRS450_Gyro";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,12 +238,4 @@ public class AnalogGyro extends GyroBase implements Gyro, PIDSource, LiveWindowS
|
||||
(int) (volts * 1e9 / m_analog.getLSBWeight() * (1 << m_analog.getOversampleBits()));
|
||||
m_analog.setAccumulatorDeadband(deadband);
|
||||
}
|
||||
|
||||
/*
|
||||
* Live Window code, only does anything if live window is activated.
|
||||
*/
|
||||
@Override
|
||||
public String getSmartDashboardType() {
|
||||
return "AnalogGyro";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user