Preliminary distance aligning
This commit is contained in:
parent
e0ecdb42f7
commit
706ab9e4a8
|
|
@ -13,6 +13,7 @@ import frc.robot.Constants.OperatorConstants;
|
||||||
import frc.robot.commands.AutoShootCommandChassisTurret;
|
import frc.robot.commands.AutoShootCommandChassisTurret;
|
||||||
import frc.robot.commands.AutoShootCommandChassisTurretPathPlanner;
|
import frc.robot.commands.AutoShootCommandChassisTurretPathPlanner;
|
||||||
import frc.robot.commands.AutoTurretCommand;
|
import frc.robot.commands.AutoTurretCommand;
|
||||||
|
import frc.robot.commands.RelayCommand;
|
||||||
import frc.robot.commands.Reverse;
|
import frc.robot.commands.Reverse;
|
||||||
import frc.robot.subsystems.DriveSubsystem;
|
import frc.robot.subsystems.DriveSubsystem;
|
||||||
import frc.robot.subsystems.HopperSubsystem;
|
import frc.robot.subsystems.HopperSubsystem;
|
||||||
|
|
@ -80,11 +81,11 @@ public class RobotContainer {
|
||||||
|
|
||||||
m_driverController.leftBumper().onTrue(Commands.runOnce(() -> turretSubsystem.homeTurret(), turretSubsystem));
|
m_driverController.leftBumper().onTrue(Commands.runOnce(() -> turretSubsystem.homeTurret(), turretSubsystem));
|
||||||
m_driverController.rightBumper().onTrue(Commands.parallel(intakeSubsystem.intake()));
|
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.start().whileTrue(intakeSubsystem.resetDeploy());
|
||||||
m_driverController.x().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
m_driverController.x().whileTrue(new AutoShootCommandChassisTurret(driveSubsystem, hopperSubsystem, turretSubsystem));
|
||||||
m_driverController.b().onTrue(new Reverse(intakeSubsystem, hopperSubsystem));
|
m_driverController.b().onTrue(new Reverse(intakeSubsystem, hopperSubsystem));
|
||||||
m_driverController.y().onTrue(intakeSubsystem.deploy());
|
//m_driverController.y().onTrue(intakeSubsystem.deploy());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package frc.robot.commands;
|
||||||
|
|
||||||
import edu.wpi.first.units.Units;
|
import edu.wpi.first.units.Units;
|
||||||
import edu.wpi.first.units.measure.Angle;
|
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.Command;
|
||||||
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
import edu.wpi.first.wpilibj2.command.CommandScheduler;
|
||||||
import edu.wpi.first.wpilibj2.command.Commands;
|
import edu.wpi.first.wpilibj2.command.Commands;
|
||||||
|
|
@ -23,13 +24,13 @@ public class RelayCommand extends Command{
|
||||||
this.turretSubsystem = turretSubsystem;
|
this.turretSubsystem = turretSubsystem;
|
||||||
this.intakeSubsystem = intakeSubsystem;
|
this.intakeSubsystem = intakeSubsystem;
|
||||||
|
|
||||||
addRequirements(hopperSubsystem, turretSubsystem, intakeSubsystem);
|
addRequirements(hopperSubsystem, intakeSubsystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3);
|
// turretSubsystem.setTargetElevation(Constants.ShooterConstants.DEFLECTOR_SET_ANGLE3);
|
||||||
turretSubsystem.setLauncher(6000);
|
turretSubsystem.setLauncher(3000);
|
||||||
hopperSubsystem.spindexerOn();
|
hopperSubsystem.spindexerOn();
|
||||||
CommandScheduler.getInstance().schedule(waitCommand);
|
CommandScheduler.getInstance().schedule(waitCommand);
|
||||||
turretSubsystem.setTurretMotorRotation(1); // Return to 0 after MIAMI VALLEY
|
turretSubsystem.setTurretMotorRotation(1); // Return to 0 after MIAMI VALLEY
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,8 @@ public class TurretSubsystem extends TestableSubsystem {
|
||||||
public boolean isLauncherUpToSpeed() {
|
public boolean isLauncherUpToSpeed() {
|
||||||
// Valid if velcity is within 10% of setpoint.
|
// Valid if velcity is within 10% of setpoint.
|
||||||
// May need to lower this
|
// 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)
|
public void setTargetElevation(double elev)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue