Skip to content

Commit

Permalink
made hangsubsystem and named arm and hang properly to match the drive…
Browse files Browse the repository at this point in the history
…rstation and made it setup correctly for when it turns on (#34)

* added hang subsystem
* forgot to change the command names
* hang subsystem
* made the strings for Hardware.java and setup.java. also i made setup on Robot.java and Hardware.java work also this builds
* fixed your complaints
  • Loading branch information
TechnototesLaptop authored Oct 19, 2024
1 parent c6209b5 commit 8d275ff
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@
import org.firstinspires.ftc.robotcore.external.navigation.VoltageUnit;
import com.technototes.library.hardware.sensor.ColorSensor;
import com.technototes.library.hardware.sensor.Rev2MDistanceSensor;
import com.technototes.library.hardware.motor.Motor;
public class Hardware implements Loggable {

public List<LynxModule> hubs;

public IMU imu;
public EncodedMotor<DcMotorEx> fl, fr, rl, rr;
public EncodedMotor<DcMotorEx> fl, fr, rl, rr, armL, armR;
public MotorEncoder odoF, odoR;
public Servo retainer, jaw;
public CRServo intake;
public ColorSensor colorSensor;
public Rev2MDistanceSensor rev2MDistanceSensor;

public Motor suspend;
/* Put other hardware here! */

public Hardware(HardwareMap hwmap) {
Expand All @@ -55,6 +56,13 @@ public Hardware(HardwareMap hwmap) {
colorSensor = new ColorSensor(Setup.HardwareNames.COLOR1);
rev2MDistanceSensor = new Rev2MDistanceSensor(Setup.HardwareNames.DIST1);
}
if (Setup.Connected.HANGSUBSYSTEM) {
suspend = new Motor(Setup.HardwareNames.SUSPEND);
}
if (Setup.Connected.ARMSUBSYSTEM) {
armL = new EncodedMotor<>(Setup.HardwareNames.ARML);
armR = new EncodedMotor<>(Setup.HardwareNames.ARMR);
}
}

// We can read the voltage from the different hubs for fun...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.technototes.library.util.Alliance;
import org.firstinspires.ftc.twenty403.helpers.StartingPosition;
import org.firstinspires.ftc.twenty403.subsystems.DrivebaseSubsystem;
import org.firstinspires.ftc.twenty403.subsystems.HangSubsystem;
import org.firstinspires.ftc.twenty403.subsystems.KidShampooSubsystem;
import org.firstinspires.ftc.twenty403.subsystems.SafetySubsystem;
import org.firstinspires.ftc.twenty403.subsystems.TwoDeadWheelLocalizer;
Expand All @@ -18,6 +19,8 @@ public class Robot implements Loggable {
public KidShampooSubsystem kidShampooSubsystem;
public TwoDeadWheelLocalizer localizer;
public SafetySubsystem safetySubsystem;
public HangSubsystem hangSubsystem;
// public ArmSubsystem armSubsytem;

public Robot(Hardware hw, Alliance team, StartingPosition pos) {
this.position = pos;
Expand Down Expand Up @@ -48,5 +51,11 @@ public Robot(Hardware hw, Alliance team, StartingPosition pos) {
if (Setup.Connected.KIDSSHAMPOOSUBSYSTEM) {
this.kidShampooSubsystem = new KidShampooSubsystem(hw);
}
if (Setup.Connected.HANGSUBSYSTEM) {
this.hangSubsystem = new HangSubsystem(hw);
}
if (Setup.Connected.ARMSUBSYSTEM) {
// this.armSubsytem = new ArmSubsystem(hw);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public static class Connected {
public static boolean ODOSUBSYSTEM = true;
public static boolean SAFETYSUBSYSTEM = false;
public static boolean KIDSSHAMPOOSUBSYSTEM = true;
public static boolean HANGSUBSYSTEM = true;
public static boolean ARMSUBSYSTEM = true;
}

@Config
Expand All @@ -28,6 +30,9 @@ public static class HardwareNames {
public static String JAW = "jaw";
public static String COLOR1 = "color";
public static String DIST1 = "dist";
public static String SUSPEND = "suspend";
public static String ARML = "armL";
public static String ARMR = "armR";

}

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,16 @@ private void AssignNamedControllerButton() {
spitIntake = gamepad.rightBumper;
biteJaw = gamepad.ps_cross;
releaseJaw = gamepad.ps_triangle;

suspend = 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 +61,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));

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.firstinspires.ftc.twenty403.subsystems;

import com.acmerobotics.dashboard.config.Config;
import com.technototes.library.hardware.servo.Servo;
import com.technototes.library.logger.Log;
import com.technototes.library.logger.Loggable;
import com.technototes.library.subsystem.Subsystem;
import com.technototes.library.hardware.motor.Motor;
import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit;
import org.firstinspires.ftc.twenty403.Hardware;

@Config
public class HangSubsystem implements Subsystem, Loggable {

private Motor suspend;


public static double SUSPEND_POSITION = .4;

public HangSubsystem(Hardware hw) {
suspend = hw.suspend;
}


public void suspend() {
suspend.setPower(SUSPEND_POSITION);
}


}

0 comments on commit 8d275ff

Please sign in to comment.