Preliminary distance aligning

This commit is contained in:
Team578 Driver Station 2026-04-14 19:52:01 -04:00
parent e0ecdb42f7
commit 706ab9e4a8
3 changed files with 9 additions and 6 deletions

View File

@ -13,6 +13,7 @@ import frc.robot.Constants.OperatorConstants;
import frc.robot.commands.AutoShootCommandChassisTurret;
import frc.robot.commands.AutoShootCommandChassisTurretPathPlanner;
import frc.robot.commands.AutoTurretCommand;
import frc.robot.commands.RelayCommand;
import frc.robot.commands.Reverse;
import frc.robot.subsystems.DriveSubsystem;
import frc.robot.subsystems.HopperSubsystem;
@ -80,11 +81,11 @@ public class RobotContainer {
m_driverController.leftBumper().onTrue(Commands.runOnce(() -> turretSubsystem.homeTurret(), turretSubsystem));
m_driverController.rightBumper().onTrue(Commands.parallel(intakeSubsystem.intake()));
//m_driverController.y().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem));
m_driverController.a().whileTrue(new RelayCommand(hopperSubsystem, turretSubsystem, intakeSubsystem));
m_driverController.start().whileTrue(intakeSubsystem.resetDeploy());
m_driverController.x().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
m_driverController.b().onTrue(new Reverse(intakeSubsystem, hopperSubsystem));
m_driverController.y().onTrue(intakeSubsystem.deploy());
//m_driverController.y().onTrue(intakeSubsystem.deploy());
}
/**

View File

@ -2,6 +2,7 @@ package frc.robot.commands;
import edu.wpi.first.units.Units;
import edu.wpi.first.units.measure.Angle;
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.Commands;
@ -23,13 +24,13 @@ public class RelayCommand extends Command{
this.turretSubsystem = turretSubsystem;
this.intakeSubsystem = intakeSubsystem;
addRequirements(hopperSubsystem, turretSubsystem, intakeSubsystem);
addRequirements(hopperSubsystem, intakeSubsystem);
}
@Override
public void initialize() {
turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3);
turretSubsystem.setLauncher(6000);
// turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3);
turretSubsystem.setLauncher(3000);
hopperSubsystem.spindexerOn();
CommandScheduler.getInstance().schedule(waitCommand);
turretSubsystem.setTurretMotorRotation(1); // Return to 0 after MIAMI VALLEY

View File

@ -138,7 +138,8 @@ public class TurretSubsystem extends TestableSubsystem {
public boolean isLauncherUpToSpeed() {
// Valid if velcity is within 10% of setpoint.
// May need to lower this
return Math.abs(launcherControler.getSetpoint() - launcherMotor.getEncoder().getVelocity()) >= launcherControler.getSetpoint() * 0.03;
return true;
// return Math.abs(launcherControler.getSetpoint() - launcherMotor.getEncoder().getVelocity()) >= launcherControler.getSetpoint() * 0.03;
}
public void setTargetElevation(double elev)