mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Removed the old "parsing" interfaces
Change-Id: I94ff79f36d5b61f90c2f242fa06816bf3a3b7ac2
This commit is contained in:
@@ -8,7 +8,6 @@ package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.simulation.SimDigitalInput;
|
||||
import edu.wpi.first.wpilibj.parsing.IInputOutput;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
|
||||
/**
|
||||
@@ -18,8 +17,7 @@ import edu.wpi.first.wpilibj.tables.ITable;
|
||||
* digital inputs and outputs as required. This class is only for devices like
|
||||
* switches etc. that aren't implemented anywhere else.
|
||||
*/
|
||||
public class DigitalInput implements IInputOutput,
|
||||
LiveWindowSendable {
|
||||
public class DigitalInput implements LiveWindowSendable {
|
||||
private SimDigitalInput impl;
|
||||
private int m_channel;
|
||||
|
||||
|
||||
@@ -12,12 +12,11 @@ import gazebo.msgs.GzDriverStation.DriverStation.State;
|
||||
import gazebo.msgs.GzJoystick.Joystick;
|
||||
|
||||
import org.gazebosim.transport.SubscriberCallback;
|
||||
import edu.wpi.first.wpilibj.parsing.IInputOutput;
|
||||
|
||||
/**
|
||||
* Provide access to the network communication data to / from the Driver Station.
|
||||
*/
|
||||
public class DriverStation implements IInputOutput, RobotState.Interface {
|
||||
public class DriverStation implements RobotState.Interface {
|
||||
/**
|
||||
* Slot for the analog module to read the battery
|
||||
*/
|
||||
@@ -104,7 +103,7 @@ public class DriverStation implements IInputOutput, RobotState.Interface {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
final int j = i;
|
||||
MainNode.subscribe("ds/joysticks/"+i, Joystick.getDefaultInstance(),
|
||||
|
||||
@@ -9,7 +9,6 @@ package edu.wpi.first.wpilibj;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.simulation.SimEncoder;
|
||||
import edu.wpi.first.wpilibj.parsing.ISensor;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
import edu.wpi.first.wpilibj.util.BoundaryException;
|
||||
|
||||
@@ -23,8 +22,7 @@ import edu.wpi.first.wpilibj.util.BoundaryException;
|
||||
* encoders have two digital outputs, an A Channel and a B Channel that are out
|
||||
* of phase with each other to allow the FPGA to do direction sensing.
|
||||
*/
|
||||
public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
ISensor, LiveWindowSendable {
|
||||
public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveWindowSendable {
|
||||
private int m_index;
|
||||
private double m_distancePerPulse; // distance of travel for each encoder tick
|
||||
private EncodingType m_encodingType = EncodingType.k4X;
|
||||
@@ -38,7 +36,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
/**
|
||||
* Common initialization code for Encoders. This code allocates resources
|
||||
* for Encoders and is common to all constructors.
|
||||
*
|
||||
*
|
||||
* @param reverseDirection
|
||||
* If true, counts down instead of up (this is all relative)
|
||||
* @param encodingType
|
||||
@@ -55,7 +53,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
m_pidSource = PIDSourceParameter.kDistance;
|
||||
|
||||
LiveWindow.addSensor("Encoder", aChannel, this);
|
||||
|
||||
|
||||
if (bChannel < aChannel) { // Swap ports
|
||||
int channel = bChannel;
|
||||
bChannel = aChannel;
|
||||
@@ -71,7 +69,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
|
||||
/**
|
||||
* Encoder constructor. Construct a Encoder given a and b channels.
|
||||
*
|
||||
*
|
||||
* @param aChannel
|
||||
* The a channel digital input channel.
|
||||
* @param bChannel
|
||||
@@ -91,7 +89,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
|
||||
/**
|
||||
* Encoder constructor. Construct a Encoder given a and b channels.
|
||||
*
|
||||
*
|
||||
* @param aChannel
|
||||
* The a channel digital input channel.
|
||||
* @param bChannel
|
||||
@@ -103,7 +101,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
|
||||
/**
|
||||
* Encoder constructor. Construct a Encoder given a and b channels.
|
||||
*
|
||||
*
|
||||
* @param aChannel
|
||||
* The a channel digital input channel.
|
||||
* @param bChannel
|
||||
@@ -198,7 +196,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
|
||||
/**
|
||||
* Sets the maximum period for stopped detection.
|
||||
* Sets the value that represents the maximum period of the Encoder before
|
||||
* Sets the value that represents the maximum period of the Encoder before
|
||||
* that the attached device is stopped. This timeout allows users to determ
|
||||
* other shaft has stopped rotating.
|
||||
* This method compensates for the decoding type.
|
||||
@@ -215,7 +213,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
/**
|
||||
* Determine if the encoder is stopped.
|
||||
* Using the MaxPeriod value, a boolean is returned that is true if the enc
|
||||
* stopped and false if it is still moving. A stopped encoder is one where
|
||||
* stopped and false if it is still moving. A stopped encoder is one where
|
||||
* width exceeds the MaxPeriod.
|
||||
* @return True if the encoder is considered stopped.
|
||||
*/
|
||||
@@ -257,7 +255,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
/**
|
||||
* Set which parameter of the encoder you are using as a process control
|
||||
* variable. The encoder class supports the rate and distance parameters.
|
||||
*
|
||||
*
|
||||
* @param pidSource
|
||||
* An enum to select the parameter.
|
||||
*/
|
||||
@@ -268,7 +266,7 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource,
|
||||
|
||||
/**
|
||||
* Implement the PIDSource interface.
|
||||
*
|
||||
*
|
||||
* @return The current value of the selected source parameter.
|
||||
*/
|
||||
public double pidGet() {
|
||||
|
||||
@@ -9,7 +9,6 @@ package edu.wpi.first.wpilibj;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.simulation.SimGyro;
|
||||
import edu.wpi.first.wpilibj.parsing.ISensor;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
import edu.wpi.first.wpilibj.util.BoundaryException;
|
||||
|
||||
@@ -22,8 +21,7 @@ import edu.wpi.first.wpilibj.util.BoundaryException;
|
||||
* determine the default offset. This is subtracted from each sample to
|
||||
* determine the heading.
|
||||
*/
|
||||
public class Gyro extends SensorBase implements PIDSource, ISensor,
|
||||
LiveWindowSendable {
|
||||
public class Gyro extends SensorBase implements PIDSource, LiveWindowSendable {
|
||||
|
||||
private PIDSourceParameter m_pidSource;
|
||||
private SimGyro impl;
|
||||
@@ -59,7 +57,7 @@ public class Gyro extends SensorBase implements PIDSource, ISensor,
|
||||
* Gyro constructor with a precreated analog channel object. Use this
|
||||
* constructor when the analog channel needs to be shared. There is no
|
||||
* reference counting when an AnalogChannel is passed to the gyro.
|
||||
*
|
||||
*
|
||||
* @param channel
|
||||
* The AnalogChannel object that the gyro is connected to.
|
||||
*/
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.wpilibj.parsing.IInputOutput;
|
||||
|
||||
/**
|
||||
* Handle input from standard Joysticks connected to the Driver Station.
|
||||
@@ -14,7 +13,7 @@ import edu.wpi.first.wpilibj.parsing.IInputOutput;
|
||||
* the most recent value is returned. There is a single class instance for each joystick and the mapping
|
||||
* of ports to hardware buttons depends on the code in the driver station.
|
||||
*/
|
||||
public class Joystick extends GenericHID implements IInputOutput {
|
||||
public class Joystick extends GenericHID {
|
||||
|
||||
static final byte kDefaultXAxis = 1;
|
||||
static final byte kDefaultYAxis = 2;
|
||||
|
||||
@@ -10,7 +10,6 @@ package edu.wpi.first.wpilibj;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindow;
|
||||
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.simulation.SimSpeedController;
|
||||
import edu.wpi.first.wpilibj.parsing.IDeviceController;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
import edu.wpi.first.wpilibj.tables.ITableListener;
|
||||
|
||||
@@ -24,8 +23,7 @@ import edu.wpi.first.wpilibj.tables.ITableListener;
|
||||
* allows the two channels (forward and reverse) to be used independently for
|
||||
* something that does not care about voltage polarity (like a solenoid).
|
||||
*/
|
||||
public class Relay extends SensorBase implements IDeviceController,
|
||||
LiveWindowSendable {
|
||||
public class Relay extends SensorBase implements LiveWindowSendable {
|
||||
/**
|
||||
* This class represents errors in trying to set relay values contradictory
|
||||
* to the direction to which the relay is set.
|
||||
@@ -200,7 +198,7 @@ public class Relay extends SensorBase implements IDeviceController,
|
||||
"A relay configured for reverse cannot be set to forward");
|
||||
if (m_direction == Direction.kBoth
|
||||
|| m_direction == Direction.kForward) {
|
||||
|
||||
|
||||
go_pos = true;
|
||||
}
|
||||
if (m_direction == Direction.kBoth) {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.wpilibj.parsing.IUtility;
|
||||
|
||||
/**
|
||||
* Utility class for handling Robot drive based on a definition of the motor configuration.
|
||||
@@ -16,7 +15,7 @@ import edu.wpi.first.wpilibj.parsing.IUtility;
|
||||
* used for either the drive function (intended for hand created drive code, such as autonomous)
|
||||
* or with the Tank/Arcade functions intended to be used for Operator Control driving.
|
||||
*/
|
||||
public class RobotDrive implements MotorSafety, IUtility {
|
||||
public class RobotDrive implements MotorSafety {
|
||||
|
||||
protected MotorSafetyHelper m_safetyHelper;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.gazebosim.transport.Msgs;
|
||||
import org.gazebosim.transport.SubscriberCallback;
|
||||
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.parsing.IUtility;
|
||||
import edu.wpi.first.wpilibj.simulation.MainNode;
|
||||
import gazebo.msgs.GzFloat64.Float64;
|
||||
|
||||
@@ -22,7 +21,7 @@ import gazebo.msgs.GzFloat64.Float64;
|
||||
* value. The implementation simply records the time when started and subtracts the current time
|
||||
* whenever the value is requested.
|
||||
*/
|
||||
public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
public class SimTimer implements Timer.StaticInterface {
|
||||
|
||||
private long m_startTime;
|
||||
private double m_accumulatedTime;
|
||||
@@ -52,7 +51,7 @@ public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
*/
|
||||
public void delay(final double seconds) {
|
||||
final double start = simTime;
|
||||
|
||||
|
||||
while ((simTime - start) < seconds) {
|
||||
synchronized(time_notifier) {
|
||||
try {
|
||||
@@ -104,7 +103,7 @@ public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
private long getMsClock() {
|
||||
return (long) (simTime * 1e3);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the current time from the timer. If the clock is running it is derived from
|
||||
* the current system clock the start time stored in the timer class. If the clock
|
||||
@@ -119,7 +118,7 @@ public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
return m_accumulatedTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the timer by setting the time to 0.
|
||||
* Make the timer startTime the current time so new requests will be relative now
|
||||
@@ -128,7 +127,7 @@ public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
m_accumulatedTime = 0;
|
||||
m_startTime = getMsClock();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Start the timer running.
|
||||
* Just set the running flag to true indicating that all time requests should be
|
||||
@@ -138,7 +137,7 @@ public class SimTimer implements IUtility, Timer.StaticInterface {
|
||||
m_startTime = getMsClock();
|
||||
m_running = true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stop the timer.
|
||||
* This computes the time as of now and clears the running flag, causing all
|
||||
|
||||
Reference in New Issue
Block a user