blob: f1044b73618dd6097ce8a95101389b3c16eb05b7 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
Brian Silverman1a675112016-02-20 20:42:49 -05002/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
Brian Silverman26e4e522015-12-17 01:56:40 -05003/* Open Source Software - may be modified and shared by FRC teams. The code */
Brian Silverman1a675112016-02-20 20:42:49 -05004/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
Brian Silverman26e4e522015-12-17 01:56:40 -05006/*----------------------------------------------------------------------------*/
7
8#include "GyroBase.h"
9#include "WPIErrors.h"
10#include "LiveWindow/LiveWindow.h"
11
12/**
13 * Get the PIDOutput for the PIDSource base object. Can be set to return
14 * angle or rate using SetPIDSourceType(). Defaults to angle.
15 *
16 * @return The PIDOutput (angle or rate, defaults to angle)
17 */
18double GyroBase::PIDGet() {
19 switch (GetPIDSourceType()) {
20 case PIDSourceType::kRate:
21 return GetRate();
22 case PIDSourceType::kDisplacement:
23 return GetAngle();
24 default:
25 return 0;
26 }
27}
28
29void GyroBase::UpdateTable() {
30 if (m_table != nullptr) {
31 m_table->PutNumber("Value", GetAngle());
32 }
33}
34
35void GyroBase::StartLiveWindowMode() {}
36
37void GyroBase::StopLiveWindowMode() {}
38
39std::string GyroBase::GetSmartDashboardType() const { return "Gyro"; }
40
41void GyroBase::InitTable(std::shared_ptr<ITable> subTable) {
42 m_table = subTable;
43 UpdateTable();
44}
45
46std::shared_ptr<ITable> GyroBase::GetTable() const { return m_table; }