From d06174d65b1e95879ee31f5827f36b7b9750a2c5 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:10:15 -0400 Subject: [PATCH 01/11] Rename climber folder/package to stilts --- src/main/java/frc/team4909/robot/Robot.java | 5 ++--- .../subsystems/{climber => stilts}/ClimberSubsystem.java | 7 ++----- .../commands/Default_StiltsHoldPos.java | 2 +- .../{climber => stilts}/commands/MoveElevAndStitls.java | 2 +- .../{climber => stilts}/commands/MoveStiltsOnly.java | 2 +- 5 files changed, 7 insertions(+), 11 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/{climber => stilts}/ClimberSubsystem.java (95%) rename src/main/java/frc/team4909/robot/subsystems/{climber => stilts}/commands/Default_StiltsHoldPos.java (87%) rename src/main/java/frc/team4909/robot/subsystems/{climber => stilts}/commands/MoveElevAndStitls.java (97%) rename src/main/java/frc/team4909/robot/subsystems/{climber => stilts}/commands/MoveStiltsOnly.java (93%) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 078efdb..776743a 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -3,7 +3,6 @@ import edu.wpi.first.wpilibj.Compressor; import edu.wpi.first.wpilibj.PowerDistributionPanel; 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.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj.DriverStation; @@ -12,8 +11,8 @@ import frc.team4909.robot.sensors.Stream; import frc.team4909.robot.subsystems.StiltWheel.StiltWheelSubsystem; import frc.team4909.robot.subsystems.StiltWheel.commands.MoveStiltWheels; -import frc.team4909.robot.subsystems.climber.ClimberSubsystem; -import frc.team4909.robot.subsystems.climber.commands.*; +import frc.team4909.robot.subsystems.stilts.ClimberSubsystem; +import frc.team4909.robot.subsystems.stilts.commands.*; import frc.team4909.robot.subsystems.drivetrain.DriveTrainSubsystem; import frc.team4909.robot.subsystems.drivetrain.commands.InvertDriveDirection; import frc.team4909.robot.subsystems.drivetrain.commands.TogglePreciseMode; diff --git a/src/main/java/frc/team4909/robot/subsystems/climber/ClimberSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java similarity index 95% rename from src/main/java/frc/team4909/robot/subsystems/climber/ClimberSubsystem.java rename to src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java index 27d3682..c3c034d 100644 --- a/src/main/java/frc/team4909/robot/subsystems/climber/ClimberSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java @@ -1,14 +1,11 @@ -package frc.team4909.robot.subsystems.climber; +package frc.team4909.robot.subsystems.stilts; import com.ctre.phoenix.motorcontrol.can.WPI_TalonSRX; import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX; - -import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.subsystems.climber.commands.Default_StiltsHoldPos; -import frc.team4909.robot.Robot; +import frc.team4909.robot.subsystems.stilts.commands.Default_StiltsHoldPos; import frc.team4909.robot.RobotConstants; import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.FeedbackDevice; diff --git a/src/main/java/frc/team4909/robot/subsystems/climber/commands/Default_StiltsHoldPos.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java similarity index 87% rename from src/main/java/frc/team4909/robot/subsystems/climber/commands/Default_StiltsHoldPos.java rename to src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java index 236f326..6b5517d 100644 --- a/src/main/java/frc/team4909/robot/subsystems/climber/commands/Default_StiltsHoldPos.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.climber.commands; +package frc.team4909.robot.subsystems.stilts.commands; import edu.wpi.first.wpilibj.command.Command; import frc.team4909.robot.Robot; diff --git a/src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveElevAndStitls.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java similarity index 97% rename from src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveElevAndStitls.java rename to src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java index 0d22cff..5435714 100644 --- a/src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveElevAndStitls.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.climber.commands; +package frc.team4909.robot.subsystems.stilts.commands; import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; diff --git a/src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveStiltsOnly.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java similarity index 93% rename from src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveStiltsOnly.java rename to src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java index 235d393..d864120 100644 --- a/src/main/java/frc/team4909/robot/subsystems/climber/commands/MoveStiltsOnly.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.climber.commands; +package frc.team4909.robot.subsystems.stilts.commands; import edu.wpi.first.wpilibj.command.Command; import frc.team4909.robot.Robot; From 0f7907c293696ff91a3aa1ac87bb23fa6a4e7267 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:17:07 -0400 Subject: [PATCH 02/11] Rename ClimberSubsystem to StiltSubsystem --- src/main/java/frc/team4909/robot/Robot.java | 22 ++++--------------- ...mberSubsystem.java => StiltSubsystem.java} | 4 ++-- .../commands/Default_StiltsHoldPos.java | 4 ++-- .../stilts/commands/MoveElevAndStitls.java | 12 +++++----- .../stilts/commands/MoveStiltsOnly.java | 8 +++---- 5 files changed, 18 insertions(+), 32 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/stilts/{ClimberSubsystem.java => StiltSubsystem.java} (98%) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 776743a..68c12b8 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -11,7 +11,7 @@ import frc.team4909.robot.sensors.Stream; import frc.team4909.robot.subsystems.StiltWheel.StiltWheelSubsystem; import frc.team4909.robot.subsystems.StiltWheel.commands.MoveStiltWheels; -import frc.team4909.robot.subsystems.stilts.ClimberSubsystem; +import frc.team4909.robot.subsystems.stilts.StiltSubsystem; import frc.team4909.robot.subsystems.stilts.commands.*; import frc.team4909.robot.subsystems.drivetrain.DriveTrainSubsystem; import frc.team4909.robot.subsystems.drivetrain.commands.InvertDriveDirection; @@ -68,27 +68,13 @@ public class Robot extends TimedRobot { public static IntakeSubsystem intakeSubsystem; public static ElevatorSubsystem elevatorSubsystem; public static ElevatorArmSubsystem elevatorArmSubsystem; - public static ClimberSubsystem climberSubsystem; + public static StiltSubsystem stiltSubsystem; public static StiltWheelSubsystem stiltWheelSubsystem; public static Compressor c; // Sensors public static LidarLitePWM lidar; - /** - * map a number from one range to another - * - * @param {num} value the value to be mapped - * @param {num} old_min the minimum of value - * @param {num} old_max the maximum of value - * @param {num} new_min the new minimum value - * @param {num} new_max the new maximum value - * @return {num} the value remaped on the range [new_min new_max] - */ - public static double map(double value, double old_min, double old_max, double new_min, double new_max) { - return (value - old_min) / (old_max - old_min) * (new_max - new_min) + new_min; - } - /** * This function is run when the robot is first started up and should be used * for any initialization code. @@ -113,7 +99,7 @@ public void robotInit() { intakeSubsystem = new IntakeSubsystem(); elevatorSubsystem = new ElevatorSubsystem(); elevatorArmSubsystem = new ElevatorArmSubsystem(); - climberSubsystem = new ClimberSubsystem(); + stiltSubsystem = new StiltSubsystem(); stiltWheelSubsystem = new StiltWheelSubsystem(); // Sensors @@ -240,7 +226,7 @@ public void disabledPeriodic() { Robot.elevatorSubsystem.updateHoldingPos(); Robot.elevatorArmSubsystem.holdingPosition = Robot.elevatorArmSubsystem.getPosition(); - Robot.climberSubsystem.updateHoldingPos(); + Robot.stiltSubsystem.updateHoldingPos(); } public void teleopPeriodic() { diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java similarity index 98% rename from src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java rename to src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java index c3c034d..c9c02e2 100644 --- a/src/main/java/frc/team4909/robot/subsystems/stilts/ClimberSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java @@ -11,7 +11,7 @@ import com.ctre.phoenix.motorcontrol.FeedbackDevice; import com.ctre.phoenix.motorcontrol.NeutralMode; -public class ClimberSubsystem extends Subsystem { +public class StiltSubsystem extends Subsystem { // All motor controllers should be private. // Methods that allow safe motion should be provided by the subsystem @@ -19,7 +19,7 @@ public class ClimberSubsystem extends Subsystem { private WPI_VictorSPX climberLiftSlave; private int holdingStiltsPosition = 0; - public ClimberSubsystem() { + public StiltSubsystem() { //super should always be called to ensure proper subystem initialization super(); climberLiftMaster = new WPI_TalonSRX(RobotMap.climberMasterSRXID); diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java index 6b5517d..33e2043 100644 --- a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/Default_StiltsHoldPos.java @@ -7,11 +7,11 @@ public class Default_StiltsHoldPos extends Command { public Default_StiltsHoldPos() { - requires(Robot.climberSubsystem); + requires(Robot.stiltSubsystem); } @Override protected void initialize() { - Robot.climberSubsystem.holdPosition(); + Robot.stiltSubsystem.holdPosition(); } @Override diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java index 5435714..8931020 100644 --- a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveElevAndStitls.java @@ -14,7 +14,7 @@ public class MoveElevAndStitls extends Command { private BionicAxis axis; public MoveElevAndStitls(boolean isGoingUp) { - requires(Robot.climberSubsystem); + requires(Robot.stiltSubsystem); requires(Robot.elevatorSubsystem); this.isGoingUp = isGoingUp; if (isGoingUp) { @@ -24,7 +24,7 @@ public MoveElevAndStitls(boolean isGoingUp) { } } protected void initialize() { - startStiltPos = Robot.climberSubsystem.getPosition(); + startStiltPos = Robot.stiltSubsystem.getPosition(); startElevatorPos = Robot.elevatorSubsystem.getPosition(); } @@ -36,9 +36,9 @@ protected void execute() { double speed = Robot.climberGamepad.getThresholdAxis(axis); speed *= RobotConstants.climbBothSpeedMultiplier; - Robot.climberSubsystem.setStiltsClimbSpeed((isGoingUp ? 1 : -1) * speed * 2); // *2 because trigger only goes to .3 + Robot.stiltSubsystem.setStiltsClimbSpeed((isGoingUp ? 1 : -1) * speed * 2); // *2 because trigger only goes to .3 - int stiltDelta = Math.abs(startStiltPos - Robot.climberSubsystem.getPosition()); + int stiltDelta = Math.abs(startStiltPos - Robot.stiltSubsystem.getPosition()); // Elevator Drum is 1.3" Diameter, C = PI * D = Math.PI * 1.3 // Stilts pinion gear Pitch Diameter is 1.1" which is the circumference @@ -60,7 +60,7 @@ protected boolean isFinished() { protected void end() { Robot.elevatorSubsystem.setSpeed(0); Robot.elevatorSubsystem.updateHoldingPos(); - Robot.climberSubsystem.setSpeed(0); - Robot.climberSubsystem.updateHoldingPos(); + Robot.stiltSubsystem.setSpeed(0); + Robot.stiltSubsystem.updateHoldingPos(); } } \ No newline at end of file diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java index d864120..3f3bddc 100644 --- a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveStiltsOnly.java @@ -7,20 +7,20 @@ public class MoveStiltsOnly extends Command { public MoveStiltsOnly() { - requires(Robot.climberSubsystem); + requires(Robot.stiltSubsystem); } protected void initialize() { } protected void execute() { double speed = Robot.climberGamepad.getThresholdAxis(BionicF310.RY); - Robot.climberSubsystem.setStiltsClimbSpeed(-1 * speed * RobotConstants.climbSpeedMultiplier); + Robot.stiltSubsystem.setStiltsClimbSpeed(-1 * speed * RobotConstants.climbSpeedMultiplier); // climberSubsystem.updateHoldingPos(); } protected boolean isFinished() { return false; } protected void end() { - Robot.climberSubsystem.updateHoldingPos(); - Robot.climberSubsystem.setStiltsClimbSpeed(0); + Robot.stiltSubsystem.updateHoldingPos(); + Robot.stiltSubsystem.setStiltsClimbSpeed(0); } } \ No newline at end of file From 9dad0791398b58332e5c3c228975050d65e057d7 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:21:06 -0400 Subject: [PATCH 03/11] Rename StiltWheel folder/package to stiltwheel per java conventions --- src/main/java/frc/team4909/robot/Robot.java | 4 ++-- .../robot/subsystems/StiltWheel/StiltWheelSubsystem.java | 7 ++----- .../StiltWheel/commands/Default_StiltWheelStop.java | 2 +- .../subsystems/StiltWheel/commands/MoveStiltWheels.java | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 68c12b8..f2bb673 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -9,8 +9,8 @@ import frc.team4909.robot.operator.controllers.BionicF310; import frc.team4909.robot.sensors.LidarLitePWM; import frc.team4909.robot.sensors.Stream; -import frc.team4909.robot.subsystems.StiltWheel.StiltWheelSubsystem; -import frc.team4909.robot.subsystems.StiltWheel.commands.MoveStiltWheels; +import frc.team4909.robot.subsystems.stiltwheel.StiltWheelSubsystem; +import frc.team4909.robot.subsystems.stiltwheel.commands.MoveStiltWheels; import frc.team4909.robot.subsystems.stilts.StiltSubsystem; import frc.team4909.robot.subsystems.stilts.commands.*; import frc.team4909.robot.subsystems.drivetrain.DriveTrainSubsystem; diff --git a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/StiltWheelSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/StiltWheelSubsystem.java index ab5584b..29513d1 100644 --- a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/StiltWheelSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/StiltWheelSubsystem.java @@ -1,12 +1,9 @@ -package frc.team4909.robot.subsystems.StiltWheel; +package frc.team4909.robot.subsystems.stiltwheel; import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX; - -import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.Subsystem; -import frc.team4909.robot.Robot; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.subsystems.StiltWheel.commands.Default_StiltWheelStop; +import frc.team4909.robot.subsystems.stiltwheel.commands.Default_StiltWheelStop; import com.ctre.phoenix.motorcontrol.NeutralMode; diff --git a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/Default_StiltWheelStop.java b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/Default_StiltWheelStop.java index e273ca9..667ce76 100644 --- a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/Default_StiltWheelStop.java +++ b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/Default_StiltWheelStop.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.StiltWheel.commands; +package frc.team4909.robot.subsystems.stiltwheel.commands; import edu.wpi.first.wpilibj.command.Command; import frc.team4909.robot.Robot; diff --git a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/MoveStiltWheels.java b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/MoveStiltWheels.java index de496b8..c78675a 100644 --- a/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/MoveStiltWheels.java +++ b/src/main/java/frc/team4909/robot/subsystems/StiltWheel/commands/MoveStiltWheels.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.StiltWheel.commands; +package frc.team4909.robot.subsystems.stiltwheel.commands; import edu.wpi.first.wpilibj.command.Command; import frc.team4909.robot.Robot; From c0238d966c7ab9e0efb342142477331570f0f496 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:25:07 -0400 Subject: [PATCH 04/11] Rename elevatorarm folder/package to wrist --- src/main/java/frc/team4909/robot/Robot.java | 4 ++-- .../elevatorarm/commands/SetAngle.java | 20 ------------------- .../ElevatorArmSubsystem.java | 13 ++---------- .../commands/ElevatorArmOperatorControl.java | 2 +- .../commands/SetWristAngle.java | 2 +- .../commands/SetWristSpeed.java | 4 +--- 6 files changed, 7 insertions(+), 38 deletions(-) delete mode 100644 src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetAngle.java rename src/main/java/frc/team4909/robot/subsystems/{elevatorarm => wrist}/ElevatorArmSubsystem.java (88%) rename src/main/java/frc/team4909/robot/subsystems/{elevatorarm => wrist}/commands/ElevatorArmOperatorControl.java (96%) rename src/main/java/frc/team4909/robot/subsystems/{elevatorarm => wrist}/commands/SetWristAngle.java (86%) rename src/main/java/frc/team4909/robot/subsystems/{elevatorarm => wrist}/commands/SetWristSpeed.java (78%) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index f2bb673..1e9079c 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -18,8 +18,8 @@ import frc.team4909.robot.subsystems.drivetrain.commands.TogglePreciseMode; import frc.team4909.robot.subsystems.elevator.ElevatorSubsystem; import frc.team4909.robot.subsystems.elevator.commands.*; -import frc.team4909.robot.subsystems.elevatorarm.ElevatorArmSubsystem; -import frc.team4909.robot.subsystems.elevatorarm.commands.*; +import frc.team4909.robot.subsystems.wrist.ElevatorArmSubsystem; +import frc.team4909.robot.subsystems.wrist.commands.*; import frc.team4909.robot.subsystems.intake.IntakeSubsystem; import frc.team4909.robot.subsystems.intake.commands.*; diff --git a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetAngle.java b/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetAngle.java deleted file mode 100644 index e3bcd20..0000000 --- a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetAngle.java +++ /dev/null @@ -1,20 +0,0 @@ -package frc.team4909.robot.subsystems.elevatorarm.commands; - -import edu.wpi.first.wpilibj.command.InstantCommand; -import frc.team4909.robot.subsystems.elevatorarm.ElevatorArmSubsystem; - -public class SetAngle extends InstantCommand { - private final int setpoint; - private final ElevatorArmSubsystem elevatorArm; - - public SetAngle(int setpoint, ElevatorArmSubsystem elevatorArm) { - this.setpoint = setpoint; - this.elevatorArm = elevatorArm; - } - - @Override - public void initialize() { - elevatorArm.holdingPosition = setpoint; - } - -} \ No newline at end of file diff --git a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/ElevatorArmSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java similarity index 88% rename from src/main/java/frc/team4909/robot/subsystems/elevatorarm/ElevatorArmSubsystem.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java index ef7f145..10f613f 100644 --- a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/ElevatorArmSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java @@ -1,15 +1,10 @@ -package frc.team4909.robot.subsystems.elevatorarm; +package frc.team4909.robot.subsystems.wrist; -import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.operator.controllers.BionicF310; -import frc.team4909.robot.subsystems.elevatorarm.commands.ElevatorArmOperatorControl; -import frc.team4909.robot.subsystems.elevatorarm.commands.SetAngle; -import edu.wpi.first.wpilibj.command.InstantCommand; +import frc.team4909.robot.subsystems.wrist.commands.ElevatorArmOperatorControl; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; - import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.FeedbackDevice; import com.ctre.phoenix.motorcontrol.NeutralMode; @@ -64,10 +59,6 @@ public ElevatorArmSubsystem(){ holdCurrentPosition(); } - public InstantCommand setAngle(int height){ - return new SetAngle(height, this); - } - public void holdCurrentPosition(){ holdingPosition = wristMaster.getSelectedSensorPosition(); } diff --git a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/ElevatorArmOperatorControl.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java similarity index 96% rename from src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/ElevatorArmOperatorControl.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java index 04210e1..519ad29 100644 --- a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/ElevatorArmOperatorControl.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.elevatorarm.commands; +package frc.team4909.robot.subsystems.wrist.commands; import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; diff --git a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristAngle.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java similarity index 86% rename from src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristAngle.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java index a27972a..f6a2b10 100644 --- a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristAngle.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java @@ -1,4 +1,4 @@ -package frc.team4909.robot.subsystems.elevatorarm.commands; +package frc.team4909.robot.subsystems.wrist.commands; import edu.wpi.first.wpilibj.command.InstantCommand; import frc.team4909.robot.Robot; diff --git a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristSpeed.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java similarity index 78% rename from src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristSpeed.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java index 5bd0d33..40cf649 100644 --- a/src/main/java/frc/team4909/robot/subsystems/elevatorarm/commands/SetWristSpeed.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java @@ -1,9 +1,7 @@ -package frc.team4909.robot.subsystems.elevatorarm.commands; +package frc.team4909.robot.subsystems.wrist.commands; import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.command.InstantCommand; import frc.team4909.robot.Robot; -import frc.team4909.robot.subsystems.elevatorarm.ElevatorArmSubsystem; public class SetWristSpeed extends Command { From f1854f63bd29cd4b18e3cc4a19cdb1e04e18d9f2 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:26:45 -0400 Subject: [PATCH 05/11] Rename ElevatorArmSubsystem to WristSubsystem --- src/main/java/frc/team4909/robot/Robot.java | 8 ++++---- .../{ElevatorArmSubsystem.java => WristSubsystem.java} | 4 ++-- .../wrist/commands/ElevatorArmOperatorControl.java | 8 ++++---- .../robot/subsystems/wrist/commands/SetWristAngle.java | 2 +- .../robot/subsystems/wrist/commands/SetWristSpeed.java | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/wrist/{ElevatorArmSubsystem.java => WristSubsystem.java} (97%) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 1e9079c..08369fa 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -18,7 +18,7 @@ import frc.team4909.robot.subsystems.drivetrain.commands.TogglePreciseMode; import frc.team4909.robot.subsystems.elevator.ElevatorSubsystem; import frc.team4909.robot.subsystems.elevator.commands.*; -import frc.team4909.robot.subsystems.wrist.ElevatorArmSubsystem; +import frc.team4909.robot.subsystems.wrist.WristSubsystem; import frc.team4909.robot.subsystems.wrist.commands.*; import frc.team4909.robot.subsystems.intake.IntakeSubsystem; import frc.team4909.robot.subsystems.intake.commands.*; @@ -67,7 +67,7 @@ public class Robot extends TimedRobot { public static DriveTrainSubsystem drivetrainSubsystem; public static IntakeSubsystem intakeSubsystem; public static ElevatorSubsystem elevatorSubsystem; - public static ElevatorArmSubsystem elevatorArmSubsystem; + public static WristSubsystem wristSubsystem; public static StiltSubsystem stiltSubsystem; public static StiltWheelSubsystem stiltWheelSubsystem; public static Compressor c; @@ -98,7 +98,7 @@ public void robotInit() { drivetrainSubsystem = new DriveTrainSubsystem(); intakeSubsystem = new IntakeSubsystem(); elevatorSubsystem = new ElevatorSubsystem(); - elevatorArmSubsystem = new ElevatorArmSubsystem(); + wristSubsystem = new WristSubsystem(); stiltSubsystem = new StiltSubsystem(); stiltWheelSubsystem = new StiltWheelSubsystem(); @@ -225,7 +225,7 @@ public void disabledPeriodic() { Scheduler.getInstance().run(); Robot.elevatorSubsystem.updateHoldingPos(); - Robot.elevatorArmSubsystem.holdingPosition = Robot.elevatorArmSubsystem.getPosition(); + Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); Robot.stiltSubsystem.updateHoldingPos(); } diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java similarity index 97% rename from src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java index 10f613f..3e2291d 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/ElevatorArmSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java @@ -10,12 +10,12 @@ import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.can.TalonSRX; -public class ElevatorArmSubsystem extends Subsystem{ +public class WristSubsystem extends Subsystem{ TalonSRX wristMaster; public int holdingPosition = 0; - public ElevatorArmSubsystem(){ + public WristSubsystem(){ // super should always be called to ensure proper subystem initialization super(); // Wrist diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java index 519ad29..f67e778 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java @@ -12,7 +12,7 @@ public class ElevatorArmOperatorControl extends Command { // private int holdingPosition = Robot.elevatorArmSubsystem.getPosition(); public ElevatorArmOperatorControl() { - requires(Robot.elevatorArmSubsystem); + requires(Robot.wristSubsystem); SmartDashboard.putString("Wrist - Status", "Constructor"); } @@ -24,11 +24,11 @@ public void execute() { if (moveSpeed == 0) { // If Y-stick value is not moving, HOLD position SmartDashboard.putString("Wrist - Status", "Hold"); - Robot.elevatorArmSubsystem.setPosition(Robot.elevatorArmSubsystem.holdingPosition); + Robot.wristSubsystem.setPosition(Robot.wristSubsystem.holdingPosition); } else { // Set speed to Y-stick value and HOLD position SmartDashboard.putString("Wrist - Status", "Move"); - Robot.elevatorArmSubsystem.elevatorArmSetSpeed(moveSpeed); - Robot.elevatorArmSubsystem.holdingPosition = Robot.elevatorArmSubsystem.getPosition(); + Robot.wristSubsystem.elevatorArmSetSpeed(moveSpeed); + Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); } } diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java index f6a2b10..07b22dd 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java @@ -12,7 +12,7 @@ public SetWristAngle(int setpoint) { @Override public void initialize() { - Robot.elevatorArmSubsystem.holdingPosition = setpoint; + Robot.wristSubsystem.holdingPosition = setpoint; } } \ No newline at end of file diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java index 40cf649..15826b8 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java @@ -8,18 +8,18 @@ public class SetWristSpeed extends Command { private double speed = 0; public SetWristSpeed(double speed1) { - requires(Robot.elevatorArmSubsystem); + requires(Robot.wristSubsystem); speed = speed1; } @Override public void initialize() { - Robot.elevatorArmSubsystem.elevatorArmSetSpeed(speed); + Robot.wristSubsystem.elevatorArmSetSpeed(speed); } @Override protected void end() { - Robot.elevatorArmSubsystem.elevatorArmSetSpeed(0); - Robot.elevatorArmSubsystem.holdingPosition = Robot.elevatorArmSubsystem.getPosition(); + Robot.wristSubsystem.elevatorArmSetSpeed(0); + Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); } @Override From 7aa0d9aeecffc318a5140447a43ff3752ced8b1e Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:32:34 -0400 Subject: [PATCH 06/11] Rename Drive command to Default_Drive Goal is to make it clear what the default command is --- .../robot/subsystems/drivetrain/DriveTrainSubsystem.java | 4 ++-- .../drivetrain/commands/{Drive.java => Default_Drive.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/{Drive.java => Default_Drive.java} (90%) diff --git a/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java index 4a9aa9a..15999f4 100644 --- a/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java @@ -12,7 +12,7 @@ import frc.team4909.robot.operator.controllers.BionicF310; import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; -import frc.team4909.robot.subsystems.drivetrain.commands.Drive; +import frc.team4909.robot.subsystems.drivetrain.commands.Default_Drive; public class DriveTrainSubsystem extends Subsystem { CANSparkMax frontLeftSparkMax, rearLeftSparkMax, frontRightSparkMax, rearRightSparkMax; @@ -88,7 +88,7 @@ public void togglePreciseMode() { } protected void initDefaultCommand() { - setDefaultCommand(new Drive()); + setDefaultCommand(new Default_Drive()); } @Override diff --git a/src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Drive.java b/src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Default_Drive.java similarity index 90% rename from src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Drive.java rename to src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Default_Drive.java index 0e5d37b..66e423b 100644 --- a/src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Drive.java +++ b/src/main/java/frc/team4909/robot/subsystems/drivetrain/commands/Default_Drive.java @@ -4,8 +4,8 @@ import frc.team4909.robot.Robot; import frc.team4909.robot.operator.controllers.BionicF310; -public class Drive extends Command { - public Drive() { +public class Default_Drive extends Command { + public Default_Drive() { requires(Robot.drivetrainSubsystem); } From 944eaa9db70d41afa40646fb4489b520756d30d2 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:38:13 -0400 Subject: [PATCH 07/11] Rename IntakeSubystem default commands --- .../robot/subsystems/intake/IntakeSubsystem.java | 14 ++++---------- ...ntakeHold.java => Default_CargoIntakeHold.java} | 4 ++-- ...ose.java => Default_HatchPanelIntakeClose.java} | 4 ++-- .../intake/commands/HatchPanelIntakeOpen.java | 1 - 4 files changed, 8 insertions(+), 15 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/intake/commands/{CargoIntakeHold.java => Default_CargoIntakeHold.java} (81%) rename src/main/java/frc/team4909/robot/subsystems/intake/commands/{HatchPanelIntakeClose.java => Default_HatchPanelIntakeClose.java} (71%) diff --git a/src/main/java/frc/team4909/robot/subsystems/intake/IntakeSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/intake/IntakeSubsystem.java index e0b3835..3c99282 100644 --- a/src/main/java/frc/team4909/robot/subsystems/intake/IntakeSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/intake/IntakeSubsystem.java @@ -10,8 +10,8 @@ import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.subsystems.intake.commands.CargoIntakeHold; -import frc.team4909.robot.subsystems.intake.commands.HatchPanelIntakeClose; +import frc.team4909.robot.subsystems.intake.commands.Default_CargoIntakeHold; +import frc.team4909.robot.subsystems.intake.commands.Default_HatchPanelIntakeClose; public class IntakeSubsystem extends Subsystem { DoubleSolenoid hatchPanelSolenoid; @@ -37,13 +37,7 @@ public void hatchPanelIntakeClose() { } public void holdCargoIntake(){ - // if(hasCargo()){ - // setCargoIntakeSpeed(RobotConstants.cargoIntakeHoldSpeed); - // } else { - // setCargoIntakeSpeed(0.0625); - setCargoIntakeSpeed(RobotConstants.cargoIntakeHoldSpeed); - // } } public void setCargoIntakeSpeed(double speed) { @@ -86,8 +80,8 @@ protected void initDefaultCommand() { // Revert to Closed by Default, Will Simplify While // Held/Toggle Open Commands in Future - addParallel(new HatchPanelIntakeClose()); - addParallel(new CargoIntakeHold()); + addParallel(new Default_HatchPanelIntakeClose()); + addParallel(new Default_CargoIntakeHold()); } }); } diff --git a/src/main/java/frc/team4909/robot/subsystems/intake/commands/CargoIntakeHold.java b/src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_CargoIntakeHold.java similarity index 81% rename from src/main/java/frc/team4909/robot/subsystems/intake/commands/CargoIntakeHold.java rename to src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_CargoIntakeHold.java index 6c4ff67..e350939 100644 --- a/src/main/java/frc/team4909/robot/subsystems/intake/commands/CargoIntakeHold.java +++ b/src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_CargoIntakeHold.java @@ -4,8 +4,8 @@ import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; -public class CargoIntakeHold extends Command{ - public CargoIntakeHold(){ +public class Default_CargoIntakeHold extends Command{ + public Default_CargoIntakeHold(){ requires(Robot.intakeSubsystem); } diff --git a/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeClose.java b/src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_HatchPanelIntakeClose.java similarity index 71% rename from src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeClose.java rename to src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_HatchPanelIntakeClose.java index 484eadf..0eb05d6 100644 --- a/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeClose.java +++ b/src/main/java/frc/team4909/robot/subsystems/intake/commands/Default_HatchPanelIntakeClose.java @@ -3,9 +3,9 @@ import edu.wpi.first.wpilibj.command.InstantCommand; import frc.team4909.robot.Robot; -public class HatchPanelIntakeClose extends InstantCommand { +public class Default_HatchPanelIntakeClose extends InstantCommand { - public HatchPanelIntakeClose() { + public Default_HatchPanelIntakeClose() { requires(Robot.intakeSubsystem); } diff --git a/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeOpen.java b/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeOpen.java index df37a57..357d3f6 100644 --- a/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeOpen.java +++ b/src/main/java/frc/team4909/robot/subsystems/intake/commands/HatchPanelIntakeOpen.java @@ -1,7 +1,6 @@ package frc.team4909.robot.subsystems.intake.commands; import edu.wpi.first.wpilibj.command.Command; -import frc.team4909.robot.subsystems.intake.commands.HatchPanelIntakeClose; import frc.team4909.robot.Robot; public class HatchPanelIntakeOpen extends Command { From 87384c63af881ccfea0519b51aa32b4de71fe76e Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:40:46 -0400 Subject: [PATCH 08/11] Rename Wrist default command --- .../frc/team4909/robot/subsystems/wrist/WristSubsystem.java | 4 ++-- ...eratorControl.java => Default_WristOperatorControl.java} | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) rename src/main/java/frc/team4909/robot/subsystems/wrist/commands/{ElevatorArmOperatorControl.java => Default_WristOperatorControl.java} (88%) diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java index 3e2291d..b4ccb95 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java @@ -2,7 +2,7 @@ import frc.team4909.robot.RobotConstants; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.subsystems.wrist.commands.ElevatorArmOperatorControl; +import frc.team4909.robot.subsystems.wrist.commands.Default_WristOperatorControl; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import com.ctre.phoenix.motorcontrol.ControlMode; @@ -90,7 +90,7 @@ public void periodic() { @Override protected void initDefaultCommand() { - setDefaultCommand(new ElevatorArmOperatorControl()); + setDefaultCommand(new Default_WristOperatorControl()); } diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java similarity index 88% rename from src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java rename to src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java index f67e778..0003fb5 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/ElevatorArmOperatorControl.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java @@ -7,11 +7,9 @@ import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; -public class ElevatorArmOperatorControl extends Command { +public class Default_WristOperatorControl extends Command { - // private int holdingPosition = Robot.elevatorArmSubsystem.getPosition(); - - public ElevatorArmOperatorControl() { + public Default_WristOperatorControl() { requires(Robot.wristSubsystem); SmartDashboard.putString("Wrist - Status", "Constructor"); } From d0595e94ca84576eda30965da51509206f267930 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 19:45:00 -0400 Subject: [PATCH 09/11] Cleanup debugging --- .../subsystems/drivetrain/DriveTrainSubsystem.java | 1 - .../robot/subsystems/elevator/ElevatorSubsystem.java | 4 ---- .../wrist/commands/Default_WristOperatorControl.java | 10 ---------- 3 files changed, 15 deletions(-) diff --git a/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java index 15999f4..4ca9047 100644 --- a/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/drivetrain/DriveTrainSubsystem.java @@ -9,7 +9,6 @@ import edu.wpi.first.wpilibj.drive.DifferentialDrive; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import frc.team4909.robot.RobotMap; -import frc.team4909.robot.operator.controllers.BionicF310; import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; import frc.team4909.robot.subsystems.drivetrain.commands.Default_Drive; diff --git a/src/main/java/frc/team4909/robot/subsystems/elevator/ElevatorSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/elevator/ElevatorSubsystem.java index ca27134..dacf6f3 100644 --- a/src/main/java/frc/team4909/robot/subsystems/elevator/ElevatorSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/elevator/ElevatorSubsystem.java @@ -6,13 +6,9 @@ import com.ctre.phoenix.motorcontrol.LimitSwitchNormal; import com.ctre.phoenix.motorcontrol.LimitSwitchSource; import com.ctre.phoenix.motorcontrol.NeutralMode; - -import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import com.ctre.phoenix.motorcontrol.ControlMode; - -import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; import frc.team4909.robot.RobotMap; import frc.team4909.robot.subsystems.elevator.commands.Default_ElevHoldPos; diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java index 0003fb5..c88d506 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java @@ -3,15 +3,12 @@ import frc.team4909.robot.Robot; import frc.team4909.robot.RobotConstants; import frc.team4909.robot.operator.controllers.BionicF310; - import edu.wpi.first.wpilibj.command.Command; -import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; public class Default_WristOperatorControl extends Command { public Default_WristOperatorControl() { requires(Robot.wristSubsystem); - SmartDashboard.putString("Wrist - Status", "Constructor"); } @Override @@ -21,10 +18,8 @@ public void execute() { * RobotConstants.elevatorArmSpeedMultiplier; if (moveSpeed == 0) { // If Y-stick value is not moving, HOLD position - SmartDashboard.putString("Wrist - Status", "Hold"); Robot.wristSubsystem.setPosition(Robot.wristSubsystem.holdingPosition); } else { // Set speed to Y-stick value and HOLD position - SmartDashboard.putString("Wrist - Status", "Move"); Robot.wristSubsystem.elevatorArmSetSpeed(moveSpeed); Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); } @@ -35,9 +30,4 @@ public void execute() { protected boolean isFinished() { return false; } - - protected void interrupted() { - SmartDashboard.putString("Wrist - Status", "Interrupted"); - } - } \ No newline at end of file From 9552088a49b4c828e41e9f484253c1b5c68c2bb3 Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 20:11:48 -0400 Subject: [PATCH 10/11] When the robot is enabled (autoinit) move stilts to limit switch --- src/main/java/frc/team4909/robot/Robot.java | 1 + .../subsystems/stilts/StiltSubsystem.java | 15 ++++++++++ .../stilts/commands/MoveUpToLimit.java | 30 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveUpToLimit.java diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 08369fa..2741e9f 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -201,6 +201,7 @@ public void robotPeriodic() { } public void autonomousInit() { + new MoveUpToLimit().start(); // elevatorSubsystem.setSensorZero(); // elevatorArmSubsystem.setSensorZero(); // climberSubsystem.setSensorZero(); diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java index c9c02e2..06021ea 100644 --- a/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/StiltSubsystem.java @@ -125,6 +125,21 @@ public void holdPosition() { setPosition(holdingStiltsPosition); } + public boolean isAtTop() { + //@todo not sure if fwd or reverse + return climberLiftMaster.getSensorCollection().isFwdLimitSwitchClosed(); + } + + public void setCurrentLimit(int maxAmps) { + if (maxAmps == 0) { + climberLiftMaster.enableCurrentLimit(false); + } else { + climberLiftMaster.enableCurrentLimit(true); + climberLiftMaster.configPeakCurrentLimit(0, RobotConstants.timeoutMs); + climberLiftMaster.configContinuousCurrentLimit(maxAmps, RobotConstants.timeoutMs); + } + } + diff --git a/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveUpToLimit.java b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveUpToLimit.java new file mode 100644 index 0000000..ed5fa46 --- /dev/null +++ b/src/main/java/frc/team4909/robot/subsystems/stilts/commands/MoveUpToLimit.java @@ -0,0 +1,30 @@ +package frc.team4909.robot.subsystems.stilts.commands; + +import edu.wpi.first.wpilibj.command.Command; +import frc.team4909.robot.Robot; + +public class MoveUpToLimit extends Command { + + public MoveUpToLimit() { + requires(Robot.stiltSubsystem); + } + + @Override + protected void initialize() { + int maxAmps = 1; // @todo determine this value + Robot.stiltSubsystem.setCurrentLimit(maxAmps); + Robot.stiltSubsystem.setSpeed(.25); + } + + @Override + protected boolean isFinished() { + return Robot.stiltSubsystem.isAtTop(); + } + @Override + protected void end() { + Robot.stiltSubsystem.setSpeed(0); + Robot.stiltSubsystem.setCurrentLimit(0); //disable limit + Robot.stiltSubsystem.updateHoldingPos(); + Robot.stiltSubsystem.holdPosition(); + } +} \ No newline at end of file From 148ee5898990bf7d224598f13f3617b5643d029d Mon Sep 17 00:00:00 2001 From: Blake Bourque Date: Mon, 18 Mar 2019 21:26:23 -0400 Subject: [PATCH 11/11] Make holdingPosition in the wristSubsystem be a private variable --- src/main/java/frc/team4909/robot/Robot.java | 2 +- .../robot/subsystems/wrist/WristSubsystem.java | 12 ++++++++++-- .../wrist/commands/Default_WristOperatorControl.java | 4 ++-- .../subsystems/wrist/commands/SetWristAngle.java | 2 +- .../subsystems/wrist/commands/SetWristSpeed.java | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/frc/team4909/robot/Robot.java b/src/main/java/frc/team4909/robot/Robot.java index 2741e9f..c68cb97 100644 --- a/src/main/java/frc/team4909/robot/Robot.java +++ b/src/main/java/frc/team4909/robot/Robot.java @@ -226,7 +226,7 @@ public void disabledPeriodic() { Scheduler.getInstance().run(); Robot.elevatorSubsystem.updateHoldingPos(); - Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); + Robot.wristSubsystem.updateHoldingPos(); Robot.stiltSubsystem.updateHoldingPos(); } diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java index b4ccb95..67ce1b5 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/WristSubsystem.java @@ -10,10 +10,10 @@ import com.ctre.phoenix.motorcontrol.NeutralMode; import com.ctre.phoenix.motorcontrol.can.TalonSRX; -public class WristSubsystem extends Subsystem{ +public class WristSubsystem extends Subsystem { TalonSRX wristMaster; - public int holdingPosition = 0; + private int holdingPosition = 0; public WristSubsystem(){ // super should always be called to ensure proper subystem initialization @@ -93,5 +93,13 @@ protected void initDefaultCommand() { setDefaultCommand(new Default_WristOperatorControl()); } + public void updateHoldingPos() { + holdingPosition = getPosition(); + } + + public void updateHoldingPos(int pos) { + holdingPosition = pos; + } + } \ No newline at end of file diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java index c88d506..33ab1f4 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/Default_WristOperatorControl.java @@ -18,10 +18,10 @@ public void execute() { * RobotConstants.elevatorArmSpeedMultiplier; if (moveSpeed == 0) { // If Y-stick value is not moving, HOLD position - Robot.wristSubsystem.setPosition(Robot.wristSubsystem.holdingPosition); + Robot.wristSubsystem.updateHoldingPos(); } else { // Set speed to Y-stick value and HOLD position Robot.wristSubsystem.elevatorArmSetSpeed(moveSpeed); - Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); + Robot.wristSubsystem.updateHoldingPos(); } } diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java index 07b22dd..93fc1d3 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristAngle.java @@ -12,7 +12,7 @@ public SetWristAngle(int setpoint) { @Override public void initialize() { - Robot.wristSubsystem.holdingPosition = setpoint; + Robot.wristSubsystem.updateHoldingPos(setpoint); } } \ No newline at end of file diff --git a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java index 15826b8..05f5e8c 100644 --- a/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java +++ b/src/main/java/frc/team4909/robot/subsystems/wrist/commands/SetWristSpeed.java @@ -19,7 +19,7 @@ public void initialize() { @Override protected void end() { Robot.wristSubsystem.elevatorArmSetSpeed(0); - Robot.wristSubsystem.holdingPosition = Robot.wristSubsystem.getPosition(); + Robot.wristSubsystem.updateHoldingPos(); } @Override