Skip to content

Commit

Permalink
hang subsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnototesLaptop committed Oct 19, 2024
1 parent ab196ae commit f0941a5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Hardware implements Loggable {
public ColorSensor colorSensor;
public Rev2MDistanceSensor rev2MDistanceSensor;
public EncodedMotor suspend;
public EncodedMotor suspendReverse;

/* Put other hardware here! */

Expand Down Expand Up @@ -58,6 +59,7 @@ public Hardware(HardwareMap hwmap) {
}
if (Setup.Connected.HANGSUBSYSTEM) {
suspend = new EncodedMotor(Setup.HardwareNames.SUSPEND);
suspendReverse = new EncodedMotor(Setup.HardwareNames.SUSPENDREVERSE);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public static class HardwareNames {
public static String COLOR1 = "color";
public static String DIST1 = "dist";
public static String SUSPEND = "suspend";
public static String SUSPENDREVERSE = "suspend reverse";

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public class OperatorController {
public CommandButton slurpIntake;
public CommandButton spitIntake;
public CommandButton stopIntake;

public CommandButton Suspend;
public CommandButton SuspendReverse;

public OperatorController(CommandGamepad g, Robot r) {
robot = r;
Expand All @@ -38,13 +39,17 @@ private void AssignNamedControllerButton() {
spitIntake = gamepad.rightBumper;
biteJaw = gamepad.ps_cross;
releaseJaw = gamepad.ps_triangle;

Suspend = gamepad.ps_circle;
SuspendReverse= gamepad.ps_circle;
}

public void BindControls() {
if (Setup.Connected.KIDSSHAMPOOSUBSYSTEM){
bindKidShampooControls();
}
if (Setup.Connected.HANGSUBSYSTEM){
bindHangControls();
}
}
public void bindKidShampooControls() {
openRetainer.whenPressed(Command.create(robot.kidShampooSubsystem::openRetainer, robot.kidShampooSubsystem));
Expand All @@ -57,4 +62,9 @@ public void bindKidShampooControls() {
slurpIntake.whenReleased(Command.create(robot.kidShampooSubsystem::stopIntake, robot.kidShampooSubsystem));
spitIntake.whenReleased(Command.create(robot.kidShampooSubsystem::stopIntake, robot.kidShampooSubsystem));
}

public void bindHangControls() {
Suspend.whenPressed(Command.create(robot.hangSubsystem::Suspend, robot.hangSubsystem));
SuspendReverse.whenReleased(Command.create(robot.hangSubsystem::Supendreverse, robot.hangSubsystem));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,25 @@
public class HangSubsystem implements Subsystem, Loggable {

private EncodedMotor suspend;
private EncodedMotor suspendReverse;

public static double SUSPEND_POSITION = .4;
public static double SUSPENDREVERSE_POSITION = .4;

public static double SUSPEND_1_POSITION = .1;
public static double SUSPEND_2_POSITION = .2;
public static double SUSPEND_3_POSITION = .4;

@Log(name = "distance value ")
public double distance_value;
@Log(name = "color value ")
public double color_value;
public HangSubsystem(Hardware hw) {
suspend = hw.suspend;
suspendReverse = hw.suspendReverse.setBackward();
}

public void Suspendpos1() {
suspend.setPosition(SUSPEND_1_POSITION);
}

public void Suspendpos2() {
suspend.setPosition(SUSPEND_2_POSITION);
public void Suspend() {
suspend.setPosition(SUSPEND_POSITION);
}
public void Suspendpos3() {
suspend.setPosition(SUSPEND_3_POSITION);
public void Supendreverse() {
suspendReverse.setPosition(SUSPENDREVERSE_POSITION);
}


@Override
public void periodic() {

Expand Down

0 comments on commit f0941a5

Please sign in to comment.