2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2016-01-02 03:02:34 -08:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#pragma once
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2014-05-02 17:54:01 -04:00
|
|
|
#include "HAL/HAL.hpp"
|
2013-12-15 18:30:16 -05:00
|
|
|
#include "PIDOutput.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interface for speed controlling devices.
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
class SpeedController : public PIDOutput {
|
|
|
|
|
public:
|
2015-06-24 01:06:29 -07:00
|
|
|
virtual ~SpeedController() = default;
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
|
|
|
|
* Common interface for setting the speed of a speed controller.
|
|
|
|
|
*
|
|
|
|
|
* @param speed The speed to set. Value should be between -1.0 and 1.0.
|
|
|
|
|
* @param syncGroup The update group to add this Set() to, pending
|
|
|
|
|
* UpdateSyncGroup(). If 0, update immediately.
|
|
|
|
|
*/
|
|
|
|
|
virtual void Set(float speed, uint8_t syncGroup = 0) = 0;
|
2015-06-15 15:32:47 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
|
|
|
|
* Common interface for getting the current set speed of a speed controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The current set speed. Value is between -1.0 and 1.0.
|
|
|
|
|
*/
|
|
|
|
|
virtual float Get() const = 0;
|
2015-06-15 15:32:47 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
|
|
|
|
* Common interface for inverting direction of a speed controller.
|
|
|
|
|
* @param isInverted The state of inversion, true is inverted.
|
|
|
|
|
*/
|
|
|
|
|
virtual void SetInverted(bool isInverted) = 0;
|
|
|
|
|
/**
|
2015-06-15 15:32:47 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
* Common interface for disabling a motor.
|
|
|
|
|
*/
|
|
|
|
|
virtual void Disable() = 0;
|
2015-06-15 15:32:47 -04:00
|
|
|
|
2015-06-25 15:07:55 -04:00
|
|
|
/**
|
|
|
|
|
* Common interface for returning the inversion state of a speed controller.
|
|
|
|
|
* @return isInverted The state of inversion, true is inverted.
|
|
|
|
|
*/
|
|
|
|
|
virtual bool GetInverted() const = 0;
|
2016-02-10 14:00:06 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Common interface to stop the motor until Set is called again.
|
|
|
|
|
*/
|
|
|
|
|
virtual void StopMotor() = 0;
|
2013-12-15 18:30:16 -05:00
|
|
|
};
|