自动2.1

This commit is contained in:
OnDYCLaptop
2026-03-09 09:51:26 +08:00
parent 8b2df6ce7c
commit 9a426a8f8a
5 changed files with 12 additions and 7 deletions
+2 -1
View File
@@ -162,6 +162,7 @@ public class RobotContainer {
controllerupper.povDown().onTrue(Commands.runOnce(() -> shooterControls.adjustBackboardRateOffset(-100)));
controllerupper.back().onTrue(Commands.runOnce(() -> shooterControls.resetOffsets()));
controllerupper.start().onTrue(Commands.runOnce(() -> shooterControls.resetBackboardCommand()));
controllerupper.b().onTrue(Commands.runOnce(() -> shooterControls.resetBackboardCommand()));
}
/* ====================== */
/* LED 绑定 */
@@ -187,7 +188,7 @@ public class RobotContainer {
private void configueClimber() {
enableTrigger.onTrue(climberControls.enableInitCommand());
climberSubsystem.setDefaultCommand(climberControls.defaultClimberCommand());
controllerupper.b().onTrue(climberControls.resetClimberEncoderCommand(climberSubsystem));
//controllerupper.b().onTrue(climberControls.resetClimberEncoderCommand(climberSubsystem));
}
private void configueIntaker() {
@@ -73,7 +73,7 @@ public class IntakerControls {
public Command defaultIntakerCommand() {
return Commands.run(() -> {
double getterspeed = 0;
double conveyoyspeedforintake = 15;
double conveyoyspeedforintake = 0;
double statorCurrent = ShooterSubsystem.getConveyorStatorCurrent();
if (controller.getLeftTriggerAxis() > 0.1) {
@@ -147,4 +147,8 @@ public class ShooterControls {
flywheelSpeedOffset = 0.0;
backboardPositionOffset = 0.0;
}
public void startconveyor(){
shooterSubsystem.setConveyorSpeedByRPS(10);
}
}
@@ -163,7 +163,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
public void forceUsingLimelightmt2() {
LimelightHelpers.PoseEstimate mt2 =
LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(Constants.Limelight.LIMELIGHT_NAME_Shooter);
LimelightHelpers.getBotPoseEstimate_wpiBlue(Constants.Limelight.LIMELIGHT_NAME_Shooter);
if (mt2 == null || mt2.tagCount == 0) {
return;
@@ -258,7 +258,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
private LimelightHelpers.PoseEstimate getLimelightPoseEstimate(String limelightName) {
if (Constants.Limelight.UsingMetaTag2) {
return LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(limelightName);
return LimelightHelpers.getBotPoseEstimate_wpiBlue(limelightName);
}
return LimelightHelpers.getBotPoseEstimate_wpiBlue(limelightName);
}
@@ -415,8 +415,8 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
Pose2d pose = getState().Pose;
m_field.setRobotPose(pose);
posePub.set(pose);
shooter_ll_field.setRobotPose(LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(Constants.Limelight.LIMELIGHT_NAME_Shooter).pose);
intaker_ll_field.setRobotPose(LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(Constants.Limelight.LIMELIGHT_NAME_Intaker).pose);
shooter_ll_field.setRobotPose(LimelightHelpers.getBotPoseEstimate_wpiBlue(Constants.Limelight.LIMELIGHT_NAME_Shooter).pose);
intaker_ll_field.setRobotPose(LimelightHelpers.getBotPoseEstimate_wpiBlue(Constants.Limelight.LIMELIGHT_NAME_Intaker).pose);
driveNetworkTable.getEntry("YawFromState").setDouble(getState().Pose.getRotation().getDegrees());
driveNetworkTable.getEntry("DriveMode").setString(m_driveMode.name());
driveNetworkTable.getEntry("IsFieldCentric").setBoolean(m_driveMode == DriveMode.FIELD_CENTRIC);
@@ -97,7 +97,7 @@ public class IntakerSubsystem extends SubsystemBase{
double currentPosition = getIntakerotaterPosition();
if (currentPosition < Constants.Intaker.intakeRotaterUpLimit) {
// move up while below the upper limit
intakerotater.set(0.2);
intakerotater.set(0.3);
} else {
// at or above upper limit: stop
stopIntakerotater();