blob: 61de3193b88b4e81b82390590a026e2de6a10cd0 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008-2017. 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 "GyroBase.h"
9
10#include "LiveWindow/LiveWindow.h"
11#include "WPIErrors.h"
12
13using namespace frc;
14
15/**
16 * Get the PIDOutput for the PIDSource base object. Can be set to return
17 * angle or rate using SetPIDSourceType(). Defaults to angle.
18 *
19 * @return The PIDOutput (angle or rate, defaults to angle)
20 */
21double GyroBase::PIDGet() {
22 switch (GetPIDSourceType()) {
23 case PIDSourceType::kRate:
24 return GetRate();
25 case PIDSourceType::kDisplacement:
26 return GetAngle();
27 default:
28 return 0;
29 }
30}
31
32void GyroBase::UpdateTable() {
33 if (m_table != nullptr) {
34 m_table->PutNumber("Value", GetAngle());
35 }
36}
37
38void GyroBase::StartLiveWindowMode() {}
39
40void GyroBase::StopLiveWindowMode() {}
41
42std::string GyroBase::GetSmartDashboardType() const { return "Gyro"; }
43
44void GyroBase::InitTable(std::shared_ptr<ITable> subTable) {
45 m_table = subTable;
46 UpdateTable();
47}
48
49std::shared_ptr<ITable> GyroBase::GetTable() const { return m_table; }