Now you can download a copy of these docs so you can use them offline! Download now
Gyro.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef GYRO_H_
8 #define GYRO_H_
9 
10 #include "SensorBase.h"
11 #include "PIDSource.h"
12 #include "LiveWindow/LiveWindowSendable.h"
13 
14 class AnalogChannel;
15 class AnalogModule;
16 
27 class Gyro : public SensorBase, public PIDSource, public LiveWindowSendable
28 {
29 public:
30  static const uint32_t kOversampleBits = 10;
31  static const uint32_t kAverageBits = 0;
32  static constexpr float kSamplesPerSecond = 50.0;
33  static constexpr float kCalibrationSampleTime = 5.0;
34  static constexpr float kDefaultVoltsPerDegreePerSecond = 0.007;
35 
36  Gyro(uint8_t moduleNumber, uint32_t channel);
37  explicit Gyro(uint32_t channel);
38  explicit Gyro(AnalogChannel *channel);
39  explicit Gyro(AnalogChannel &channel);
40  virtual ~Gyro();
41  virtual float GetAngle();
42  virtual double GetRate();
43  void SetSensitivity(float voltsPerDegreePerSecond);
44  void SetPIDSourceParameter(PIDSourceParameter pidSource);
45  virtual void Reset();
46 
47  // PIDSource interface
48  double PIDGet();
49 
50  void UpdateTable();
51  void StartLiveWindowMode();
52  void StopLiveWindowMode();
53  std::string GetSmartDashboardType();
54  void InitTable(ITable *subTable);
55  ITable * GetTable();
56 
57 private:
58  void InitGyro();
59 
60  AnalogChannel *m_analog;
61  float m_voltsPerDegreePerSecond;
62  float m_offset;
63  bool m_channelAllocated;
64  uint32_t m_center;
65  PIDSourceParameter m_pidSource;
66 
67  ITable *m_table;
68 };
69 #endif
ITable * GetTable()
Definition: Gyro.cpp:245
Definition: ITable.h:26
virtual ~Gyro()
Definition: Gyro.cpp:140
Definition: Gyro.h:27
virtual void Reset()
Definition: Gyro.cpp:132
virtual float GetAngle()
Definition: Gyro.cpp:157
void InitTable(ITable *subTable)
Definition: Gyro.cpp:240
virtual double GetRate()
Definition: Gyro.cpp:179
void StartLiveWindowMode()
Definition: Gyro.cpp:228
void StopLiveWindowMode()
Definition: Gyro.cpp:232
Gyro(uint8_t moduleNumber, uint32_t channel)
Definition: Gyro.cpp:79
void SetSensitivity(float voltsPerDegreePerSecond)
Definition: Gyro.cpp:193
std::string GetSmartDashboardType()
Definition: Gyro.cpp:236
double PIDGet()
Definition: Gyro.cpp:210
void UpdateTable()
Definition: Gyro.cpp:222

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6