diff --git a/wpilibc/src/main/native/include/CANSpeedController.h b/wpilibc/src/main/native/include/CANSpeedController.h deleted file mode 100644 index 81ec6a0446..0000000000 --- a/wpilibc/src/main/native/include/CANSpeedController.h +++ /dev/null @@ -1,115 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* Copyright (c) 2014-2017 FIRST. All Rights Reserved. */ -/* Open Source Software - may be modified and shared by FRC teams. The code */ -/* must be accompanied by the FIRST BSD license file in the root directory of */ -/* the project. */ -/*----------------------------------------------------------------------------*/ - -#pragma once - -#include - -#include "SpeedController.h" - -namespace frc { - -/** - * Interface for "smart" CAN-based speed controllers. - */ -class CANSpeedController : public SpeedController { - public: - enum ControlMode { - kPercentVbus = 0, - kCurrent = 1, - kSpeed = 2, - kPosition = 3, - kVoltage = 4, - kFollower = 5, - kMotionProfile = 6, - }; - - // Helper function for the ControlMode enum - virtual bool IsModePID(ControlMode mode) const = 0; - - enum Faults { - kCurrentFault = 1, - kTemperatureFault = 2, - kBusVoltageFault = 4, - kGateDriverFault = 8, - // SRX extensions - kFwdLimitSwitch = 0x10, - kRevLimitSwitch = 0x20, - kFwdSoftLimit = 0x40, - kRevSoftLimit = 0x80, - }; - - enum Limits { kForwardLimit = 1, kReverseLimit = 2 }; - - enum NeutralMode { - /** - * Use the NeutralMode that is set by the jumper wire on the CAN device - */ - kNeutralMode_Jumper = 0, - /** - * Stop the motor's rotation by applying a force. - */ - kNeutralMode_Brake = 1, - /** - * Do not attempt to stop the motor. Instead allow it to coast to a stop - * without applying resistance. - */ - kNeutralMode_Coast = 2 - }; - - enum LimitMode { - /** - * Only use switches for limits - */ - kLimitMode_SwitchInputsOnly = 0, - /** - * Use both switches and soft limits - */ - kLimitMode_SoftPositionLimits = 1, - // SRX extensions - /** - * Disable switches and disable soft limits - */ - kLimitMode_SrxDisableSwitchInputs = 2, - }; - - virtual double Get() const = 0; - virtual void Set(double value) = 0; - virtual void StopMotor() = 0; - virtual void Disable() = 0; - virtual void SetP(double p) = 0; - virtual void SetI(double i) = 0; - virtual void SetD(double d) = 0; - virtual void SetPID(double p, double i, double d) = 0; - virtual double GetP() const = 0; - virtual double GetI() const = 0; - virtual double GetD() const = 0; - virtual double GetBusVoltage() const = 0; - virtual double GetOutputVoltage() const = 0; - virtual double GetOutputCurrent() const = 0; - virtual double GetTemperature() const = 0; - virtual double GetPosition() const = 0; - virtual double GetSpeed() const = 0; - virtual bool GetForwardLimitOK() const = 0; - virtual bool GetReverseLimitOK() const = 0; - virtual uint16_t GetFaults() const = 0; - virtual void SetVoltageRampRate(double rampRate) = 0; - virtual int GetFirmwareVersion() const = 0; - virtual void ConfigNeutralMode(NeutralMode mode) = 0; - virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) = 0; - virtual void ConfigPotentiometerTurns(uint16_t turns) = 0; - virtual void ConfigSoftPositionLimits(double forwardLimitPosition, - double reverseLimitPosition) = 0; - virtual void DisableSoftPositionLimits() = 0; - virtual void ConfigLimitMode(LimitMode mode) = 0; - virtual void ConfigForwardLimit(double forwardLimitPosition) = 0; - virtual void ConfigReverseLimit(double reverseLimitPosition) = 0; - virtual void ConfigMaxOutputVoltage(double voltage) = 0; - virtual void ConfigFaultTime(double faultTime) = 0; -}; - -} // namespace frc diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java deleted file mode 100644 index 9b72dbd2f8..0000000000 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java +++ /dev/null @@ -1,146 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* Copyright (c) 2016-2017 FIRST. All Rights Reserved. */ -/* Open Source Software - may be modified and shared by FRC teams. The code */ -/* must be accompanied by the FIRST BSD license file in the root directory of */ -/* the project. */ -/*----------------------------------------------------------------------------*/ - -package edu.wpi.first.wpilibj; - -import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable; - -public interface CANSpeedController extends SpeedController, PIDInterface, LiveWindowSendable { - /** - * Mode determines how the motor is controlled, used internally. This is meant to be subclassed by - * enums - * - *

Note that the Jaguar does not support follower mode. - */ - interface ControlMode { - /** - * Gets the name of this control mode. Since this interface should only be subclassed by - * enumerations, this will be overridden by the builtin name() method. - */ - String name(); - - /** - * Checks if this control mode is PID-compatible. - */ - boolean isPID(); - - /** - * Gets the integer value of this control mode. - */ - int getValue(); - } - - /** - * Gets the current control mode. - * - * @return the current control mode - */ - ControlMode getControlMode(); - - /** - * Sets the control mode of this speed controller. - * - * @param mode the the new mode - */ - void setControlMode(int mode); - - /** - * Set the proportional PID constant. - */ - @SuppressWarnings("ParameterName") - void setP(double p); - - /** - * Set the integral PID constant. - */ - @SuppressWarnings("ParameterName") - void setI(double i); - - /** - * Set the derivative PID constant. - */ - @SuppressWarnings("ParameterName") - void setD(double d); - - /** - * Set the feed-forward PID constant. This method is optional to implement. - */ - @SuppressWarnings("ParameterName") - default void setF(double f) { - } - - /** - * Gets the feed-forward PID constant. This method is optional to implement. If a subclass does - * not implement this, it will always return zero. - */ - default double getF() { - return 0.0; - } - - /** - * Get the current input (battery) voltage. - * - * @return the input voltage to the controller (in Volts). - */ - double getBusVoltage(); - - /** - * Get the current output voltage. - * - * @return the output voltage to the motor in volts. - */ - double getOutputVoltage(); - - /** - * Get the current being applied to the motor. - * - * @return the current motor current (in Amperes). - */ - double getOutputCurrent(); - - /** - * Get the current temperature of the controller. - * - * @return the current temperature of the controller, in degrees Celsius. - */ - double getTemperature(); - - /** - * Return the current position of whatever the current selected sensor is. - * - *

See specific implementations for more information on selecting feedback sensors. - * - * @return the current sensor position. - */ - double getPosition(); - - /** - * Return the current velocity of whatever the current selected sensor is. - * - *

See specific implementations for more information on selecting feedback sensors. - * - * @return the current sensor velocity. - */ - double getSpeed(); - - /** - * Set the maximum rate of change of the output voltage. - * - * @param rampRate the maximum rate of change of the voltage, in Volts / sec. - */ - void setVoltageRampRate(double rampRate); - - /** - * All CAN Speed Controllers have the same SmartDashboard type: "CANSpeedController". - */ - String SMART_DASHBOARD_TYPE = "CANSpeedController"; - - @Override - default String getSmartDashboardType() { - return SMART_DASHBOARD_TYPE; - } -}