Skip to content

Commit

Permalink
Coment out drive (we took off all the motors)
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenTomato5 committed Oct 23, 2024
1 parent 925bb93 commit ffff640
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 103 deletions.
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static final class NoteSim {

public static final class Climber {

public static final int LEFT_ID = 33;
public static final int LEFT_ID = 10;
public static final int RIGHT_ID = 34;

public static final int CURRENT_FILTER_TAPS = 5;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler;
import edu.wpi.first.wpilibj2.command.PrintCommand;
import frc.robot.commands.AutoCommands;
import frc.robot.commands.ShootNearSpeakerCommand;
// import frc.robot.commands.ShootNearSpeakerCommand;
import frc.robot.commands.Shooting;
import frc.robot.subsystems.manager.*;
import frc.robot.util.NoteSimulator;
Expand Down Expand Up @@ -105,7 +106,7 @@ public void robotInit() {
NamedCommands.registerCommand("Return To Idle", autoCommands.returnToIdle());
NamedCommands.registerCommand("Speeding Up", autoCommands.startSpinningUp());
NamedCommands.registerCommand("Spin and Intake", autoCommands.spinAndIntake());
NamedCommands.registerCommand("Shoot Near Speaker", new ShootNearSpeakerCommand(this));
NamedCommands.registerCommand("Shoot Near Speaker", new PrintCommand("lalal"));

/* Not using this bc PP doesen't let you put "|, :, etc." in the Auto name so we wouldnt
* be able to use the same names as the ones established in our auto style guide thing.
Expand Down
94 changes: 47 additions & 47 deletions src/main/java/frc/robot/commands/ShootNearSpeakerCommand.java
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.Constants;
import frc.robot.Robot;
import frc.robot.subsystems.manager.ManagerStates;

public class ShootNearSpeakerCommand extends Command {

// Kinda an auto command, but it has a is finished condition soooo too bad so sad

Robot robot = null;
public boolean shot = false;

public ShootNearSpeakerCommand(Robot robot) {
this.robot = robot;
}

@Override
public void initialize() {
robot.managerSubsystem.setState(ManagerStates.SPINNING_UP);
shot = false;
}

@Override
public void execute() {
if (
robot.managerSubsystem.driveNearSetPose(
(DriverStation.getAlliance().get() == DriverStation.Alliance.Blue
? Constants.AutoAlign.blueSpeakerPose
: Constants.AutoAlign.redSpeakerPose)
) &&
!shot &&
robot.managerSubsystem.intakeNearSetpoints()
) {
// Good practice to do this? Prob not. Not too important so idc
robot.managerSubsystem.setState(ManagerStates.SHOOTING);
shot = true;
}
}

@Override
public boolean isFinished() {
return shot && robot.managerSubsystem.getState() == ManagerStates.IDLE;
}
}
// package frc.robot.commands;

// import edu.wpi.first.wpilibj.DriverStation;
// import edu.wpi.first.wpilibj2.command.Command;
// import frc.robot.Constants;
// import frc.robot.Robot;
// import frc.robot.subsystems.manager.ManagerStates;

// public class ShootNearSpeakerCommand extends Command {

// // Kinda an auto command, but it has a is finished condition soooo too bad so sad

// Robot robot = null;
// public boolean shot = false;

// public ShootNearSpeakerCommand(Robot robot) {
// this.robot = robot;
// }

// @Override
// public void initialize() {
// robot.managerSubsystem.setState(ManagerStates.SPINNING_UP);
// shot = false;
// }

// @Override
// public void execute() {
// if (
// robot.managerSubsystem.driveNearSetPose(
// (DriverStation.getAlliance().get() == DriverStation.Alliance.Blue
// ? Constants.AutoAlign.blueSpeakerPose
// : Constants.AutoAlign.redSpeakerPose)
// ) &&
// !shot &&
// robot.managerSubsystem.intakeNearSetpoints()
// ) {
// // Good practice to do this? Prob not. Not too important so idc
// robot.managerSubsystem.setState(ManagerStates.SHOOTING);
// shot = true;
// }
// }

// @Override
// public boolean isFinished() {
// return shot && robot.managerSubsystem.getState() == ManagerStates.IDLE;
// }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ public ClimberIOSparkMax() {
leftClimberEncoder = leftClimberMotor.getEncoder();
rightClimberEncoder = rightClimberMotor.getEncoder();

// TODO: Constants/whatever this, its bc angle CFs will mess up these ones bc we wired badly and spark keeps configs
leftClimberEncoder.setVelocityConversionFactor(1);
rightClimberEncoder.setVelocityConversionFactor(1);
leftClimberEncoder.setPositionConversionFactor(1);
rightClimberEncoder.setPositionConversionFactor(1);

leftClimberMotor.burnFlash();
rightClimberMotor.burnFlash();

climberController = new PIDController(0, 0, 0);

leftFilter = LinearFilter.movingAverage(Constants.Climber.CURRENT_FILTER_TAPS);
Expand Down
106 changes: 53 additions & 53 deletions src/main/java/frc/robot/subsystems/manager/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class Manager extends Subsystem<ManagerStates> {
private Intake intakeSubsystem;
private AmpBar ampBarSubsystem;
private Shooter shooterSubsystem;
private Drive driveSubsystem;
private AutoAlign autoAlignSubsystem;
private Vision vision;
// private Drive driveSubsystem;
// private AutoAlign autoAlignSubsystem;
// private Vision vision;

private SendableChooser<Boolean> useBeamBreaks;
private SendableChooser<Boolean> useAutoAlign;
Expand Down Expand Up @@ -104,47 +104,47 @@ public Manager() {
ampBarSubsystem = new AmpBar(new AmpBarIOReal());
shooterSubsystem = new Shooter(new ShooterIOTalonFX());
climberSubsystem = new Climber(new ClimberIOSparkMax());
driveSubsystem = new Drive(
new GyroIONavx2(),
new ModuleIOHybrid(0),
new ModuleIOHybrid(1),
new ModuleIOHybrid(2),
new ModuleIOHybrid(3)
);
// driveSubsystem = new Drive(
// new GyroIONavx2(),
// new ModuleIOHybrid(0),
// new ModuleIOHybrid(1),
// new ModuleIOHybrid(2),
// new ModuleIOHybrid(3)
// );
useVision.setDefaultOption("On", true);
break;
case REPLAY:
intakeSubsystem = new Intake(new IntakeIO() {});
ampBarSubsystem = new AmpBar(new AmpBarIO() {});
shooterSubsystem = new Shooter(new ShooterIO() {});
climberSubsystem = new Climber(new ClimberIO() {});
driveSubsystem = new Drive(
new GyroIO() {},
new ModuleIO() {},
new ModuleIO() {},
new ModuleIO() {},
new ModuleIO() {}
);
// driveSubsystem = new Drive(
// new GyroIO() {},
// new ModuleIO() {},
// new ModuleIO() {},
// new ModuleIO() {},
// new ModuleIO() {}
// );
break;
case SIM:
intakeSubsystem = new Intake(new IntakeIOSim());
ampBarSubsystem = new AmpBar(new AmpBarIOSim());
shooterSubsystem = new Shooter(new ShooterIOSim());
climberSubsystem = new Climber(new ClimberIOSim());
driveSubsystem = new Drive(
new GyroIO() {},
new ModuleIOSim(),
new ModuleIOSim(),
new ModuleIOSim(),
new ModuleIOSim()
);
// driveSubsystem = new Drive(
// new GyroIO() {},
// new ModuleIOSim(),
// new ModuleIOSim(),
// new ModuleIOSim(),
// new ModuleIOSim()
// );
useVision.setDefaultOption("Off", false);
break;
default:
break;
}
autoAlignSubsystem = new AutoAlign(new AutoAlignIO(driveSubsystem));
vision = new Vision(driveSubsystem);
// autoAlignSubsystem = new AutoAlign(new AutoAlignIO(driveSubsystem));
// vision = new Vision(driveSubsystem);

// NoteSimulator.setDrive(driveSubsystem);

Expand Down Expand Up @@ -262,7 +262,7 @@ public void periodic() {
intakeSubsystem.periodic();
ampBarSubsystem.periodic();
shooterSubsystem.periodic();
driveSubsystem.periodic();
// driveSubsystem.periodic();
climberSubsystem.periodic();

// Set Sendable Stuff:
Expand All @@ -284,36 +284,36 @@ public void periodic() {
}

// AA
if (useAutoAlignVal) {
autoAlignSubsystem.periodic();
if (autoAlignSubsystem.nearTargetPoint()) {
switch (autoAlignSubsystem.getCachedState()) {
case AMP:
setState(ManagerStates.STAGING_AMP);
break;
case AMP_SPEAKER:
setState(ManagerStates.SPINNING_UP);
break;
case SOURCE_SPEAKER:
setState(ManagerStates.SPINNING_UP);
break;
case OFF:
break;
default:
break;
}
}
}
// if (useAutoAlignVal) {
// autoAlignSubsystem.periodic();
// if (autoAlignSubsystem.nearTargetPoint()) {
// switch (autoAlignSubsystem.getCachedState()) {
// case AMP:
// setState(ManagerStates.STAGING_AMP);
// break;
// case AMP_SPEAKER:
// setState(ManagerStates.SPINNING_UP);
// break;
// case SOURCE_SPEAKER:
// setState(ManagerStates.SPINNING_UP);
// break;
// case OFF:
// break;
// default:
// break;
// }
// }
// }

if (useClimbersVal) {
climberSubsystem.periodic();
climberSubsystem.setState(getState().getClimberState());
}

// if (useVisionVal) //vision.periodic();
vision.periodic();
// vision.periodic();

driveSubsystem.toggleHeadingCorrection(useHeadingCorrectionVal);
// driveSubsystem.toggleHeadingCorrection(useHeadingCorrectionVal);

// Cancel all actions regardless of whats happening
if (Constants.operatorController.getXButtonPressed()) {
Expand All @@ -326,7 +326,7 @@ public void stop() {
ampBarSubsystem.stop();
shooterSubsystem.stop();
climberSubsystem.stop();
driveSubsystem.stop();
// driveSubsystem.stop();
}

@Override
Expand All @@ -348,7 +348,7 @@ public boolean shooterNearSpeedPoint() {
return shooterSubsystem.nearSpeedPoint();
}

public boolean driveNearSetPose(Pose2d targetPose) {
return driveSubsystem.nearSetPose(targetPose);
}
// public boolean driveNearSetPose(Pose2d targetPose) {
// return driveSubsystem.nearSetPose(targetPose);
// }
}

0 comments on commit ffff640

Please sign in to comment.