12 #include <hal/Types.h>
14 #include "frc/GyroBase.h"
15 #include "frc/smartdashboard/Sendable.h"
16 #include "frc/smartdashboard/SendableHelper.h"
37 static constexpr
int kOversampleBits = 10;
38 static constexpr
int kAverageBits = 0;
39 static constexpr
double kSamplesPerSecond = 50.0;
40 static constexpr
double kCalibrationSampleTime = 5.0;
41 static constexpr
double kDefaultVoltsPerDegreePerSecond = 0.007;
75 explicit AnalogGyro(std::shared_ptr<AnalogInput> channel);
87 AnalogGyro(
int channel,
int center,
double offset);
103 AnalogGyro(std::shared_ptr<AnalogInput> channel,
int center,
double offset);
131 double GetRate()
const override;
178 void Reset()
override;
190 std::shared_ptr<AnalogInput> m_analog;
193 hal::Handle<HAL_GyroHandle> m_gyroHandle;
Use a rate gyro to return the robots heading relative to a starting position.
Definition: AnalogGyro.h:35
virtual void InitGyro()
Initialize the gyro.
virtual int GetCenter() const
Return the gyro center value.
double GetAngle() const override
Return the actual angle in degrees that the robot is currently facing.
virtual double GetOffset() const
Return the gyro offset value.
AnalogGyro(int channel)
Gyro constructor using the Analog Input channel number.
void SetDeadband(double volts)
Set the size of the neutral zone.
double GetRate() const override
Return the rate of rotation of the gyro.
void Reset() override
Reset the gyro.
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
GyroBase is the common base class for Gyro implementations such as AnalogGyro.
Definition: GyroBase.h:22
void Calibrate() override
Calibrate the gyro by running for a number of samples and computing the center value.
void SetSensitivity(double voltsPerDegreePerSecond)
Set the gyro sensitivity.