-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,409 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,3 +58,6 @@ $RECYCLE.BIN/ | |
# Windows shortcuts | ||
*.lnk | ||
/bin/ | ||
/bin/ | ||
/bin/ | ||
/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.team708.robot.commands; | ||
import org.team708.robot.Robot; | ||
import org.team708.robot.util.Math708; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class ToteElevatorDown extends Command { | ||
|
||
private final double threshold = 1; | ||
|
||
public ToteElevatorDown() { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
requires(Robot.toteElevator); | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
protected void execute() { | ||
if (!Robot.toteElevator.elevatorDown) { | ||
Robot.toteElevator.lowerTote(); | ||
} | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
protected boolean isFinished() { | ||
return Math708.isWithinThreshold(Robot.toteElevator.getEncoderDistance(), -Robot.toteElevator.TOP_ENCODER_DISTANCE, threshold) | ||
|| Robot.toteElevator.elevatorDown; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
Robot.toteElevator.stopTote(); | ||
Robot.toteElevator.elevatorDown = true; | ||
Robot.toteElevator.setToteCount(0); | ||
Robot.toteElevator.resetEncoder(); | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems are scheduled to run | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package org.team708.robot.commands; | ||
|
||
import org.team708.robot.Robot; | ||
import org.team708.robot.util.Math708; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class ToteElevatorUp extends Command { | ||
|
||
private final double threshold = 1; | ||
private boolean atToteLimitMax; | ||
|
||
public ToteElevatorUp() { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
requires(Robot.toteElevator); | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
atToteLimitMax = (Robot.toteElevator.toteCount == Robot.toteElevator.TOTE_UPPER_LIMIT); | ||
|
||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
protected void execute() { | ||
if (!atToteLimitMax) { | ||
Robot.toteElevator.raiseTote(); | ||
} | ||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
protected boolean isFinished() { | ||
return Math708.isWithinThreshold(Robot.toteElevator.getEncoderDistance(), Robot.toteElevator.TOP_ENCODER_DISTANCE, threshold) | ||
|| atToteLimitMax; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
Robot.toteElevator.stopTote(); | ||
Robot.toteElevator.setToteCount(Robot.toteElevator.getToteCount() + 1); | ||
Robot.toteElevator.resetEncoder(); | ||
Robot.toteElevator.elevatorDown = false; | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems are scheduled to run | ||
protected void interrupted() { | ||
end(); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/org/team708/robot/commands/claw/ClawHeightDecrement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.team708.robot.commands.claw; | ||
|
||
import org.team708.robot.Robot; | ||
import org.team708.robot.subsystems.ClawElevator; | ||
|
||
import edu.wpi.first.wpilibj.command.Command; | ||
|
||
/** | ||
* | ||
*/ | ||
public class ClawHeightDecrement extends Command { | ||
|
||
public ClawHeightDecrement() { | ||
// Use requires() here to declare subsystem dependencies | ||
// eg. requires(chassis); | ||
requires(Robot.clawElevator); | ||
} | ||
|
||
// Called just before this Command runs the first time | ||
protected void initialize() { | ||
} | ||
|
||
// Called repeatedly when this Command is scheduled to run | ||
protected void execute() { | ||
|
||
/* | ||
* Sets the PID setpoint to the lower limit if the robot is within a tote height of | ||
* of the lower limit, or decrements it by the height of a tote if it isn't | ||
*/ | ||
if(Robot.clawElevator.getPosition() <= | ||
(ClawElevator.LOWER_LIMIT + ClawElevator.TOTE_HEIGHT)) { | ||
Robot.clawElevator.setSetpoint(ClawElevator.LOWER_LIMIT); | ||
} else { | ||
Robot.clawElevator.setSetpoint(Robot.clawElevator.getPosition() - ClawElevator.TOTE_HEIGHT); | ||
} | ||
|
||
} | ||
|
||
// Make this return true when this Command no longer needs to run execute() | ||
protected boolean isFinished() { | ||
return true; | ||
} | ||
|
||
// Called once after isFinished returns true | ||
protected void end() { | ||
} | ||
|
||
// Called when another command which requires one or more of the same | ||
// subsystems is scheduled to run | ||
protected void interrupted() { | ||
} | ||
} |
Oops, something went wrong.