修复底盘自动瞄准trench和bmp

This commit is contained in:
OnDYCLaptop
2026-03-06 17:29:43 +08:00
parent 0536a3bcd4
commit 83c06bd0e6
4 changed files with 10 additions and 7 deletions
@@ -157,6 +157,7 @@ public class DriveControls {
Math.max(Math.abs(raw), 0.4), Math.max(Math.abs(raw), 0.4),
raw raw
); );
vy = isRedAlliance ? -vy : vy;
} }
autoControlNetworkTable.getEntry("BumpDifference").setDouble(differenceBump); autoControlNetworkTable.getEntry("BumpDifference").setDouble(differenceBump);
@@ -186,6 +187,7 @@ public class DriveControls {
Math.max(Math.abs(raw), 0.4), Math.max(Math.abs(raw), 0.4),
raw raw
); );
vy = isRedAlliance ? -vy : vy;
} }
autoControlNetworkTable.getEntry("TrenchDifference").setDouble(differenceTrench); autoControlNetworkTable.getEntry("TrenchDifference").setDouble(differenceTrench);
Rotation2d currentAngle = drivetrain.getState().Pose.getRotation(); Rotation2d currentAngle = drivetrain.getState().Pose.getRotation();
@@ -209,7 +211,8 @@ public class DriveControls {
if (fieldCentricEnabled || isAutoLike) { if (fieldCentricEnabled || isAutoLike) {
// 自动状态用 BlueAlliance(不翻转),手柄 field-centric 仍用原 fieldCentric(OperatorPerspective) // 自动状态用 BlueAlliance(不翻转),手柄 field-centric 仍用原 fieldCentric(OperatorPerspective)
var chosen = isAutoLike ? fieldCentricAuto : fieldCentric; //var chosen = isAutoLike ? fieldCentricAuto : fieldCentric;
var chosen = fieldCentric;
return chosen return chosen
.withVelocityX(vx) .withVelocityX(vx)
.withVelocityY(vy) .withVelocityY(vy)
@@ -75,6 +75,7 @@ public class IntakerControls {
double getterspeed = 0; double getterspeed = 0;
double conveyoyspeedforintake = 15; double conveyoyspeedforintake = 15;
double statorCurrent = ShooterSubsystem.getConveyorStatorCurrent(); double statorCurrent = ShooterSubsystem.getConveyorStatorCurrent();
if (controller.getLeftTriggerAxis() > 0.1) { if (controller.getLeftTriggerAxis() > 0.1) {
getterspeed = controller.getLeftTriggerAxis() * Constants.Intaker.IntakeGetterK + Constants.Intaker.Getterminspeed; getterspeed = controller.getLeftTriggerAxis() * Constants.Intaker.IntakeGetterK + Constants.Intaker.Getterminspeed;
ShooterSubsystem.setConveyorSpeedByRPS(conveyoyspeedforintake); ShooterSubsystem.setConveyorSpeedByRPS(conveyoyspeedforintake);
@@ -274,6 +274,10 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
return true; return true;
} }
public void setLimelightIntakerPipeline(int pipeline){
LimelightSupplier.setPipeline(pipeline);
}
public String driveToAprilTag(){ public String driveToAprilTag(){
//Rotation2d targetHeading = getPose().getRotation(); //Rotation2d targetHeading = getPose().getRotation();
if(!LimelightSupplier.isTargetVisible() ){ if(!LimelightSupplier.isTargetVisible() ){
@@ -322,11 +326,6 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
} }
positioningNetworkTable.getEntry("interestPointsClimb tx").setDouble(tx);
positioningNetworkTable.getEntry("interestPointsClimb targetTz").setDouble(targetTz);
positioningNetworkTable.getEntry("interestPointsClimb ry").setDouble(ry);
ChassisSpeeds scaled = new ChassisSpeeds( ChassisSpeeds scaled = new ChassisSpeeds(
tx, // X 不变 tx, // X 不变
targetTz, // Y 不变 targetTz, // Y 不变
@@ -86,6 +86,6 @@ public class IntakerSubsystem extends SubsystemBase{
intakerotater.set(-0.05); intakerotater.set(-0.05);
} }
public void IntakerUpNonStop(){ public void IntakerUpNonStop(){
intakerotater.set(0.2); intakerotater.set(0.1);
} }
} }