blob: ba9b2f0bdfbc71c43e53ee154170e2b88a5fad73 [file] [log] [blame]
Brian Silverman8fce7482020-01-05 13:18:21 -08001/*----------------------------------------------------------------------------*/
Austin Schuh1e69f942020-11-14 15:06:14 -08002/* Copyright (c) 2008-2020 FIRST. All Rights Reserved. */
Brian Silverman8fce7482020-01-05 13:18:21 -08003/* 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");
Austin Schuh1e69f942020-11-14 15:06:14 -080028 builder.AddDoubleProperty(
29 "Value", [=]() { return GetAngle(); }, nullptr);
Brian Silverman8fce7482020-01-05 13:18:21 -080030}