Skip to content

Commit

Permalink
get ready for friday testing of LaunchPrepare
Browse files Browse the repository at this point in the history
  • Loading branch information
Keobkeig committed Jan 18, 2024
1 parent fa7b6d0 commit 6773b23
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/stuypulse/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private void configureDriverBindings() {
.onFalse(new LauncherStop());

driver.getBottomButton()
.whileTrue(new WaitCommand(0.5).andThen(new LauncherLaunch()))
.whileTrue(new LaunchPrepare().andThen(new LauncherLaunch()))
.onFalse(new LauncherStop());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import com.stuypulse.robot.constants.Settings;
import com.stuypulse.robot.subsystems.launcher.Launcher;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;

/**
* WARNING: DONT USE THIS COMMAND
* PrepareLaunch sets the launcher to the launch speed, spins just the outside wheel of the launcher to allow it to get up to speed before launching
*/
public class LaunchPrepare extends InstantCommand {
public class LaunchPrepare extends Command {
Launcher launcher;

public LaunchPrepare() {
Expand All @@ -19,6 +20,11 @@ public LaunchPrepare() {

@Override
public void initialize() {
launcher.setLaunchSpeed(Settings.Launcher.LAUNCH_LAUNCHER_SPEED);
launcher.setLaunchSpeed(Settings.Launcher.LAUNCH_FEEDER_VOLTAGE);
}

@Override
public boolean isFinished() {
return launcher.getFeederVoltage() == Settings.Launcher.LAUNCH_FEEDER_VOLTAGE;
}
}
8 changes: 4 additions & 4 deletions src/main/java/com/stuypulse/robot/constants/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public interface Feedforward {
public interface Launcher {
// Speeds for wheels when intaking and launching. Intake speeds are negative to run the wheels
// in reverse
double LAUNCH_LAUNCHER_SPEED = 1;
double LAUNCH_FEEDER_SPEED = 1;
double INTAKE_LAUNCHER_SPEED = -1;
double INTAKE_FEEDER_SPEED = -.2;
double LAUNCH_LAUNCHER_VOLTAGE= 1;
double LAUNCH_FEEDER_VOLTAGE = 1;
double INTAKE_LAUNCHER_VOLTAGE = -1;
double INTAKE_FEEDER_VOLTAGE = -.2;

double kLauncherDelay = 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ public void stop() {
public void periodicChild() {
SmartDashboard.putNumber("Drivetrain/Left Speed", getLeftSpeed());
SmartDashboard.putNumber("Drivetrain/Right Speed", getRightSpeed());

SmartDashboard.putNumber("Drivetrain/Left Distance", getLeftDistance());
SmartDashboard.putNumber("Drivetrain/Right Distance", getRightDistance());

SmartDashboard.putNumber("Drivetrain/Left Voltage", getLeftVoltage());
SmartDashboard.putNumber("Drivetrain/Right Voltage", getRightVoltage());

SmartDashboard.putNumber("Drivetrain/Velocity", getVelocity());
SmartDashboard.putNumber("Drivetrain/Distance", getDistance());

SmartDashboard.putNumber("Drivetrain/Angle", getAngle().toDegrees());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public void stop() {
}

public void intake() {
launcher.set(Settings.Launcher.INTAKE_LAUNCHER_SPEED);
feeder.set(Settings.Launcher.INTAKE_FEEDER_SPEED);
launcher.set(Settings.Launcher.INTAKE_LAUNCHER_VOLTAGE);
feeder.set(Settings.Launcher.INTAKE_FEEDER_VOLTAGE);
}

public void launch() {
launcher.set(Settings.Launcher.LAUNCH_LAUNCHER_SPEED);
feeder.set(Settings.Launcher.LAUNCH_FEEDER_SPEED);
launcher.set(Settings.Launcher.LAUNCH_LAUNCHER_VOLTAGE);
feeder.set(Settings.Launcher.LAUNCH_FEEDER_VOLTAGE);
}

//********** GETTERS **********
Expand All @@ -78,6 +78,7 @@ public double getFeederVoltage() {
public void periodic() {
SmartDashboard.putNumber("Launcher/Launcher Speed", getLauncherSpeed());
SmartDashboard.putNumber("Launcher/Feeder Speed", getFeederSpeed());

SmartDashboard.putNumber("Launcher/Launcher Voltage", getLauncherVoltage());
SmartDashboard.putNumber("Launcher/Feeder Voltage", getFeederVoltage());

Expand Down

0 comments on commit 6773b23

Please sign in to comment.