blob: 4cc9056c3bd46dc0496d4e752bf9f340e606243a [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008. All Rights Reserved.
3 */
4/* Open Source Software - may be modified and shared by FRC teams. The code */
5/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
6/*----------------------------------------------------------------------------*/
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; }