blob: ec67675d24ccb2f2a89934a13d81384ef2ec4993 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) 2008-2018 FIRST. All Rights Reserved. */
3/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#include "frc/GyroBase.h"
9
10#include "frc/WPIErrors.h"
11#include "frc/smartdashboard/SendableBuilder.h"
12
13using namespace frc;
14
15double GyroBase::PIDGet() {
16 switch (GetPIDSourceType()) {
17 case PIDSourceType::kRate:
18 return GetRate();
19 case PIDSourceType::kDisplacement:
20 return GetAngle();
21 default:
22 return 0;
23 }
24}
25
26void GyroBase::InitSendable(SendableBuilder& builder) {
27 builder.SetSmartDashboardType("Gyro");
28 builder.AddDoubleProperty("Value", [=]() { return GetAngle(); }, nullptr);
29}