Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,16 @@ public void runOpMode() {

// Allows for driver Control of the sorter
// Intake positions for the sorter
// gamepad2.x is intake sorter position 1
// gamepad2.y is intake sorter position 2
// gamepad2.b is intake sorter position 3
sorter.simpleSorterPosition(gamepad2.x, gamepad2.y, gamepad2.b,
SorterControls.sorterModes.INTAKE);

// Launch positons for the sorter
// gamepad2.x is launch sorter position 1
// gamepad2.y is launch sorter position 2
// gamepad2.b is launch sorter position 3
sorter.simpleSorterPosition(gamepad2.dpad_left, gamepad2.dpad_up, gamepad2.dpad_right,
SorterControls.sorterModes.LAUNCH);

Expand All @@ -114,10 +120,6 @@ public void runOpMode() {
motors.Flipper.setPosition(0.15);
}

// if (gamepad1.left_bumper) {
// sorter.moveGreenToLaunchPos();
// }

intake.setIntakeDirection(gamepad2.left_bumper, gamepad2.right_bumper);
//Add option to enable brakes when sharbell holds a
drive.setDriveMotorZeroPowerBehavior(gamepad1.b);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public LaunchControls(HardwareMap hardwareMap) {
*
* @param launchInput Button mapped to launch input
*/


public void setLaunchPower(boolean launchInput) {
double power = launchInput ? 1.0f : 0.0f;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ public class SorterControls {
public int LaunchPos2 = 180;
public int LaunchPos3 = 356;

// Create an instance of the sorterPositons enum to track the current position of the sorter
public sorterPositions currentSorterPosition;


// Array of the current sorter states 0 is sorter position one and so on
public ballColors[] currentSorterStates = {ballColors.NULL, ballColors.NULL, ballColors.GREEN};

// Motor Speed
Expand Down Expand Up @@ -130,6 +131,15 @@ public void moveSorterToPos(sorterModes mode, int pos) {
}
}

/**
* Allows for easier control of sorter positions in teleop allowing for the binding of
* controller buttons to the sorter positions
*
* @param position1Button Button to move to position 1
* @param position2Button Button to move to position 2
* @param position3Button Button to move to position 3
* @param mode the mode of the position either INTAKE or LAUNCH
*/
public void simpleSorterPosition(boolean position1Button, boolean position2Button,
boolean position3Button, sorterModes mode) {
if (position1Button) {
Expand All @@ -143,7 +153,10 @@ public void simpleSorterPosition(boolean position1Button, boolean position2Butto

/**
* Sorts through the balls in the sorter and moves a green ball to the launch position
* automatically
* automatically, it does this by iterating through all index positions in currentSorterStates
* <p>
* May cause some performance impact due to the use of a for loop however it is simple enough
* that it should be fine and thus far has not caused any issues
*/
public void moveGreenToLaunchPos() {
for (int i = 0; i < currentSorterStates.length; i++) {
Expand All @@ -156,7 +169,10 @@ public void moveGreenToLaunchPos() {

/**
* Sorts through the balls in the sorter and moves a purple ball to the launch position
* automatically
* automatically, it does this by iterating through all index positions in currentSorterStates
* <p>
* May cause some performance impact due to the use of a for loop however it is simple enough
* that it should be fine and thus far has not caused any issues
*/
public void moveToPurpleLaunchPos() {
for (int i = 0; i < currentSorterStates.length; i++) {
Expand Down Expand Up @@ -211,6 +227,4 @@ public enum sorterPositions {
LAUNCH_POS_2,
LAUNCH_POS_3
}


}
Loading