屎
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"version": "2025.0",
|
||||
"command": {
|
||||
"type": "sequential",
|
||||
"data": {
|
||||
"commands": [
|
||||
{
|
||||
"type": "named",
|
||||
"data": {
|
||||
"name": "start_intake_timelimit"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"resetOdom": true,
|
||||
"folder": "Red Middle",
|
||||
"choreoAuto": false
|
||||
}
|
||||
@@ -22,12 +22,30 @@
|
||||
"pathName": "Shoot to Climb Step1 Red"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "wait",
|
||||
"data": {
|
||||
"waitTime": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"data": {
|
||||
"pathName": "Climb Step2 Red"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "wait",
|
||||
"data": {
|
||||
"waitTime": 1.0
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "named",
|
||||
"data": {
|
||||
"name": "climb_up"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"data": {
|
||||
|
||||
@@ -8,20 +8,20 @@
|
||||
},
|
||||
"prevControl": null,
|
||||
"nextControl": {
|
||||
"x": 15.610835339716738,
|
||||
"y": 3.3590426144037364
|
||||
"x": 15.522355156858092,
|
||||
"y": 3.365
|
||||
},
|
||||
"isLocked": false,
|
||||
"linkedName": null
|
||||
},
|
||||
{
|
||||
"anchor": {
|
||||
"x": 15.467,
|
||||
"x": 15.517,
|
||||
"y": 3.365
|
||||
},
|
||||
"prevControl": {
|
||||
"x": 15.743555432745389,
|
||||
"y": 3.3550226257587115
|
||||
"x": 15.77785583456356,
|
||||
"y": 3.365
|
||||
},
|
||||
"nextControl": null,
|
||||
"isLocked": false,
|
||||
|
||||
@@ -3,25 +3,25 @@
|
||||
"waypoints": [
|
||||
{
|
||||
"anchor": {
|
||||
"x": 15.467,
|
||||
"x": 15.517,
|
||||
"y": 3.365
|
||||
},
|
||||
"prevControl": null,
|
||||
"nextControl": {
|
||||
"x": 15.716589593303949,
|
||||
"y": 3.3506809597259686
|
||||
"x": 15.767,
|
||||
"y": 3.365
|
||||
},
|
||||
"isLocked": false,
|
||||
"linkedName": null
|
||||
},
|
||||
{
|
||||
"anchor": {
|
||||
"x": 15.467,
|
||||
"x": 15.517,
|
||||
"y": 3.465
|
||||
},
|
||||
"prevControl": {
|
||||
"x": 15.191301517038063,
|
||||
"y": 3.4933990509259307
|
||||
"x": 15.239842716853756,
|
||||
"y": 3.465
|
||||
},
|
||||
"nextControl": null,
|
||||
"isLocked": false,
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class Constants {
|
||||
public static final double backboardDownLimit = 0.0; // 背板下限角度(根据实际需求设置)
|
||||
}
|
||||
public class AutoPositioning {
|
||||
public static final double autoRotationkP = 0.1;
|
||||
public static final double autoRotationkP = 0.08;
|
||||
public static final double autoRotationForBumpTargetDegrees = 45;
|
||||
public static final double autoRotationForTrenchTargetDegrees = 0;
|
||||
public static final boolean teleopOffsetEnabled = true;
|
||||
@@ -149,7 +149,7 @@ public final class Constants {
|
||||
|
||||
public static double climbUpTicks = 94; // TODO: 实测后调整
|
||||
public static double climbDownTicks = 0; // TODO: 实测后调整
|
||||
public static double climbDownAutoTicks = -5; // TODO: 实测后调整,自动爬时可能不需要完全降到底
|
||||
public static double climbDownAutoTicks = 0; // TODO: 实测后调整,自动爬时可能不需要完全降到底
|
||||
public static final double climbVelocity = -200;
|
||||
public static final double holdToleranceRot = 0.5;
|
||||
public static final double deltaDownTicks = 1;
|
||||
|
||||
@@ -91,7 +91,7 @@ public class RobotContainer {
|
||||
configueClimber();
|
||||
bingdingLED();
|
||||
configueIntaker();
|
||||
configureBindings();
|
||||
//configureBindings();
|
||||
}
|
||||
|
||||
/* ====================== */
|
||||
@@ -202,21 +202,21 @@ public class RobotContainer {
|
||||
controllerupper.a().onTrue(intakerControls.resetIntakerRotaterEncoderCommand(IntakerSubsystem));
|
||||
}
|
||||
|
||||
private void configureBindings() {
|
||||
teleopStartTrigger.onTrue(handleClimberAtTeleopStartCommand());
|
||||
}
|
||||
// private void configureBindings() {
|
||||
// teleopStartTrigger.onTrue(handleClimberAtTeleopStartCommand());
|
||||
// }
|
||||
|
||||
private Command handleClimberAtTeleopStartCommand() {
|
||||
return new InstantCommand(() -> {
|
||||
if (climberSubsystem.wasAutoClimbUsedInAuto()) {
|
||||
climberSubsystem.climbUp();
|
||||
climberSubsystem.clearAutoClimbUsedInAutoFlag();
|
||||
}
|
||||
}, climberSubsystem);
|
||||
}
|
||||
// private Command handleClimberAtTeleopStartCommand() {
|
||||
// return new InstantCommand(() -> {
|
||||
// if (climberSubsystem.wasAutoClimbUsedInAuto()) {
|
||||
// climberSubsystem.climbUp();
|
||||
// climberSubsystem.clearAutoClimbUsedInAutoFlag();
|
||||
// }
|
||||
// }, climberSubsystem);
|
||||
// }
|
||||
|
||||
public ClimberSubsystem getClimberSubsystem() {
|
||||
return climberSubsystem;
|
||||
}
|
||||
// public ClimberSubsystem getClimberSubsystem() {
|
||||
// return climberSubsystem;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import frc.robot.Constants.RobotStatus;
|
||||
ShooterControls shooterControls
|
||||
) {
|
||||
NamedCommands.registerCommand("climb_up", climb_up(climber));
|
||||
NamedCommands.registerCommand("climb_down", climb_down(climber));
|
||||
//NamedCommands.registerCommand("climb_down", climb_down(climber));
|
||||
NamedCommands.registerCommand("start_intake", start_intake(intaker));
|
||||
NamedCommands.registerCommand("start_intake_timelimit", start_intake_timelimit(intaker));
|
||||
NamedCommands.registerCommand("stop_intake", stop_intake(intaker));
|
||||
@@ -40,32 +40,30 @@ import frc.robot.Constants.RobotStatus;
|
||||
NamedCommands.registerCommand("intaker_up", intaker_up(intaker));
|
||||
NamedCommands.registerCommand("auto_align_to_climb", autoAlignToClimb(drivetrain));
|
||||
NamedCommands.registerCommand("shoot", shoot(shooter));
|
||||
NamedCommands.registerCommand("Shake", Autocommand.shake(driveControls));
|
||||
NamedCommands.registerCommand("AutoAim", Autocommand.autoAim(driveControls));
|
||||
NamedCommands.registerCommand("AutoShoot", Autocommand.autoShoot(shooterControls));
|
||||
// NamedCommands.registerCommand("Shake", Autocommand.shake(driveControls));
|
||||
// NamedCommands.registerCommand("AutoAim", Autocommand.autoAim(driveControls));
|
||||
// NamedCommands.registerCommand("AutoShoot", Autocommand.autoShoot(shooterControls));
|
||||
|
||||
}
|
||||
|
||||
public static Command climb_up(ClimberSubsystem climber) {
|
||||
return new RunCommand(() -> {
|
||||
climber.climbUp(); // 控制爬升器上升
|
||||
}, climber).withTimeout(1.0).andThen(new RunCommand(() -> {
|
||||
climber.climbUpNonStopforAuto();
|
||||
}, climber).withTimeout(0.5)).andThen(new InstantCommand(() -> {
|
||||
}, climber).withTimeout(1.0).andThen(new InstantCommand(() -> {
|
||||
climber.holdPosition(); // 停止并锁定当前爬升器位置
|
||||
}, climber));
|
||||
}
|
||||
public static Command climb_down(ClimberSubsystem climber) {
|
||||
return Commands.sequence(
|
||||
new InstantCommand(climber::markAutoClimbUsedInAuto),
|
||||
new RunCommand(() -> {
|
||||
climber.climbDownAuto();
|
||||
}, climber).withTimeout(2.0),
|
||||
new InstantCommand(() -> {
|
||||
climber.holdPosition();
|
||||
}, climber)
|
||||
);
|
||||
}
|
||||
// public static Command climb_down(ClimberSubsystem climber) {
|
||||
// return Commands.sequence(
|
||||
// new InstantCommand(climber::markAutoClimbUsedInAuto),
|
||||
// new RunCommand(() -> {
|
||||
// climber.climbDownAuto();
|
||||
// }, climber).withTimeout(2.0),
|
||||
// new InstantCommand(() -> {
|
||||
// climber.holdPosition();
|
||||
// }, climber)
|
||||
// );
|
||||
// }
|
||||
|
||||
public static Command start_intake(IntakerSubsystem intaker) {
|
||||
return new RunCommand(() -> {
|
||||
@@ -138,15 +136,15 @@ import frc.robot.Constants.RobotStatus;
|
||||
shooter.setConveyorSpeedByRPS(0); // 停止输送
|
||||
}, shooter)));
|
||||
}
|
||||
public static Command autoAim(DriveControls driveControls) {
|
||||
return driveControls.autoAimCommand();
|
||||
}
|
||||
public static Command autoShoot(ShooterControls shooterControl) {
|
||||
return shooterControl.autoShootToHubCommand();
|
||||
}
|
||||
public static Command shake(DriveControls driveControls) {
|
||||
return driveControls.shakeCommand();
|
||||
}
|
||||
// public static Command autoAim(DriveControls driveControls) {
|
||||
// return driveControls.autoAimCommand();
|
||||
// }
|
||||
// public static Command autoShoot(ShooterControls shooterControl) {
|
||||
// return shooterControl.autoShootToHubCommand();
|
||||
// }
|
||||
// public static Command shake(DriveControls driveControls) {
|
||||
// return driveControls.shakeCommand();
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,17 @@ public class TunerConstants {
|
||||
);
|
||||
private static final CANcoderConfiguration encoderInitialConfigs = new CANcoderConfiguration();
|
||||
// Configs for the Pigeon 2; leave this null to skip applying Pigeon 2 configs
|
||||
private static final Pigeon2Configuration pigeonConfigs = null;
|
||||
private static final Pigeon2Configuration pigeonConfigs =
|
||||
new Pigeon2Configuration()
|
||||
.withGyroTrim(
|
||||
new GyroTrimConfigs()
|
||||
.withGyroScalarZ(-5.0)
|
||||
)
|
||||
.withPigeon2Features(
|
||||
new Pigeon2FeaturesConfigs()
|
||||
.withEnableCompass(false)
|
||||
);
|
||||
|
||||
|
||||
// CAN bus that the devices are located on;
|
||||
// All swerve devices must share the same CAN bus
|
||||
|
||||
@@ -16,7 +16,7 @@ import frc.robot.Constants;
|
||||
|
||||
public class ClimberSubsystem extends SubsystemBase {
|
||||
|
||||
private boolean autoClimbUsedInAuto = false;
|
||||
// private boolean autoClimbUsedInAuto = false;
|
||||
|
||||
private final TalonFX climberMotor;
|
||||
private double targetPositionTicks;
|
||||
@@ -102,17 +102,17 @@ public class ClimberSubsystem extends SubsystemBase {
|
||||
climberMotor.set(0);
|
||||
}
|
||||
|
||||
public void markAutoClimbUsedInAuto() {
|
||||
autoClimbUsedInAuto = true;
|
||||
}
|
||||
// public void markAutoClimbUsedInAuto() {
|
||||
// autoClimbUsedInAuto = true;
|
||||
// }
|
||||
|
||||
public boolean wasAutoClimbUsedInAuto() {
|
||||
return autoClimbUsedInAuto;
|
||||
}
|
||||
// public boolean wasAutoClimbUsedInAuto() {
|
||||
// return autoClimbUsedInAuto;
|
||||
// }
|
||||
|
||||
public void clearAutoClimbUsedInAutoFlag() {
|
||||
autoClimbUsedInAuto = false;
|
||||
}
|
||||
// public void clearAutoClimbUsedInAutoFlag() {
|
||||
// autoClimbUsedInAuto = false;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void periodic() {
|
||||
|
||||
@@ -163,7 +163,7 @@ public class CommandSwerveDrivetrain extends TunerSwerveDrivetrain implements Su
|
||||
|
||||
public void forceUsingLimelightmt2() {
|
||||
LimelightHelpers.PoseEstimate mt2 =
|
||||
LimelightHelpers.getBotPoseEstimate_wpiBlue(Constants.Limelight.LIMELIGHT_NAME_Shooter);
|
||||
LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(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(limelightName);
|
||||
return LimelightHelpers.getBotPoseEstimate_wpiBlue_MegaTag2(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(Constants.Limelight.LIMELIGHT_NAME_Shooter).pose);
|
||||
intaker_ll_field.setRobotPose(LimelightHelpers.getBotPoseEstimate_wpiBlue(Constants.Limelight.LIMELIGHT_NAME_Intaker).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);
|
||||
driveNetworkTable.getEntry("YawFromState").setDouble(getState().Pose.getRotation().getDegrees());
|
||||
driveNetworkTable.getEntry("DriveMode").setString(m_driveMode.name());
|
||||
driveNetworkTable.getEntry("IsFieldCentric").setBoolean(m_driveMode == DriveMode.FIELD_CENTRIC);
|
||||
|
||||
Reference in New Issue
Block a user