Made SensorBase a utility class and renamed it to SensorUtil (#813)

This commit is contained in:
Tyler Veness
2018-05-23 20:22:30 -07:00
committed by Peter Johnson
parent ba93f79d8b
commit ecfe95383c
72 changed files with 210 additions and 240 deletions

View File

@@ -21,7 +21,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* ADXL345 I2C Accelerometer.
*/
@SuppressWarnings({"TypeName", "PMD.UnusedPrivateField"})
public class ADXL345_I2C extends SensorBase implements Accelerometer, Sendable {
public class ADXL345_I2C extends SendableBase implements Accelerometer {
private static final byte kAddress = 0x1D;
private static final byte kPowerCtlRegister = 0x2D;
private static final byte kDataFormatRegister = 0x31;

View File

@@ -21,7 +21,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* ADXL345 SPI Accelerometer.
*/
@SuppressWarnings({"TypeName", "PMD.UnusedPrivateField"})
public class ADXL345_SPI extends SensorBase implements Accelerometer, Sendable {
public class ADXL345_SPI extends SendableBase implements Accelerometer {
private static final int kPowerCtlRegister = 0x2D;
private static final int kDataFormatRegister = 0x31;
private static final int kDataRegister = 0x32;

View File

@@ -22,7 +22,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* <p>This class allows access to an Analog Devices ADXL362 3-axis accelerometer.
*/
@SuppressWarnings("PMD.UnusedPrivateField")
public class ADXL362 extends SensorBase implements Accelerometer, Sendable {
public class ADXL362 extends SendableBase implements Accelerometer {
private static final byte kRegWrite = 0x0A;
private static final byte kRegRead = 0x0B;

View File

@@ -18,7 +18,7 @@ import static java.util.Objects.requireNonNull;
* through the sensor. Many sensors have multiple axis and can be treated as multiple devices. Each
* is calibrated by finding the center value over a period of time.
*/
public class AnalogAccelerometer extends SensorBase implements PIDSource, Sendable {
public class AnalogAccelerometer extends SendableBase implements PIDSource {
private AnalogInput m_analogChannel;
private double m_voltsPerG = 1.0;
private double m_zeroGVoltage = 2.5;

View File

@@ -26,7 +26,7 @@ import edu.wpi.first.wpilibj.util.AllocationException;
* accumulated effectively increasing the resolution, while the averaged samples are divided by the
* number of samples to retain the resolution, but get more stable values.
*/
public class AnalogInput extends SensorBase implements PIDSource, Sendable {
public class AnalogInput extends SendableBase implements PIDSource {
private static final int kAccumulatorSlot = 1;
int m_port; // explicit no modifier, private and package accessible.
private int m_channel;
@@ -40,7 +40,7 @@ public class AnalogInput extends SensorBase implements PIDSource, Sendable {
* @param channel The channel number to represent. 0-3 are on-board 4-7 are on the MXP port.
*/
public AnalogInput(final int channel) {
checkAnalogInputChannel(channel);
AnalogJNI.checkAnalogInputChannel(channel);
m_channel = channel;
final int portHandle = HAL.getPort((byte) channel);
@@ -50,9 +50,6 @@ public class AnalogInput extends SensorBase implements PIDSource, Sendable {
setName("AnalogInput", channel);
}
/**
* Channel destructor.
*/
@Override
public void close() {
super.close();

View File

@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
/**
* Analog output class.
*/
public class AnalogOutput extends SendableBase implements Sendable {
public class AnalogOutput extends SendableBase {
private int m_port;
private int m_channel;
@@ -26,7 +26,7 @@ public class AnalogOutput extends SendableBase implements Sendable {
* @param channel The channel number to represent.
*/
public AnalogOutput(final int channel) {
SensorBase.checkAnalogOutputChannel(channel);
SensorUtil.checkAnalogOutputChannel(channel);
m_channel = channel;
final int portHandle = HAL.getPort((byte) channel);
@@ -36,9 +36,6 @@ public class AnalogOutput extends SendableBase implements Sendable {
setName("AnalogOutput", channel);
}
/**
* Channel destructor.
*/
@Override
public void close() {
super.close();

View File

@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* corresponds to a position. The position is in whichever units you choose, by way of the scaling
* and offset constants passed to the constructor.
*/
public class AnalogPotentiometer extends SensorBase implements Potentiometer, Sendable {
public class AnalogPotentiometer extends SendableBase implements Potentiometer {
private AnalogInput m_analogInput;
private boolean m_initAnalogInput;
private double m_fullRange;
@@ -154,9 +154,6 @@ public class AnalogPotentiometer extends SensorBase implements Potentiometer, Se
}
}
/**
* Frees this resource.
*/
@Override
public void close() {
super.close();

View File

@@ -20,7 +20,7 @@ import edu.wpi.first.wpilibj.util.BoundaryException;
/**
* Class for creating and configuring Analog Triggers.
*/
public class AnalogTrigger extends SensorBase implements Sendable {
public class AnalogTrigger extends SendableBase {
/**
* Exceptions dealing with improper operation of the Analog trigger.
*/
@@ -74,9 +74,6 @@ public class AnalogTrigger extends SensorBase implements Sendable {
setName("AnalogTrigger", channel.getChannel());
}
/**
* Release the resources used by this object.
*/
@Override
public void close() {
super.close();

View File

@@ -19,7 +19,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
*
* <p>This class allows access to the roboRIO's internal accelerometer.
*/
public class BuiltInAccelerometer extends SensorBase implements Accelerometer, Sendable {
public class BuiltInAccelerometer extends SendableBase implements Accelerometer {
/**
* Constructor.
*

View File

@@ -23,7 +23,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* the safety provided by using the pressure switch and closed loop control. You can only turn off
* closed loop control, thereby stopping the compressor from operating.
*/
public class Compressor extends SendableBase implements Sendable {
public class Compressor extends SendableBase {
private int m_compressorHandle;
private byte m_module;
@@ -49,7 +49,7 @@ public class Compressor extends SendableBase implements Sendable {
* specifying the CAN ID.}
*/
public Compressor() {
this(SensorBase.getDefaultSolenoidModule());
this(SensorUtil.getDefaultSolenoidModule());
}
/**

View File

@@ -28,7 +28,7 @@ import static java.util.Objects.requireNonNull;
* <p>All counters will immediately start counting - reset() them if you need them to be zeroed
* before use.
*/
public class Counter extends SensorBase implements CounterBase, Sendable, PIDSource {
public class Counter extends SendableBase implements CounterBase, PIDSource {
/**
* Mode determines how and what the counter counts.
*/

View File

@@ -20,7 +20,7 @@ import edu.wpi.first.wpilibj.hal.HAL;
* removing digital inputs from a FPGA glitch filter. The filter lets the user configure the time
* that an input must remain high or low before it is classified as high or low.
*/
public class DigitalGlitchFilter extends SensorBase {
public class DigitalGlitchFilter extends SendableBase {
/**
* Configures the Digital Glitch Filter to its default settings.
*/
@@ -40,9 +40,7 @@ public class DigitalGlitchFilter extends SensorBase {
}
}
/**
* Free the resources used by this object.
*/
@Override
public void close() {
super.close();
if (m_channelIndex >= 0) {
@@ -144,7 +142,7 @@ public class DigitalGlitchFilter extends SensorBase {
* @param nanoseconds The number of nanoseconds.
*/
public void setPeriodNanoSeconds(long nanoseconds) {
int fpgaCycles = (int) (nanoseconds * kSystemClockTicksPerMicrosecond / 4
int fpgaCycles = (int) (nanoseconds * SensorUtil.kSystemClockTicksPerMicrosecond / 4
/ 1000);
setPeriodCycles(fpgaCycles);
}
@@ -169,7 +167,7 @@ public class DigitalGlitchFilter extends SensorBase {
int fpgaCycles = getPeriodCycles();
return (long) fpgaCycles * 1000L
/ (long) (kSystemClockTicksPerMicrosecond / 4);
/ (long) (SensorUtil.kSystemClockTicksPerMicrosecond / 4);
}
@SuppressWarnings("PMD.UnusedFormalParameter")

View File

@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* elsewhere will automatically allocate digital inputs and outputs as required. This class is only
* for devices like switches etc. that aren't implemented anywhere else.
*/
public class DigitalInput extends DigitalSource implements Sendable {
public class DigitalInput extends DigitalSource {
private int m_channel = 0;
private int m_handle = 0;
@@ -28,7 +28,7 @@ public class DigitalInput extends DigitalSource implements Sendable {
* @param channel the DIO channel for the digital input 0-9 are on-board, 10-25 are on the MXP
*/
public DigitalInput(int channel) {
checkDigitalChannel(channel);
SensorUtil.checkDigitalChannel(channel);
m_channel = channel;
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), true);
@@ -37,9 +37,7 @@ public class DigitalInput extends DigitalSource implements Sendable {
setName("DigitalInput", channel);
}
/**
* Frees the resources for this output.
*/
@Override
public void close() {
super.close();
if (m_interrupt != 0) {

View File

@@ -16,7 +16,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* Class to write digital outputs. This class will write digital outputs. Other devices that are
* implemented elsewhere will automatically allocate digital inputs and outputs as required.
*/
public class DigitalOutput extends SendableBase implements Sendable {
public class DigitalOutput extends SendableBase {
private static final int invalidPwmGenerator = 0;
private int m_pwmGenerator = invalidPwmGenerator;
@@ -31,7 +31,7 @@ public class DigitalOutput extends SendableBase implements Sendable {
* the MXP
*/
public DigitalOutput(int channel) {
SensorBase.checkDigitalChannel(channel);
SensorUtil.checkDigitalChannel(channel);
m_channel = channel;
m_handle = DIOJNI.initializeDIOPort(HAL.getPort((byte) channel), false);
@@ -40,13 +40,10 @@ public class DigitalOutput extends SendableBase implements Sendable {
setName("DigitalOutput", channel);
}
/**
* Free the resources associated with a digital output.
*/
@Override
public void close() {
super.close();
// disable the pwm only if we have allocated it
// Disable the pwm only if we have allocated it
if (m_pwmGenerator != invalidPwmGenerator) {
disablePWM();
}
@@ -143,7 +140,7 @@ public class DigitalOutput extends SendableBase implements Sendable {
return;
}
// Disable the output by routing to a dead bit.
DIOJNI.setDigitalPWMOutputChannel(m_pwmGenerator, SensorBase.kDigitalChannels);
DIOJNI.setDigitalPWMOutputChannel(m_pwmGenerator, SensorUtil.kDigitalChannels);
DIOJNI.freeDigitalPWM(m_pwmGenerator);
m_pwmGenerator = invalidPwmGenerator;
}

View File

@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* <p>The DoubleSolenoid class is typically used for pneumatics solenoids that have two positions
* controlled by two separate channels.
*/
public class DoubleSolenoid extends SolenoidBase implements Sendable {
public class DoubleSolenoid extends SolenoidBase {
/**
* Possible values for a DoubleSolenoid.
*/
@@ -40,7 +40,7 @@ public class DoubleSolenoid extends SolenoidBase implements Sendable {
* @param reverseChannel The reverse channel number on the PCM (0..7).
*/
public DoubleSolenoid(final int forwardChannel, final int reverseChannel) {
this(SensorBase.getDefaultSolenoidModule(), forwardChannel, reverseChannel);
this(SensorUtil.getDefaultSolenoidModule(), forwardChannel, reverseChannel);
}
/**
@@ -54,9 +54,9 @@ public class DoubleSolenoid extends SolenoidBase implements Sendable {
final int reverseChannel) {
super(moduleNumber);
SensorBase.checkSolenoidModule(m_moduleNumber);
SensorBase.checkSolenoidChannel(forwardChannel);
SensorBase.checkSolenoidChannel(reverseChannel);
SensorUtil.checkSolenoidModule(m_moduleNumber);
SensorUtil.checkSolenoidChannel(forwardChannel);
SensorUtil.checkSolenoidChannel(reverseChannel);
int portHandle = HAL.getPortWithModule((byte) m_moduleNumber, (byte) forwardChannel);
m_forwardHandle = SolenoidJNI.initializeSolenoidPort(portHandle);
@@ -82,9 +82,6 @@ public class DoubleSolenoid extends SolenoidBase implements Sendable {
setName("DoubleSolenoid", m_moduleNumber, forwardChannel);
}
/**
* Destructor.
*/
@Override
public synchronized void close() {
super.close();

View File

@@ -28,7 +28,7 @@ import static java.util.Objects.requireNonNull;
* <p>All encoders will immediately start counting - reset() them if you need them to be zeroed
* before use.
*/
public class Encoder extends SensorBase implements CounterBase, PIDSource, Sendable {
public class Encoder extends SendableBase implements CounterBase, PIDSource {
public enum IndexingType {
kResetWhileHigh(0), kResetWhileLow(1), kResetOnFallingEdge(2), kResetOnRisingEdge(3);
@@ -290,9 +290,6 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, Senda
return EncoderJNI.getEncoderEncodingScale(m_encoder);
}
/**
* Free the resources used by this object.
*/
@Override
public void close() {
super.close();

View File

@@ -13,7 +13,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
/**
* GyroBase is the common base class for Gyro implementations such as AnalogGyro.
*/
public abstract class GyroBase extends SensorBase implements Gyro, PIDSource, Sendable {
public abstract class GyroBase extends SendableBase implements Gyro, PIDSource {
private PIDSourceType m_pidSource = PIDSourceType.kDisplacement;
/**

View File

@@ -57,9 +57,6 @@ public class I2C implements AutoCloseable {
close();
}
/**
* Destructor.
*/
@Override
public void close() {
I2CJNI.i2CClose(m_port);

View File

@@ -14,7 +14,7 @@ import edu.wpi.first.wpilibj.util.AllocationException;
/**
* Base for sensors to be used with interrupts.
*/
public abstract class InterruptableSensorBase extends SensorBase {
public abstract class InterruptableSensorBase extends SendableBase {
@SuppressWarnings("JavadocMethod")
public enum WaitResult {
kTimeout(0x0), kRisingEdge(0x1), kFallingEdge(0x100), kBoth(0x101);
@@ -44,9 +44,6 @@ public abstract class InterruptableSensorBase extends SensorBase {
m_interrupt = 0;
}
/**
* Frees the resources for this output.
*/
@Override
public void close() {
super.close();

View File

@@ -49,9 +49,6 @@ public class NidecBrushless extends SendableBase implements SpeedController, Mot
setName("Nidec Brushless", pwmChannel);
}
/**
* Free the resources used by this object.
*/
@Override
public void close() {
super.close();

View File

@@ -88,9 +88,6 @@ public class PIDController extends PIDBase implements Controller {
this(Kp, Ki, Kd, Kf, source, output, kDefaultPeriod);
}
/**
* Free the PID object.
*/
@Override
public void close() {
super.close();

View File

@@ -24,7 +24,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* center value - 999 to 2 = linear scaling from "center" to "full reverse" - 1 = minimum pulse
* width (currently .5ms) - 0 = disabled (i.e. PWM output is held low)
*/
public class PWM extends SendableBase implements Sendable {
public class PWM extends SendableBase {
/**
* Represents the amount to multiply the minimum servo-pulse pwm period by.
*/
@@ -52,7 +52,7 @@ public class PWM extends SendableBase implements Sendable {
* @param channel The PWM channel number. 0-9 are on-board, 10-19 are on the MXP port
*/
public PWM(final int channel) {
SensorBase.checkPWMChannel(channel);
SensorUtil.checkPWMChannel(channel);
m_channel = channel;
m_handle = PWMJNI.initializePWMPort(HAL.getPort((byte) channel));
@@ -66,9 +66,7 @@ public class PWM extends SendableBase implements Sendable {
}
/**
* Free the PWM channel.
*
* <p>Free the resource associated with the PWM channel and set the value to 0.
* Free the resource associated with the PWM channel and set the value to 0.
*/
@Override
public void close() {

View File

@@ -25,6 +25,11 @@ public abstract class PWMSpeedController extends SafePWM implements SpeedControl
super(channel);
}
@Override
public String getDescription() {
return "PWM " + getChannel();
}
/**
* Set the PWM value.
*

View File

@@ -14,7 +14,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* Class for getting voltage, current, temperature, power and energy from the Power Distribution
* Panel over CAN.
*/
public class PowerDistributionPanel extends SensorBase implements Sendable {
public class PowerDistributionPanel extends SendableBase {
private final int m_module;
/**
@@ -24,7 +24,7 @@ public class PowerDistributionPanel extends SensorBase implements Sendable {
*/
public PowerDistributionPanel(int module) {
m_module = module;
checkPDPModule(module);
SensorUtil.checkPDPModule(module);
PDPJNI.initializePDP(module);
setName("PowerDistributionPanel", module);
}
@@ -62,7 +62,7 @@ public class PowerDistributionPanel extends SensorBase implements Sendable {
public double getCurrent(int channel) {
double current = PDPJNI.getPDPChannelCurrent((byte) channel, m_module);
checkPDPChannel(channel);
SensorUtil.checkPDPChannel(channel);
return current;
}
@@ -111,7 +111,7 @@ public class PowerDistributionPanel extends SensorBase implements Sendable {
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("PowerDistributionPanel");
for (int i = 0; i < kPDPChannels; ++i) {
for (int i = 0; i < SensorUtil.kPDPChannels; ++i) {
final int chan = i;
builder.addDoubleProperty("Chan" + i, () -> getCurrent(chan), null);
}

View File

@@ -26,7 +26,7 @@ import static java.util.Objects.requireNonNull;
* channels (forward and reverse) to be used independently for something that does not care about
* voltage polarity (like a solenoid).
*/
public class Relay extends SendableBase implements MotorSafety, Sendable {
public class Relay extends SendableBase implements MotorSafety {
private MotorSafetyHelper m_safetyHelper;
/**
@@ -100,7 +100,7 @@ public class Relay extends SendableBase implements MotorSafety, Sendable {
* set to both lines at 0v.
*/
private void initRelay() {
SensorBase.checkRelayChannel(m_channel);
SensorUtil.checkRelayChannel(m_channel);
int portHandle = HAL.getPort((byte) m_channel);
if (m_direction == Direction.kBoth || m_direction == Direction.kForward) {

View File

@@ -97,9 +97,6 @@ public abstract class RobotBase implements AutoCloseable {
public void free() {
}
/**
* Free the resources for a RobotBase class.
*/
@Override
public void close() {
}

View File

@@ -55,9 +55,6 @@ public class SPI implements AutoCloseable {
close();
}
/**
* Free the resources used by this object.
*/
@Override
public void close() {
if (m_accum != null) {

View File

@@ -40,9 +40,6 @@ public abstract class SendableBase implements Sendable, AutoCloseable {
close();
}
/**
* Free the resources used by this object.
*/
@Override
public void close() {
LiveWindow.remove(this);

View File

@@ -17,64 +17,61 @@ import edu.wpi.first.wpilibj.hal.RelayJNI;
import edu.wpi.first.wpilibj.hal.SolenoidJNI;
/**
* Base class for all sensors. Stores most recent status information as well as containing utility
* functions for checking channels and error processing.
* Stores most recent status information as well as containing utility functions for checking
* channels and error processing.
*/
public abstract class SensorBase extends SendableBase {
public final class SensorUtil {
/**
* Ticks per microsecond.
*/
public static final int kSystemClockTicksPerMicrosecond =
ConstantsJNI.getSystemClockTicksPerMicrosecond();
public static final int kSystemClockTicksPerMicrosecond
= ConstantsJNI.getSystemClockTicksPerMicrosecond();
/**
* Number of digital channels per roboRIO.
*/
public static final int kDigitalChannels = PortsJNI.getNumDigitalChannels();
/**
* Number of analog input channels per roboRIO.
*/
public static final int kAnalogInputChannels = PortsJNI.getNumAnalogInputs();
/**
* Number of analog output channels per roboRIO.
*/
public static final int kAnalogOutputChannels = PortsJNI.getNumAnalogOutputs();
/**
* Number of solenoid channels per module.
*/
public static final int kSolenoidChannels = PortsJNI.getNumSolenoidChannels();
/**
* Number of PWM channels per roboRIO.
*/
public static final int kPwmChannels = PortsJNI.getNumPWMChannels();
/**
* Number of relay channels per roboRIO.
*/
public static final int kRelayChannels = PortsJNI.getNumRelayHeaders();
/**
* Number of power distribution channels per PDP.
*/
public static final int kPDPChannels = PortsJNI.getNumPDPChannels();
/**
* Number of power distribution modules per PDP.
*/
public static final int kPDPModules = PortsJNI.getNumPDPModules();
/**
* Number of PCM Modules.
*/
public static final int kPCMModules = PortsJNI.getNumPCMModules();
private static int m_defaultSolenoidModule = 0;
/**
* Set the default location for the Solenoid module.
*
* @param moduleNumber The number of the solenoid module to use.
*/
public static void setDefaultSolenoidModule(final int moduleNumber) {
checkSolenoidModule(moduleNumber);
SensorBase.m_defaultSolenoidModule = moduleNumber;
}
/**
* Verify that the solenoid module is correct.
*
@@ -231,6 +228,9 @@ public abstract class SensorBase extends SendableBase {
* @return The number of the default solenoid module.
*/
public static int getDefaultSolenoidModule() {
return SensorBase.m_defaultSolenoidModule;
return 0;
}
private SensorUtil() {
}
}

View File

@@ -24,7 +24,7 @@ import edu.wpi.first.wpilibj.hal.SerialPortJNI;
* .com/pdf/manuals/370423a.pdf and the NI-VISA Programmer's Reference Manual here:
* http://www.ni.com/pdf/manuals/370132c.pdf
*/
public class SerialPort {
public class SerialPort implements AutoCloseable {
private byte m_port;
public enum Port {
@@ -194,9 +194,7 @@ public class SerialPort {
this(baudRate, port, 8, Parity.kNone, StopBits.kOne);
}
/**
* Destructor.
*/
@Override
public void close() {
SerialPortJNI.serialClose(m_port);
}

View File

@@ -18,7 +18,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* <p>The Solenoid class is typically used for pneumatic solenoids, but could be used for any
* device within the current spec of the PCM.
*/
public class Solenoid extends SolenoidBase implements Sendable {
public class Solenoid extends SolenoidBase {
private final int m_channel; // The channel to control.
private int m_solenoidHandle;
@@ -28,7 +28,7 @@ public class Solenoid extends SolenoidBase implements Sendable {
* @param channel The channel on the PCM to control (0..7).
*/
public Solenoid(final int channel) {
this(SensorBase.getDefaultSolenoidModule(), channel);
this(SensorUtil.getDefaultSolenoidModule(), channel);
}
/**
@@ -41,8 +41,8 @@ public class Solenoid extends SolenoidBase implements Sendable {
super(moduleNumber);
m_channel = channel;
SensorBase.checkSolenoidModule(m_moduleNumber);
SensorBase.checkSolenoidChannel(m_channel);
SensorUtil.checkSolenoidModule(m_moduleNumber);
SensorUtil.checkSolenoidChannel(m_channel);
int portHandle = HAL.getPortWithModule((byte) m_moduleNumber, (byte) m_channel);
m_solenoidHandle = SolenoidJNI.initializeSolenoidPort(portHandle);
@@ -51,11 +51,8 @@ public class Solenoid extends SolenoidBase implements Sendable {
setName("Solenoid", m_moduleNumber, m_channel);
}
/**
* Destructor.
*/
@Override
public synchronized void close() {
public void close() {
super.close();
SolenoidJNI.freeSolenoidPort(m_solenoidHandle);
m_solenoidHandle = 0;

View File

@@ -22,7 +22,7 @@ import static java.util.Objects.requireNonNull;
* echo is received. The time that the line is high determines the round trip distance (time of
* flight).
*/
public class Ultrasonic extends SensorBase implements PIDSource, Sendable {
public class Ultrasonic extends SendableBase implements PIDSource {
/**
* The units to return when PIDGet is called.
*/

View File

@@ -10,7 +10,6 @@ package edu.wpi.first.wpilibj.command;
import java.util.Enumeration;
import edu.wpi.first.wpilibj.RobotState;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.SendableBase;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
@@ -40,7 +39,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* @see CommandGroup
* @see IllegalUseOfCommandException
*/
public abstract class Command extends SendableBase implements Sendable {
public abstract class Command extends SendableBase {
/**
* The time since this command was initialized.
*/

View File

@@ -11,7 +11,6 @@ import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.PIDSourceType;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
/**
@@ -21,7 +20,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
* start and stop said {@link PIDController} when the {@link PIDCommand} is first initialized and
* ended/interrupted. </p>
*/
public abstract class PIDCommand extends Command implements Sendable {
public abstract class PIDCommand extends Command {
/**
* The internal {@link PIDController}.
*/

View File

@@ -11,7 +11,6 @@ import edu.wpi.first.wpilibj.PIDController;
import edu.wpi.first.wpilibj.PIDOutput;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.PIDSourceType;
import edu.wpi.first.wpilibj.Sendable;
/**
* This class is designed to handle the case where there is a {@link Subsystem} which uses a single
@@ -22,7 +21,7 @@ import edu.wpi.first.wpilibj.Sendable;
* allows access to the internal {@link PIDController} in order to give total control to the
* programmer.
*/
public abstract class PIDSubsystem extends Subsystem implements Sendable {
public abstract class PIDSubsystem extends Subsystem {
/**
* The internal {@link PIDController}.
*/

View File

@@ -13,7 +13,6 @@ import java.util.Vector;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.wpilibj.HLUsageReporting;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.SendableBase;
import edu.wpi.first.wpilibj.buttons.Trigger.ButtonScheduler;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
@@ -30,7 +29,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
*
* @see Command
*/
public class Scheduler extends SendableBase implements Sendable {
public class Scheduler extends SendableBase {
/**
* The Singleton Instance.
*/

View File

@@ -28,7 +28,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
*
* @see Command
*/
public abstract class Subsystem extends SendableBase implements Sendable {
public abstract class Subsystem extends SendableBase {
/**
* Whether or not getDefaultCommand() was called.
*/

View File

@@ -107,7 +107,7 @@ public class LiveWindow {
* @param moduleType A string indicating the type of the module used in the naming (above)
* @param channel The channel number the device is connected to
* @param component A reference to the object being added
* @deprecated Use {@link edu.wpi.first.wpilibj.SensorBase#setName(String, int)} instead.
* @deprecated Use {@link edu.wpi.first.wpilibj.SendableBase#setName(String, int)} instead.
*/
@Deprecated
public static void addSensor(String moduleType, int channel, Sendable component) {
@@ -136,7 +136,7 @@ public class LiveWindow {
* @param moduleType A string that defines the module name in the label for the value
* @param channel The channel number the device is plugged into (usually PWM)
* @param component The reference to the object being added
* @deprecated Use {@link edu.wpi.first.wpilibj.SensorBase#setName(String, int)} instead.
* @deprecated Use {@link edu.wpi.first.wpilibj.SendableBase#setName(String, int)} instead.
*/
@Deprecated
public static void addActuator(String moduleType, int channel, Sendable component) {
@@ -152,7 +152,7 @@ public class LiveWindow {
* @param moduleNumber The number of the particular module type
* @param channel The channel number the device is plugged into (usually PWM)
* @param component The reference to the object being added
* @deprecated Use {@link edu.wpi.first.wpilibj.SensorBase#setName(String, int, int)} instead.
* @deprecated Use {@link edu.wpi.first.wpilibj.SendableBase#setName(String, int, int)} instead.
*/
@Deprecated
public static void addActuator(String moduleType, int moduleNumber, int channel,

View File

@@ -10,7 +10,6 @@ package edu.wpi.first.wpilibj.smartdashboard;
import java.util.LinkedHashMap;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.SendableBase;
import edu.wpi.first.wpilibj.command.Command;
@@ -28,7 +27,7 @@ import static java.util.Objects.requireNonNull;
*
* @param <V> The type of the values to be stored
*/
public class SendableChooser<V> extends SendableBase implements Sendable {
public class SendableChooser<V> extends SendableBase {
/**
* The key for the default value.
*/