2015-11-06 12:05:40 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2019-09-14 15:22:54 -05:00
|
|
|
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
2015-11-06 12:05:40 -08:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2015-11-06 12:05:40 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2015-11-06 12:05:40 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/ErrorBase.h"
|
|
|
|
|
#include "frc/PIDSource.h"
|
|
|
|
|
#include "frc/interfaces/Gyro.h"
|
2019-09-14 15:22:54 -05:00
|
|
|
#include "frc/smartdashboard/Sendable.h"
|
|
|
|
|
#include "frc/smartdashboard/SendableHelper.h"
|
2015-11-06 12:05:40 -08:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
namespace frc {
|
|
|
|
|
|
2015-11-06 12:05:40 -08:00
|
|
|
/**
|
|
|
|
|
* GyroBase is the common base class for Gyro implementations such as
|
|
|
|
|
* AnalogGyro.
|
|
|
|
|
*/
|
2018-05-23 20:22:30 -07:00
|
|
|
class GyroBase : public Gyro,
|
|
|
|
|
public ErrorBase,
|
2019-09-14 15:22:54 -05:00
|
|
|
public PIDSource,
|
|
|
|
|
public Sendable,
|
|
|
|
|
public SendableHelper<GyroBase> {
|
2015-11-06 12:05:40 -08:00
|
|
|
public:
|
2018-09-24 00:08:25 -07:00
|
|
|
GyroBase() = default;
|
|
|
|
|
GyroBase(GyroBase&&) = default;
|
|
|
|
|
GyroBase& operator=(GyroBase&&) = default;
|
|
|
|
|
|
2015-11-06 12:05:40 -08:00
|
|
|
// PIDSource interface
|
2018-05-31 20:47:15 -07:00
|
|
|
/**
|
|
|
|
|
* Get the PIDOutput for the PIDSource base object. Can be set to return
|
|
|
|
|
* angle or rate using SetPIDSourceType(). Defaults to angle.
|
|
|
|
|
*
|
|
|
|
|
* @return The PIDOutput (angle or rate, defaults to angle)
|
|
|
|
|
*/
|
2015-11-06 12:05:40 -08:00
|
|
|
double PIDGet() override;
|
|
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
void InitSendable(SendableBuilder& builder) override;
|
2015-11-06 12:05:40 -08:00
|
|
|
};
|
2016-11-01 22:33:12 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|