WPILib 2012
WPILibRoboticsLibraryforFRC
|
00001 /*----------------------------------------------------------------------------*/ 00002 /* Copyright (c) FIRST 2008. All Rights Reserved. */ 00003 /* Open Source Software - may be modified and shared by FRC teams. The code */ 00004 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */ 00005 /*----------------------------------------------------------------------------*/ 00006 00007 #ifndef ACCELEROMETER_H_ 00008 #define ACCELEROMETER_H_ 00009 00010 #include "AnalogChannel.h" 00011 #include "SensorBase.h" 00012 #include "PIDSource.h" 00013 00020 class Accelerometer : public SensorBase, public PIDSource { 00021 public: 00022 explicit Accelerometer(UINT32 channel); 00023 Accelerometer(UINT8 moduleNumber, UINT32 channel); 00024 explicit Accelerometer(AnalogChannel *channel); 00025 virtual ~Accelerometer(); 00026 00027 float GetAcceleration(); 00028 void SetSensitivity(float sensitivity); 00029 void SetZero(float zero); 00030 double PIDGet(); 00031 00032 private: 00033 void InitAccelerometer(); 00034 00035 AnalogChannel *m_analogChannel; 00036 float m_voltsPerG; 00037 float m_zeroGVoltage; 00038 bool m_allocatedChannel; 00039 }; 00040 00041 #endif