2015-11-06 12:05:40 -08:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2018-01-02 09:20:21 -08:00
|
|
|
/* Copyright (c) 2008-2018 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
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "GyroBase.h"
|
2016-09-25 16:50:13 -07:00
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
#include "SmartDashboard/SendableBuilder.h"
|
2016-05-20 17:30:37 -07:00
|
|
|
#include "WPIErrors.h"
|
2015-11-06 12:05:40 -08:00
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2015-11-06 12:05:40 -08:00
|
|
|
double GyroBase::PIDGet() {
|
|
|
|
|
switch (GetPIDSourceType()) {
|
|
|
|
|
case PIDSourceType::kRate:
|
|
|
|
|
return GetRate();
|
|
|
|
|
case PIDSourceType::kDisplacement:
|
|
|
|
|
return GetAngle();
|
|
|
|
|
default:
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-04 23:28:33 -08:00
|
|
|
void GyroBase::InitSendable(SendableBuilder& builder) {
|
|
|
|
|
builder.SetSmartDashboardType("Gyro");
|
|
|
|
|
builder.AddDoubleProperty("Value", [=]() { return GetAngle(); }, nullptr);
|
2015-11-06 12:05:40 -08:00
|
|
|
}
|