WPILibC++  unspecified
SpeedControllerGroup.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2017 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 <functional>
11 #include <vector>
12 
13 #include "SpeedController.h"
14 
15 namespace frc {
16 
18  public:
19  template <class... SpeedControllers>
20  explicit SpeedControllerGroup(SpeedController& speedController,
21  SpeedControllers&... speedControllers);
22 
23  void Set(double speed) override;
24  double Get() const override;
25  void SetInverted(bool isInverted) override;
26  bool GetInverted() const override;
27  void Disable() override;
28  void StopMotor() override;
29  void PIDWrite(double output) override;
30 
31  private:
32  bool m_isInverted = false;
33  std::vector<std::reference_wrapper<SpeedController>> m_speedControllers;
34 };
35 
36 } // namespace frc
37 
38 #include "SpeedControllerGroup.inc"
Interface for speed controlling devices.
Definition: SpeedController.h:17
Definition: Timer.cpp:18
Definition: SpeedControllerGroup.h:17
void Set(double speed) override
Common interface for setting the speed of a speed controller.
Definition: SpeedControllerGroup.cpp:12
double Get() const override
Common interface for getting the current set speed of a speed controller.
Definition: SpeedControllerGroup.cpp:18
void StopMotor() override
Common interface to stop the motor until Set is called again.
Definition: SpeedControllerGroup.cpp:37
void SetInverted(bool isInverted) override
Common interface for inverting direction of a speed controller.
Definition: SpeedControllerGroup.cpp:25
void Disable() override
Common interface for disabling a motor.
Definition: SpeedControllerGroup.cpp:31
bool GetInverted() const override
Common interface for returning the inversion state of a speed controller.
Definition: SpeedControllerGroup.cpp:29