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 SERVO_H 00008 #define SERVO_H 00009 00010 #include "SafePWM.h" 00011 #include "SpeedController.h" 00012 00019 class Servo : public SafePWM 00020 { 00021 public: 00022 explicit Servo(UINT32 channel); 00023 Servo(UINT8 moduleNumber, UINT32 channel); 00024 virtual ~Servo(); 00025 void Set(float value); 00026 void SetOffline(); 00027 float Get(); 00028 void SetAngle(float angle); 00029 float GetAngle(); 00030 static float GetMaxAngle() { return kMaxServoAngle; }; 00031 static float GetMinAngle() { return kMinServoAngle; }; 00032 00033 private: 00034 void InitServo(); 00035 float GetServoAngleRange() {return kMaxServoAngle - kMinServoAngle;} 00036 00037 static const float kMaxServoAngle = 170.0; 00038 static const float kMinServoAngle = 0.0; 00039 }; 00040 00041 #endif 00042