From d607dcbba174a89ab1d6413dba0a7ec433a720f7 Mon Sep 17 00:00:00 2001 From: Meryem Esa Date: Sat, 30 Jan 2016 15:50:08 -0800 Subject: [PATCH] make 'pass' commands for all the defenses that just have to be driven over --- .../robot/commands/DefaultAutonStrategy.java | 24 +++------ .../robot/commands/PassDrawBridge.java | 2 +- .../team3501/robot/commands/PassLowBar.java | 49 ++++++++++++++++++ .../frc/team3501/robot/commands/PassMoat.java | 49 ++++++++++++++++++ .../team3501/robot/commands/PassRampart.java | 49 ++++++++++++++++++ .../team3501/robot/commands/PassRockWall.java | 49 ++++++++++++++++++ .../robot/commands/PassRoughTerrain.java | 50 +++++++++++++++++++ 7 files changed, 253 insertions(+), 19 deletions(-) create mode 100755 src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java create mode 100755 src/org/usfirst/frc/team3501/robot/commands/PassMoat.java create mode 100755 src/org/usfirst/frc/team3501/robot/commands/PassRampart.java create mode 100755 src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java create mode 100755 src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java diff --git a/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java b/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java index ce2b7fb7..eccd9668 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java +++ b/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java @@ -8,13 +8,8 @@ import edu.wpi.first.wpilibj.command.CommandGroup; * The default autonomous strategy involves passing the defense that is in front * of it, aiming the robot/ shooter towards the goal, and shooting. */ -public class DefaultAutonStrategy extends CommandGroup { - // in feet - // distance along a platform - final double DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD = 4.0; - // number from -1 to 1 - final double SPEED_FOR_PASSING_DEFENSE = 0.5; +public class DefaultAutonStrategy extends CommandGroup { public DefaultAutonStrategy(int position, Defense defense) { @@ -30,15 +25,11 @@ public class DefaultAutonStrategy extends CommandGroup { case ROUGH_TERRAIN: - addSequential( - new DriveForDistance(DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2, - DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2)); + addSequential(new PassRoughTerrain()); case LOW_BAR: - addSequential( - new DriveForDistance(DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD + 2, - SPEED_FOR_PASSING_DEFENSE)); + addSequential(new PassLowBar()); case CHEVAL_DE_FRISE: @@ -50,18 +41,15 @@ public class DefaultAutonStrategy extends CommandGroup { case MOAT: - addSequential(new DriveForDistance( - DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE)); + addSequential(new PassMoat()); case ROCK_WALL: - addSequential(new DriveForDistance( - DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE)); + addSequential(new PassRockWall()); case RAMPART: - addSequential(new DriveForDistance( - DIST_BETWEEN_OUTER_WORKS__AND_COURTYARD, SPEED_FOR_PASSING_DEFENSE)); + addSequential(new PassRampart()); default: break; diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java b/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java index 4b18f4a3..ad3d7ee7 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java +++ b/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java @@ -6,7 +6,7 @@ import edu.wpi.first.wpilibj.command.Command; * This command will lower the draw bridge and go through it * * pre-condition: robot is flush against the ramp of the outerworks in front of - * the portcullis + * the draw bridge * * post-condition: the robot has passed the draw bridge and is in the next zone * diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java b/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java new file mode 100755 index 00000000..cdb9e9d8 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the low bar. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the low bar + * + * post-condition: the robot has passed the low bar and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassLowBar extends Command { + + public PassLowBar() { + // 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/PassMoat.java b/src/org/usfirst/frc/team3501/robot/commands/PassMoat.java new file mode 100755 index 00000000..331e17b2 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/PassMoat.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the moat. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the moat + * + * post-condition: the robot has passed the moat and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassMoat extends Command { + + public PassMoat() { + // 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/PassRampart.java b/src/org/usfirst/frc/team3501/robot/commands/PassRampart.java new file mode 100755 index 00000000..2d387efb --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/PassRampart.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rampart. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rampart + * + * post-condition: the robot has passed the rampart and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassRampart extends Command { + + public PassRampart() { + // 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/PassRockWall.java b/src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java new file mode 100755 index 00000000..d00ed8a6 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rock wall. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rock wall + * + * post-condition: the robot has passed the rock wall and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassRockWall extends Command { + + public PassRockWall() { + // 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/PassRoughTerrain.java b/src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java new file mode 100755 index 00000000..adc982a8 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java @@ -0,0 +1,50 @@ +package org.usfirst.frc.team3501.robot.commands; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rough terrain. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rough terrain + * + * post-condition: the robot has passed the rough terrain and is in the next + * zone + * + * @author Meryem and Avi + * + */ +public class PassRoughTerrain extends Command { + + public PassRoughTerrain() { + // 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() { + } +} -- 2.30.2