mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpilib] Remove GyroBase
This commit is contained in:
@@ -8,8 +8,11 @@
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
|
||||
#include "frc/GyroBase.h"
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/SPI.h"
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -26,7 +29,10 @@ namespace frc {
|
||||
* This class is for the digital ADXRS450 gyro sensor that connects via SPI.
|
||||
* Only one instance of an ADXRS Gyro is supported.
|
||||
*/
|
||||
class ADXRS450_Gyro : public GyroBase {
|
||||
class ADXRS450_Gyro : public Gyro,
|
||||
public ErrorBase,
|
||||
public Sendable,
|
||||
public SendableHelper<ADXRS450_Gyro> {
|
||||
public:
|
||||
/**
|
||||
* Gyro constructor on onboard CS0.
|
||||
@@ -96,6 +102,8 @@ class ADXRS450_Gyro : public GyroBase {
|
||||
*/
|
||||
int GetPort() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
SPI m_spi;
|
||||
SPI::Port m_port;
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
#include <hal/Types.h>
|
||||
|
||||
#include "frc/GyroBase.h"
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
@@ -29,7 +30,10 @@ class AnalogInput;
|
||||
*
|
||||
* This class is for gyro sensors that connect to an analog input.
|
||||
*/
|
||||
class AnalogGyro : public GyroBase {
|
||||
class AnalogGyro : public Gyro,
|
||||
public ErrorBase,
|
||||
public Sendable,
|
||||
public SendableHelper<AnalogGyro> {
|
||||
public:
|
||||
static constexpr int kOversampleBits = 10;
|
||||
static constexpr int kAverageBits = 0;
|
||||
@@ -190,6 +194,8 @@ class AnalogGyro : public GyroBase {
|
||||
*/
|
||||
std::shared_ptr<AnalogInput> GetAnalogInput() const;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
protected:
|
||||
std::shared_ptr<AnalogInput> m_analog;
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* GyroBase is the common base class for Gyro implementations such as
|
||||
* AnalogGyro.
|
||||
*/
|
||||
class GyroBase : public Gyro,
|
||||
public ErrorBase,
|
||||
public Sendable,
|
||||
public SendableHelper<GyroBase> {
|
||||
public:
|
||||
GyroBase() = default;
|
||||
GyroBase(GyroBase&&) = default;
|
||||
GyroBase& operator=(GyroBase&&) = default;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
@@ -6,7 +6,10 @@
|
||||
|
||||
#include <hal/SimDevice.h>
|
||||
|
||||
#include "frc/GyroBase.h"
|
||||
#include "frc/ErrorBase.h"
|
||||
#include "frc/interfaces/Gyro.h"
|
||||
#include "frc/smartdashboard/Sendable.h"
|
||||
#include "frc/smartdashboard/SendableHelper.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
@@ -16,7 +19,10 @@ namespace frc {
|
||||
* This class is for the Romi onboard gyro, and will only work in
|
||||
* simulation/Romi mode. Only one instance of a RomiGyro is supported.
|
||||
*/
|
||||
class RomiGyro : public GyroBase {
|
||||
class RomiGyro : public Gyro,
|
||||
public ErrorBase,
|
||||
public Sendable,
|
||||
public SendableHelper<RomiGyro> {
|
||||
public:
|
||||
RomiGyro();
|
||||
|
||||
@@ -84,6 +90,8 @@ class RomiGyro : public GyroBase {
|
||||
*/
|
||||
void Reset() override;
|
||||
|
||||
void InitSendable(SendableBuilder& builder) override;
|
||||
|
||||
private:
|
||||
hal::SimDevice m_simDevice;
|
||||
hal::SimDouble m_simRateX;
|
||||
|
||||
Reference in New Issue
Block a user