Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame^] | 1 | /*----------------------------------------------------------------------------*/ |
| 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 | |
| 13 | using namespace frc; |
| 14 | |
| 15 | double 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 | |
| 26 | void GyroBase::InitSendable(SendableBuilder& builder) { |
| 27 | builder.SetSmartDashboardType("Gyro"); |
| 28 | builder.AddDoubleProperty("Value", [=]() { return GetAngle(); }, nullptr); |
| 29 | } |