修复自动突然终止 电机速度参数仍存在的bug
This commit is contained in:
@@ -8,6 +8,7 @@ import edu.wpi.first.math.geometry.Rotation2d;
|
|||||||
import edu.wpi.first.wpilibj.TimedRobot;
|
import edu.wpi.first.wpilibj.TimedRobot;
|
||||||
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 frc.robot.subsystems.ShooterSubsystem;
|
||||||
|
|
||||||
public class Robot extends TimedRobot {
|
public class Robot extends TimedRobot {
|
||||||
private Command m_autonomousCommand;
|
private Command m_autonomousCommand;
|
||||||
@@ -26,7 +27,12 @@ public class Robot extends TimedRobot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disabledInit() {}
|
public void disabledInit() {
|
||||||
|
System.out.println("Robot disabledInit called");
|
||||||
|
m_robotContainer.shooterSubsystem.stopAll();
|
||||||
|
m_robotContainer.climberSubsystem.stopAll();
|
||||||
|
m_robotContainer.IntakerSubsystem.stopAll();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disabledPeriodic() {}
|
public void disabledPeriodic() {}
|
||||||
|
|||||||
@@ -126,6 +126,10 @@ public class ClimberSubsystem extends SubsystemBase {
|
|||||||
autoClimbUsedInAuto = false;
|
autoClimbUsedInAuto = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopAll() {
|
||||||
|
climberMotor.set(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void periodic() {
|
public void periodic() {
|
||||||
climberTable.getEntry("velocityRps").setDouble(getVelocityRps());
|
climberTable.getEntry("velocityRps").setDouble(getVelocityRps());
|
||||||
|
|||||||
@@ -106,4 +106,8 @@ public class IntakerSubsystem extends SubsystemBase{
|
|||||||
public void setIntakerRotater(double rotaterspeed){
|
public void setIntakerRotater(double rotaterspeed){
|
||||||
intakerotater.set(rotaterspeed);
|
intakerotater.set(rotaterspeed);
|
||||||
}
|
}
|
||||||
|
public void stopAll() {
|
||||||
|
stopIntakerotater();
|
||||||
|
setIntakerGetterSpeed(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,4 +185,9 @@ public class ShooterSubsystem extends SubsystemBase {
|
|||||||
public double getDistanceToPassball(){
|
public double getDistanceToPassball(){
|
||||||
return NetworkTableInstance.getDefault().getTable("AutoControl").getEntry("distanceToPassball").getDouble(0.0);
|
return NetworkTableInstance.getDefault().getTable("AutoControl").getEntry("distanceToPassball").getDouble(0.0);
|
||||||
}
|
}
|
||||||
|
public void stopAll() {
|
||||||
|
setFlywheelSpeedByRPS(0);
|
||||||
|
setConveyorSpeedByRPS(0);
|
||||||
|
backboardMotor.set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user