From f43a1c52c5936dbee257ab64f258d3b93f92ab14 Mon Sep 17 00:00:00 2001 From: Cindy Zhang Date: Tue, 24 Jan 2017 19:38:04 -0800 Subject: [PATCH] add skeleton code for missing commands --- .../robot/commandgroups/PrepareToShoot.java | 28 ++++++++++++ .../team3501/robot/commandgroups/Shoot.java | 28 ++++++++++++ .../robot/commands/driving/ToggleGear.java | 45 +++++++++++++++++++ .../robot/commands/driving/Turn90Left.java | 44 ++++++++++++++++++ .../robot/commands/driving/Turn90Right.java | 44 ++++++++++++++++++ .../robot/commands/intake/ReverseIntake.java | 43 ++++++++++++++++++ .../intake/ReverseIntakeContinuous.java | 43 ++++++++++++++++++ .../shooter/DecreaseShootingSpeed.java | 44 ++++++++++++++++++ .../shooter/IncreaseShootingSpeed.java | 44 ++++++++++++++++++ 9 files changed, 363 insertions(+) create mode 100644 src/org/usfirst/frc/team3501/robot/commandgroups/PrepareToShoot.java create mode 100644 src/org/usfirst/frc/team3501/robot/commandgroups/Shoot.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Left.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Right.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java create mode 100644 src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java diff --git a/src/org/usfirst/frc/team3501/robot/commandgroups/PrepareToShoot.java b/src/org/usfirst/frc/team3501/robot/commandgroups/PrepareToShoot.java new file mode 100644 index 0000000..3266836 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commandgroups/PrepareToShoot.java @@ -0,0 +1,28 @@ +package org.usfirst.frc.team3501.robot.commandgroups; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * + */ +public class PrepareToShoot extends CommandGroup { + + public PrepareToShoot() { + // Add Commands here: + // e.g. addSequential(new Command1()); + // addSequential(new Command2()); + // these will run in order. + + // To run multiple commands at the same time, + // use addParallel() + // e.g. addParallel(new Command1()); + // addSequential(new Command2()); + // Command1 and Command2 will run in parallel. + + // A command group will require all of the subsystems that each member + // would require. + // e.g. if Command1 requires chassis, and Command2 requires arm, + // a CommandGroup containing them would require both the chassis and the + // arm. + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commandgroups/Shoot.java b/src/org/usfirst/frc/team3501/robot/commandgroups/Shoot.java new file mode 100644 index 0000000..18e3568 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commandgroups/Shoot.java @@ -0,0 +1,28 @@ +package org.usfirst.frc.team3501.robot.commandgroups; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * + */ +public class Shoot extends CommandGroup { + + public Shoot() { + // Add Commands here: + // e.g. addSequential(new Command1()); + // addSequential(new Command2()); + // these will run in order. + + // To run multiple commands at the same time, + // use addParallel() + // e.g. addParallel(new Command1()); + // addSequential(new Command2()); + // Command1 and Command2 will run in parallel. + + // A command group will require all of the subsystems that each member + // would require. + // e.g. if Command1 requires chassis, and Command2 requires arm, + // a CommandGroup containing them would require both the chassis and the + // arm. + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java new file mode 100644 index 0000000..7a0c601 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/ToggleGear.java @@ -0,0 +1,45 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * This command toggles the speed at which the drive train runs at + * + * post-condition: if the drivetrain is running at high gear, it will be made to + * run at low gear, and vice versa + */ +public class ToggleGear extends Command { + + public ToggleGear() { + requires(Robot.getDriveTrain()); + } + + // 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/driving/Turn90Left.java b/src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Left.java new file mode 100644 index 0000000..fd63312 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Left.java @@ -0,0 +1,44 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * This command turns the robot exactly 90 degrees towards the left + * + * parameters: none + */ +public class Turn90Left extends Command { + + public Turn90Left() { + requires(Robot.getDriveTrain()); + } + + // 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/driving/Turn90Right.java b/src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Right.java new file mode 100644 index 0000000..374072e --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/Turn90Right.java @@ -0,0 +1,44 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * This command turns the robot exactly 90 degrees towards the right + * + * parameters: none + */ +public class Turn90Right extends Command { + + public Turn90Right() { + requires(Robot.getDriveTrain()); + } + + // 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/intake/ReverseIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java new file mode 100644 index 0000000..580b059 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntake.java @@ -0,0 +1,43 @@ +package org.usfirst.frc.team3501.robot.commands.intake; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * Reverses the intake roller for a specified amount of time in seconds + * + * parameters: time to run intake + */ +public class ReverseIntake extends Command { + + public ReverseIntake(double timeToMove) { + // Use requires() here to declare subsystem dependencies + // eg. requires(chassis); + } + + // 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/intake/ReverseIntakeContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java new file mode 100644 index 0000000..bab630d --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intake/ReverseIntakeContinuous.java @@ -0,0 +1,43 @@ +package org.usfirst.frc.team3501.robot.commands.intake; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * Reverses the intake until the button triggering this command is released + * + * pre-condition: button is pressed + */ +public class ReverseIntakeContinuous extends Command { + + public ReverseIntakeContinuous(double timeToMove) { + // Use requires() here to declare subsystem dependencies + // eg. requires(chassis); + } + + // 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/shooter/DecreaseShootingSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java new file mode 100644 index 0000000..23ac1a8 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/DecreaseShootingSpeed.java @@ -0,0 +1,44 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * This command decreases the speed at which the flywheel runs at by a fixed + * constant + * + * post-condition: the shooting speed is decremented, such that whenever the + * flywheel is run, it will run at the decreased shooting speed + */ +public class DecreaseShootingSpeed extends Command { + public DecreaseShootingSpeed() { + + } + + // 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() { + } + + // 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() { + } + + @Override + protected boolean isFinished() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java new file mode 100644 index 0000000..aeb74ec --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/IncreaseShootingSpeed.java @@ -0,0 +1,44 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * This command increases the speed at which the flywheel runs at by a fixed + * constant + * + * post-condition: the shooting speed is incremented, such that whenever the + * flywheel is run, it will run at the increased shooting speed + */ +public class IncreaseShootingSpeed extends Command { + public IncreaseShootingSpeed() { + + } + + // 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() { + } + + // 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() { + } + + @Override + protected boolean isFinished() { + // TODO Auto-generated method stub + return false; + } + +} -- 2.30.2