Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kid Shampoo Initial Subsystem work #6

Merged
merged 3 commits into from
Sep 21, 2024
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 @@ -2,10 +2,10 @@

import com.qualcomm.hardware.lynx.LynxModule;
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotorEx;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.hardware.ServoController;
import com.technototes.library.hardware.motor.CRServo;
import com.technototes.library.hardware.motor.EncodedMotor;
import com.technototes.library.hardware.motor.Motor;
import com.technototes.library.hardware.sensor.IMU;
Expand All @@ -23,6 +23,8 @@ public class Hardware implements Loggable {
public IMU imu;
public EncodedMotor<DcMotorEx> fl, fr, rl, rr;
public MotorEncoder odoF, odoR;
public Servo retainer, jaw;
public CRServo intake;

/* Put other hardware here! */

Expand All @@ -43,6 +45,11 @@ public Hardware(HardwareMap hwmap) {
odoR = new MotorEncoder(Setup.HardwareNames.ODOR);
odoF = new MotorEncoder(Setup.HardwareNames.ODOF);
}
if (Setup.Connected.KIDSSHAMPOOSUBSYSTEM) {
intake = new CRServo(Setup.HardwareNames.INTAKE);
retainer = new Servo(Setup.HardwareNames.RETAINER);
jaw = new Servo(Setup.HardwareNames.JAW);
}
}

// 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 @@ -10,6 +10,7 @@ public static class Connected {
public static boolean DRIVEBASE = true;
public static boolean ODOSUBSYSTEM = true;
public static boolean SAFETYSUBSYSTEM = true;
public static boolean KIDSSHAMPOOSUBSYSTEM = true;
}

@Config
Expand All @@ -22,6 +23,9 @@ public static class HardwareNames {
public static String IMU = "imu";
public static String ODOF = "odof";
public static String ODOR = "odor";
public static String INTAKE = "intake";
public static String RETAINER = "retainer";
public static String JAW = "jaw";
}

@Config
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.firstinspires.ftc.twenty403.subsystems;

import com.acmerobotics.dashboard.config.Config;
import com.technototes.library.hardware.motor.CRServo;
import com.technototes.library.hardware.servo.Servo;
import com.technototes.library.logger.Loggable;
import com.technototes.library.subsystem.Subsystem;
import org.firstinspires.ftc.twenty403.Hardware;

@Config
public class KidShampoo implements Subsystem, Loggable {

private Servo retainer, jaw;
private CRServo intake;

public static double RETAINER_OPEN_POSITION = -.2;
public static double RETAINER_EAT_POSITION = -.1;
public static double RETAINER_CLOSE_POSITION = .1;

public static double JAW_BITE_POSITION = .1;

public static double JAW_RELEASE_POSITION = -.1;
public static double INTAKE_SLURP = -.1;

public static double INTAKE_SPIT = .1;

public KidShampoo(Hardware hw) {
intake = hw.intake;
retainer = hw.retainer;
jaw = hw.jaw;
}

public void openRetainer() {
retainer.setPosition(RETAINER_OPEN_POSITION);
}

public void eatRetainer() {
retainer.setPosition(RETAINER_EAT_POSITION);
}

public void closeRetainer() {
retainer.setPosition(RETAINER_CLOSE_POSITION);
}

public void biteJaw() {
jaw.setPosition(JAW_BITE_POSITION);
}

public void releaseJaw() {
jaw.setPosition(JAW_RELEASE_POSITION);
}

public void slurpIntake() {
intake.setPower(INTAKE_SLURP);
}

public void spitIntake() {
intake.setPower(INTAKE_SPIT);
}
}
Loading