blob: a87ed2bc7f2128d1bf364c4a3e63eedef2c82807 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
2/* Copyright (c) FIRST 2008. All Rights Reserved.
3 */
4/* Open Source Software - may be modified and shared by FRC teams. The code */
5/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
6/*----------------------------------------------------------------------------*/
7#pragma once
8
9#include "HAL/HAL.hpp"
10#include "PIDOutput.h"
11
12/**
13 * Interface for speed controlling devices.
14 */
15class SpeedController : public PIDOutput {
16 public:
17 virtual ~SpeedController() = default;
18 /**
19 * Common interface for setting the speed of a speed controller.
20 *
21 * @param speed The speed to set. Value should be between -1.0 and 1.0.
22 * @param syncGroup The update group to add this Set() to, pending
23 * UpdateSyncGroup(). If 0, update immediately.
24 */
25 virtual void Set(float speed, uint8_t syncGroup = 0) = 0;
26
27 /**
28 * Common interface for getting the current set speed of a speed controller.
29 *
30 * @return The current set speed. Value is between -1.0 and 1.0.
31 */
32 virtual float Get() const = 0;
33
34 /**
35 * Common interface for inverting direction of a speed controller.
36 * @param isInverted The state of inversion, true is inverted.
37 */
38 virtual void SetInverted(bool isInverted) = 0;
39 /**
40
41 * Common interface for disabling a motor.
42 */
43 virtual void Disable() = 0;
44
45 /**
46 * Common interface for returning the inversion state of a speed controller.
47 * @return isInverted The state of inversion, true is inverted.
48 */
49 virtual bool GetInverted() const = 0;
50};