13 #include "HAL/Types.h"
34 static const int kOversampleBits = 10;
35 static const int kAverageBits = 0;
36 static constexpr
double kSamplesPerSecond = 50.0;
37 static constexpr
double kCalibrationSampleTime = 5.0;
38 static constexpr
double kDefaultVoltsPerDegreePerSecond = 0.007;
42 explicit AnalogGyro(std::shared_ptr<AnalogInput> channel);
43 AnalogGyro(
int channel,
int center,
double offset);
44 AnalogGyro(std::shared_ptr<AnalogInput> channel,
int center,
double offset);
48 double GetRate()
const override;
53 void Reset()
override;
58 std::shared_ptr<AnalogInput> m_analog;
61 HAL_GyroHandle m_gyroHandle = HAL_kInvalidHandle;
AnalogGyro(int channel)
Gyro constructor using the Analog Input channel number.
Definition: AnalogGyro.cpp:32
void Calibrate() override
Calibrate the gyro by running for a number of samples and computing the center value.
Definition: AnalogGyro.cpp:182
void SetDeadband(double volts)
Set the size of the neutral zone.
Definition: AnalogGyro.cpp:277
virtual ~AnalogGyro()
AnalogGyro Destructor.
Definition: AnalogGyro.cpp:129
double GetAngle() const override
Return the actual angle in degrees that the robot is currently facing.
Definition: AnalogGyro.cpp:201
virtual double GetOffset() const
Return the gyro offset value.
Definition: AnalogGyro.cpp:230
virtual void InitGyro()
Initialize the gyro.
Definition: AnalogGyro.cpp:148
Use a rate gyro to return the robots heading relative to a starting position.
Definition: AnalogGyro.h:32
virtual int GetCenter() const
Return the gyro center value.
Definition: AnalogGyro.cpp:244
GyroBase is the common base class for Gyro implementations such as AnalogGyro.
Definition: GyroBase.h:24
double GetRate() const override
Return the rate of rotation of the gyro.
Definition: AnalogGyro.cpp:216
void SetSensitivity(double voltsPerDegreePerSecond)
Set the gyro sensitivity.
Definition: AnalogGyro.cpp:261
void Reset() override
Reset the gyro.
Definition: AnalogGyro.cpp:138