WPILibC++  2020.3.2-60-g3011ebe
PWMSpeedController.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2008-2019 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 "frc/PWM.h"
11 #include "frc/SpeedController.h"
12 
13 namespace frc {
14 
18 class PWMSpeedController : public PWM, public SpeedController {
19  public:
21  PWMSpeedController& operator=(PWMSpeedController&&) = default;
22 
31  void Set(double value) override;
32 
38  double Get() const override;
39 
40  void SetInverted(bool isInverted) override;
41 
42  bool GetInverted() const override;
43 
44  void Disable() override;
45 
46  void StopMotor() override;
47 
53  void PIDWrite(double output) override;
54 
55  protected:
62  explicit PWMSpeedController(int channel);
63 
64  void InitSendable(SendableBuilder& builder) override;
65 
66  private:
67  bool m_isInverted = false;
68 };
69 
70 } // namespace frc
frc::PWM
Class implements the PWM generation in the FPGA.
Definition: PWM.h:40
frc::PWMSpeedController::Set
void Set(double value) override
Set the PWM value.
frc::PWMSpeedController::InitSendable
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
frc::PWMSpeedController::Disable
void Disable() override
Common interface for disabling a motor.
frc::PWMSpeedController::StopMotor
void StopMotor() override
Common interface to stop the motor until Set is called again.
frc::PWMSpeedController::GetInverted
bool GetInverted() const override
Common interface for returning the inversion state of a speed controller.
frc::PWMSpeedController::SetInverted
void SetInverted(bool isInverted) override
Common interface for inverting direction of a speed controller.
frc::PWMSpeedController::Get
double Get() const override
Get the recently set value of the PWM.
frc::PWMSpeedController
Common base class for all PWM Speed Controllers.
Definition: PWMSpeedController.h:18
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16
frc::SpeedController
Interface for speed controlling devices.
Definition: SpeedController.h:19
frc::PWMSpeedController::PIDWrite
void PIDWrite(double output) override
Write out the PID value as seen in the PIDOutput base object.
frc::SendableBuilder
Definition: SendableBuilder.h:23