From 28ab1ececb3b77365b4dcc7ef3d13da54e7e93b8 Mon Sep 17 00:00:00 2001 From: Nikhil Suresh Date: Wed, 16 Jan 2019 17:40:18 -0800 Subject: [PATCH] made changes to replace deprecated methods in standard --- CommandRobotBase.java | 2 -- custom/CANMessageUnavailableException.java | 2 ++ custom/CommandSendableChooser.java | 8 ++++---- custom/TypedNamedSendableChooser.java | 8 ++++---- custom/controllers/XboxController.java | 10 ++++------ custom/sensors/NavX.java | 1 - custom/sensors/PDP.java | 4 ++-- subsystems/motor/Motor.java | 1 - subsystems/motor/SensorMotor.java | 1 - 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/CommandRobotBase.java b/CommandRobotBase.java index 8c17717e..840a609a 100644 --- a/CommandRobotBase.java +++ b/CommandRobotBase.java @@ -10,7 +10,6 @@ import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.Scheduler; -import edu.wpi.first.wpilibj.livewindow.LiveWindow; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; /** @@ -216,7 +215,6 @@ public final void testInit() { */ @Override public void testPeriodic() { - LiveWindow.run(); testExecute(); alwaysExecute(); } diff --git a/custom/CANMessageUnavailableException.java b/custom/CANMessageUnavailableException.java index 9b63c9cc..a36c9daf 100644 --- a/custom/CANMessageUnavailableException.java +++ b/custom/CANMessageUnavailableException.java @@ -7,6 +7,8 @@ * exception being thrown. */ public class CANMessageUnavailableException extends Exception { + private static final long serialVersionUID = 4904L; + public CANMessageUnavailableException() { super(); } diff --git a/custom/CommandSendableChooser.java b/custom/CommandSendableChooser.java index 7e147dd5..096413ac 100644 --- a/custom/CommandSendableChooser.java +++ b/custom/CommandSendableChooser.java @@ -16,8 +16,8 @@ public class CommandSendableChooser extends SendableChooser { * * @param object */ - public void addObject(Command object) { - super.addObject(object.getName(), object); + public void addOption(Command object) { + super.addOption(object.getName(), object); } /** @@ -26,7 +26,7 @@ public void addObject(Command object) { * * @param object */ - public void addDefault(Command object) { - super.addDefault(object.getName() + " (default)", object); + public void setDefaultOption(Command object) { + super.setDefaultOption(object.getName() + " (default)", object); } } diff --git a/custom/TypedNamedSendableChooser.java b/custom/TypedNamedSendableChooser.java index 6ffc9989..acb7a225 100644 --- a/custom/TypedNamedSendableChooser.java +++ b/custom/TypedNamedSendableChooser.java @@ -16,8 +16,8 @@ public class TypedNamedSendableChooser extends SendableChoos * * @param object */ - public void addObject(T object) { - super.addObject(object.getName(), object); + public void addOption(T object) { + super.addOption(object.getName(), object); } /** @@ -27,8 +27,8 @@ public void addObject(T object) { * * @param object */ - public void addDefault(T object) { - super.addDefault(object.getName() + " (default)", object); + public void setDefaultOption(T object) { + super.setDefaultOption(object.getName() + " (default)", object); } /** * Wrapper for getSelected() to conform to Supplier diff --git a/custom/controllers/XboxController.java b/custom/controllers/XboxController.java index 997592d4..c3e69355 100644 --- a/custom/controllers/XboxController.java +++ b/custom/controllers/XboxController.java @@ -609,11 +609,10 @@ public Joystick getJoystick() { * How strong the rumble is */ public void setRumble(HAND hand, double intensity) { - final float amount = new Float(intensity); if (hand == HAND.LEFT) { - controller.setRumble(RumbleType.kLeftRumble, amount); + controller.setRumble(RumbleType.kLeftRumble, intensity); } else { - controller.setRumble(RumbleType.kRightRumble, amount); + controller.setRumble(RumbleType.kRightRumble, intensity); } } @@ -624,9 +623,8 @@ public void setRumble(HAND hand, double intensity) { * How strong the rumble is */ public void setRumble(double intensity) { - final float amount = new Float(intensity); - controller.setRumble(RumbleType.kLeftRumble, amount); - controller.setRumble(RumbleType.kRightRumble, amount); + controller.setRumble(RumbleType.kLeftRumble, intensity); + controller.setRumble(RumbleType.kRightRumble, intensity); } /* diff --git a/custom/sensors/NavX.java b/custom/sensors/NavX.java index 91cb53f9..cd15320b 100644 --- a/custom/sensors/NavX.java +++ b/custom/sensors/NavX.java @@ -1,7 +1,6 @@ package org.usfirst.frc4904.standard.custom.sensors; -import org.usfirst.frc4904.standard.LogKitten; import com.kauailabs.navx.frc.AHRS; import edu.wpi.first.wpilibj.I2C; import edu.wpi.first.wpilibj.PIDSourceType; diff --git a/custom/sensors/PDP.java b/custom/sensors/PDP.java index 8c79b290..1f7f36d8 100644 --- a/custom/sensors/PDP.java +++ b/custom/sensors/PDP.java @@ -4,7 +4,7 @@ import org.usfirst.frc4904.standard.LogKitten; import org.usfirst.frc4904.standard.custom.CANMessageUnavailableException; import org.usfirst.frc4904.standard.custom.CustomCAN; -import edu.wpi.first.wpilibj.DriverStation; +import edu.wpi.first.wpilibj.RobotController; /** * Simplified version of the PowerDistributionPanel class @@ -135,7 +135,7 @@ public double getVoltage() { } catch (InvalidSensorException e) { LogKitten.ex(e); - return DriverStation.getInstance().getBatteryVoltage(); + return RobotController.getBatteryVoltage(); } } diff --git a/subsystems/motor/Motor.java b/subsystems/motor/Motor.java index 6befacc5..4f393243 100644 --- a/subsystems/motor/Motor.java +++ b/subsystems/motor/Motor.java @@ -3,7 +3,6 @@ import org.usfirst.frc4904.standard.LogKitten; import org.usfirst.frc4904.standard.commands.motor.MotorIdle; -import org.usfirst.frc4904.standard.subsystems.motor.speedmodifiers.EnableableModifier; import org.usfirst.frc4904.standard.subsystems.motor.speedmodifiers.IdentityModifier; import org.usfirst.frc4904.standard.subsystems.motor.speedmodifiers.SpeedModifier; import com.ctre.phoenix.motorcontrol.IMotorController; diff --git a/subsystems/motor/SensorMotor.java b/subsystems/motor/SensorMotor.java index f1117e40..43308f3b 100644 --- a/subsystems/motor/SensorMotor.java +++ b/subsystems/motor/SensorMotor.java @@ -10,7 +10,6 @@ public abstract class SensorMotor extends Motor { protected final MotionController motionController; - private boolean isMotionControlEnabled; public SensorMotor(String name, boolean inverted, SpeedModifier speedModifier, MotionController motionController, SpeedController... motors) {