WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
PWMSpeedController.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008-2017. 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 the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include "SafePWM.h"
11 #include "SpeedController.h"
12 
13 namespace frc {
14 
18 class PWMSpeedController : public SafePWM, public SpeedController {
19  public:
20  virtual ~PWMSpeedController() = default;
21  void Set(double value) override;
22  double Get() const override;
23  void SetInverted(bool isInverted) override;
24  bool GetInverted() const override;
25  void Disable() override;
26  void StopMotor() override;
27 
28  void PIDWrite(double output) override;
29 
30  protected:
31  explicit PWMSpeedController(int channel);
32 
33  private:
34  bool m_isInverted = false;
35 };
36 
37 } // namespace frc
Interface for speed controlling devices.
Definition: SpeedController.h:17
void Disable() override
Common interface for disabling a motor.
Definition: PWMSpeedController.cpp:45
double Get() const override
Get the recently set value of the PWM.
Definition: PWMSpeedController.cpp:37
bool GetInverted() const override
Common interface for returning the inversion state of a speed controller.
Definition: PWMSpeedController.cpp:43
void Set(double value) override
Set the PWM value.
Definition: PWMSpeedController.cpp:28
PWMSpeedController(int channel)
Constructor for a PWM Speed Controller connected via PWM.
Definition: PWMSpeedController.cpp:18
A safe version of the PWM class.
Definition: SafePWM.h:26
void StopMotor() override
Common interface to stop the motor until Set is called again.
Definition: PWMSpeedController.cpp:47
void SetInverted(bool isInverted) override
Common interface for inverting direction of a speed controller.
Definition: PWMSpeedController.cpp:39
void PIDWrite(double output) override
Write out the PID value as seen in the PIDOutput base object.
Definition: PWMSpeedController.cpp:54
Common base class for all PWM Speed Controllers.
Definition: PWMSpeedController.h:18