forked from FIRST-Tech-Challenge/FtcRobotController
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
66644c1
commit 74ceb68
Showing
4 changed files
with
72 additions
and
2 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
5 changes: 5 additions & 0 deletions
5
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/enums/BucketPosition.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,5 @@ | ||
package org.firstinspires.ftc.teamcode.enums; | ||
|
||
public enum BucketPosition { | ||
Up, Down | ||
} |
53 changes: 53 additions & 0 deletions
53
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Bucket.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,53 @@ | ||
|
||
package org.firstinspires.ftc.teamcode.subsystems; | ||
|
||
import org.firstinspires.ftc.teamcode.RobotHardware; | ||
import org.firstinspires.ftc.teamcode.enums.ArmPosition; | ||
import org.firstinspires.ftc.teamcode.enums.BucketPosition; | ||
import org.firstinspires.ftc.teamcode.enums.ClawPosition; | ||
|
||
public class Bucket extends SubSystem { | ||
|
||
public BucketPosition bucketState; | ||
private RobotHardware robot; | ||
public boolean rightBumperPressed = false; | ||
public boolean leftBumperPressed = false; | ||
private final int BUCKET_DOWN = 0; | ||
private final int BUCKET_UP = 90; | ||
|
||
private final double BUCKET_MAX_POWER = .7; | ||
|
||
public Bucket(RobotHardware robot) { | ||
this.robot = robot; | ||
} | ||
|
||
|
||
@Override | ||
public void init() { | ||
bucketState = BucketPosition.Down; | ||
robot.bucketServo.setPosition(0); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void start() { | ||
|
||
} | ||
|
||
@Override | ||
public void update() { | ||
switch (bucketState) { | ||
case Up: | ||
if (leftBumperPressed) { | ||
robot.bucketServo.setPosition(BUCKET_DOWN); | ||
bucketState = BucketPosition.Down; | ||
} | ||
case Down: | ||
if (rightBumperPressed) { | ||
robot.bucketServo.setPosition(BUCKET_UP); | ||
bucketState = BucketPosition.Up; | ||
} | ||
} | ||
} | ||
} |
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