LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
LRTSpeedController.h
1 #ifndef LRT_SPEEDCONTROLLER_H_
2 #define LRT_SPEEDCONTROLLER_H_
3 
4 #include "Actuator.h"
5 #include <CounterBase.h>
6 #include <Timer.h>
7 #include "../Logging/Loggable.h"
8 
12 class LRTSpeedController : public Actuator, public Loggable
13 {
14 public:
15  typedef enum
16  {
17  kNeutralMode_Jumper = 0, kNeutralMode_Brake = 1, kNeutralMode_Coast = 2
18  } NeutralMode;
19 
20  explicit LRTSpeedController(std::string name);
21  virtual ~LRTSpeedController();
22 
26  void Output();
27 
34  void RegisterSafety(CounterBase *encoder, double timeoutSeconds, float threshold = 0.01);
35 
39  virtual void SafetyCallback();
40 
45  virtual void SetDutyCycle(float pwm) = 0;
46 
51  virtual float GetDutyCycle() = 0;
52 
57  virtual float GetHardwareValue() = 0;
58 
62  virtual void Update() = 0;
63 
68  virtual void ConfigNeutralMode(LRTSpeedController::NeutralMode mode) = 0;
69 
74  virtual NeutralMode GetNeutralMode() = 0;
75 
84  static float CurrentLimit(float dutyCycle, float speed, float forwardLimit, float reverseLimit);
85 
86  virtual void Log();
87 
88  virtual void Send();
89 
90 private:
91  CounterBase* m_encoder;
92  double m_timeoutSeconds;
93  float m_threshold;
94  Timer m_timer;
95 };
96 
97 #endif