From 5be898b73b8d419396c09c02415658caf5b70cc6 Mon Sep 17 00:00:00 2001 From: Shivani Ghanta Date: Mon, 16 Jan 2017 20:19:18 -0800 Subject: [PATCH] Set Button Value --- .../usfirst/frc/team3501/robot/Constants.java | 1 + .../usfirst/frc/team3501/robot/RobotMap.java | 19 +++++++++ .../robot/commands/ExampleCommand.java | 42 +++++++++++++++++++ .../commands/climber/RunWinchContinuous.java | 3 +- .../robot/commands/climber/StopWinch.java | 1 - .../robot/subsystems/ExampleSubsystem.java | 16 +++++++ 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 src/org/usfirst/frc/team3501/robot/RobotMap.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/ExampleCommand.java create mode 100644 src/org/usfirst/frc/team3501/robot/subsystems/ExampleSubsystem.java diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 72b1067..a3e3e42 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -10,6 +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 static class DriveTrain { diff --git a/src/org/usfirst/frc/team3501/robot/RobotMap.java b/src/org/usfirst/frc/team3501/robot/RobotMap.java new file mode 100644 index 0000000..d62a2f7 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/RobotMap.java @@ -0,0 +1,19 @@ +package org.usfirst.frc.team3501.robot; + +/** + * The RobotMap is a mapping from the ports sensors and actuators are wired into + * to a variable name. This provides flexibility changing wiring, makes checking + * the wiring easier and significantly reduces the number of magic numbers + * floating around. + */ +public class RobotMap { + // For example to map the left and right motors, you could define the + // following variables to use with your drivetrain subsystem. + // public static int leftMotor = 1; + // public static int rightMotor = 2; + + // If you are using multiple modules, make sure to define both the port + // number and the module. For example you with a rangefinder: + // public static int rangefinderPort = 1; + // public static int rangefinderModule = 1; +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/ExampleCommand.java b/src/org/usfirst/frc/team3501/robot/commands/ExampleCommand.java new file mode 100644 index 0000000..6fdb978 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/ExampleCommand.java @@ -0,0 +1,42 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +import org.usfirst.frc.team3501.robot.Robot; + +/** + * + */ +public class ExampleCommand extends Command { + public ExampleCommand() { + // Use requires() here to declare subsystem dependencies + requires(Robot.exampleSubsystem); + } + + // Called just before this Command runs the first time + @Override + protected void initialize() { + } + + // Called repeatedly when this Command is scheduled to run + @Override + protected void execute() { + } + + // Make this return true when this Command no longer needs to run execute() + @Override + protected boolean isFinished() { + return false; + } + + // Called once after isFinished returns true + @Override + protected void end() { + } + + // Called when another command which requires one or more of the same + // subsystems is scheduled to run + @Override + protected void interrupted() { + } +} 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 381a80a..dc29866 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/RunWinchContinuous.java @@ -14,13 +14,12 @@ public class RunWinchContinuous extends Command { private double motorVal; public RunWinchContinuous(double motorVal) { - requires(Robot.getClimber()); this.motorVal = motorVal; } @Override protected void initialize() { - Robot.getClimber().setMotorValues(motorVal); + Robot.getClimber().setMotorValue(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 31a5b55..8fa01a3 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java +++ b/src/org/usfirst/frc/team3501/robot/commands/climber/StopWinch.java @@ -13,7 +13,6 @@ 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/ExampleSubsystem.java b/src/org/usfirst/frc/team3501/robot/subsystems/ExampleSubsystem.java new file mode 100644 index 0000000..80516bb --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/subsystems/ExampleSubsystem.java @@ -0,0 +1,16 @@ +package org.usfirst.frc.team3501.robot.subsystems; + +import edu.wpi.first.wpilibj.command.Subsystem; + +/** + * + */ +public class ExampleSubsystem extends Subsystem { + // Put methods for controlling this subsystem + // here. Call these from Commands. + + public void initDefaultCommand() { + // Set the default command for a subsystem here. + // setDefaultCommand(new MySpecialCommand()); + } +} -- 2.30.2