WPILib  2014.0
WPIRoboticsLibraryforFRC
 All Classes Functions Variables Pages
Servo.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 SERVO_H
8 #define SERVO_H
9 
10 #include "SafePWM.h"
11 #include "SpeedController.h"
12 
19 class Servo : public SafePWM
20 {
21 public:
22  explicit Servo(uint32_t channel);
23  Servo(uint8_t moduleNumber, uint32_t channel);
24  virtual ~Servo();
25  void Set(float value);
26  void SetOffline();
27  float Get();
28  void SetAngle(float angle);
29  float GetAngle();
30  static float GetMaxAngle() { return kMaxServoAngle; };
31  static float GetMinAngle() { return kMinServoAngle; };
32 
33  void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew);
34  void UpdateTable();
35  void StartLiveWindowMode();
36  void StopLiveWindowMode();
37  std::string GetSmartDashboardType();
38  void InitTable(ITable *subTable);
39  ITable * GetTable();
40 
41  ITable *m_table;
42 
43 private:
44  void InitServo();
45  float GetServoAngleRange() {return kMaxServoAngle - kMinServoAngle;}
46 
47  static constexpr float kMaxServoAngle = 170.0;
48  static constexpr float kMinServoAngle = 0.0;
49 };
50 
51 #endif
52 
void SetOffline()
Definition: Servo.cpp:74
Definition: SafePWM.h:22
Servo(uint32_t channel)
Definition: Servo.cpp:37
void SetAngle(float angle)
Definition: Servo.cpp:101
void Set(float value)
Definition: Servo.cpp:64
float Get()
Definition: Servo.cpp:85
float GetAngle()
Definition: Servo.cpp:121
Definition: Servo.h:19