From 43980ce140ec7ed3392eb4d117092389f1ad57dd Mon Sep 17 00:00:00 2001 From: Shivani Ghanta Date: Tue, 17 Jan 2017 19:59:52 -0800 Subject: [PATCH] add Motor value in constants --- src/org/usfirst/frc/team3501/robot/Constants.java | 8 +++++++- .../team3501/robot/commands/climber/RunWinch.java | 3 +-- .../robot/commands/climber/RunWinchContinuous.java | 1 + .../team3501/robot/commands/climber/StopWinch.java | 2 ++ .../frc/team3501/robot/subsystems/Climber.java | 12 ++++++++++-- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index a3e3e42..911bfdc 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -10,7 +10,7 @@ public class Constants { public static class OI { public final static int LEFT_STICK_PORT = 0; public final static int RIGHT_STICK_PORT = 1; - public final static int TOGGLE_WINCH_PORT = 0; + public final static int TOGGLE_WINCH_PORT = 0; } public static class DriveTrain { @@ -27,6 +27,12 @@ public class Constants { public static final int ENCODER_RIGHT_B = 3; } + public static class Climber { + // MOTOR CONTROLLERS + public static final int MOTOR_VAL = 1; + + } + public static enum Direction { LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD; } diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java index 54df317..eda932a 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinch.java @@ -2,8 +2,7 @@ package org.usfirst.frc.team3501.robot.commands.climber; import org.usfirst.frc.team3501.robot.Robot; -import com.sun.glass.ui.Timer; - +import edu.wpi.first.wpilibj.Timer; import edu.wpi.first.wpilibj.command.Command; /** diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java index bb2a74e..eef3967 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java @@ -23,6 +23,7 @@ public class RunWinchContinuous extends Command { private double motorVal; public RunWinchContinuous(double motorVal) { + requires(Robot.getClimber()); this.motorVal = motorVal; } diff --git a/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java b/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java index 903f22b..892d2dd 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java @@ -15,6 +15,8 @@ import edu.wpi.first.wpilibj.command.Command; public class StopWinch extends Command { public StopWinch() { + requires(Robot.getClimber()); + } @Override diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java b/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java index 9dd7361..3d49f90 100644 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Climber.java @@ -1,10 +1,17 @@ package org.usfirst.frc.team3501.robot.subsystems; -public class Climber { +import org.usfirst.frc.team3501.robot.Constants; + +import com.ctre.CANTalon; + +import edu.wpi.first.wpilibj.command.Subsystem; + +public class Climber extends Subsystem { private static Climber climber; + private final CANTalon motor; private Climber() { - + motor = new CANTalon(Constants.Climber.MOTOR); } public static Climber getClimber() { @@ -19,6 +26,7 @@ public class Climber { } public void setMotorValue(final double val) { + motor.set(MOTOR); } } -- 2.30.2