WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Accelerometer.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 ACCELEROMETER_H_
8 #define ACCELEROMETER_H_
9 
10 #include "AnalogChannel.h"
11 #include "SensorBase.h"
12 #include "PIDSource.h"
13 #include "LiveWindow/LiveWindowSendable.h"
14 
21 class Accelerometer : public SensorBase, public PIDSource, public LiveWindowSendable {
22 public:
23  explicit Accelerometer(uint32_t channel);
24  Accelerometer(uint8_t moduleNumber, uint32_t channel);
25  explicit Accelerometer(AnalogChannel *channel);
26  virtual ~Accelerometer();
27 
28  float GetAcceleration();
29  void SetSensitivity(float sensitivity);
30  void SetZero(float zero);
31  double PIDGet();
32 
33  void UpdateTable();
34  void StartLiveWindowMode();
35  void StopLiveWindowMode();
36  std::string GetSmartDashboardType();
37  void InitTable(ITable *subTable);
38  ITable * GetTable();
39 
40 private:
41  void InitAccelerometer();
42 
43  AnalogChannel *m_analogChannel;
44  float m_voltsPerG;
45  float m_zeroGVoltage;
46  bool m_allocatedChannel;
47 
48  ITable *m_table;
49 };
50 
51 #endif
virtual ~Accelerometer()
Definition: Accelerometer.cpp:77
Accelerometer(uint32_t channel)
Definition: Accelerometer.cpp:31
void SetZero(float zero)
Definition: Accelerometer.cpp:117
Definition: SensorBase.h:20
void SetSensitivity(float sensitivity)
Definition: Accelerometer.cpp:105
float GetAcceleration()
Definition: Accelerometer.cpp:92
Definition: PIDSource.h:15
double PIDGet()
Definition: Accelerometer.cpp:127
Definition: Accelerometer.h:21
Definition: AnalogChannel.h:29