WPILibC++  unspecified
PWMSpeedController.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2018 FIRST. 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:
28  void Set(double value) override;
29 
35  double Get() const override;
36 
37  void SetInverted(bool isInverted) override;
38 
39  bool GetInverted() const override;
40 
41  void Disable() override;
42 
43  void StopMotor() override;
44 
50  void PIDWrite(double output) override;
51 
52  protected:
59  explicit PWMSpeedController(int channel);
60 
61  void InitSendable(SendableBuilder& builder) override;
62 
63  private:
64  bool m_isInverted = false;
65 };
66 
67 } // namespace frc
Interface for speed controlling devices.
Definition: SpeedController.h:17
Definition: Utility.cpp:119
void Disable() override
Common interface for disabling a motor.
Definition: PWMSpeedController.cpp:26
double Get() const override
Get the recently set value of the PWM.
Definition: PWMSpeedController.cpp:18
bool GetInverted() const override
Common interface for returning the inversion state of a speed controller.
Definition: PWMSpeedController.cpp:24
void Set(double value) override
Set the PWM value.
Definition: PWMSpeedController.cpp:14
PWMSpeedController(int channel)
Constructor for a PWM Speed Controller connected via PWM.
Definition: PWMSpeedController.cpp:32
A safe version of the PWM class.
Definition: SafePWM.h:28
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: PWMSpeedController.cpp:34
void StopMotor() override
Stop the motor associated with this PWM object.
Definition: PWMSpeedController.cpp:28
Definition: SendableBuilder.h:23
void SetInverted(bool isInverted) override
Common interface for inverting direction of a speed controller.
Definition: PWMSpeedController.cpp:20
void PIDWrite(double output) override
Write out the PID value as seen in the PIDOutput base object.
Definition: PWMSpeedController.cpp:30
Common base class for all PWM Speed Controllers.
Definition: PWMSpeedController.h:18