From 3bd14fc94b802491dab07cbc9e5ed65a314009b0 Mon Sep 17 00:00:00 2001 From: Programming Date: Mon, 26 Feb 2024 16:38:14 -0800 Subject: [PATCH] feat:small fix --- .../deploy/pathplanner/paths/Bot_Dis_1.path | 19 ---------- .../deploy/pathplanner/paths/Shoot_Top1.path | 38 ------------------- src/main/java/frc/robot/Constants.java | 1 + src/main/java/frc/robot/RobotContainer.java | 32 +++++++++------- 4 files changed, 19 insertions(+), 71 deletions(-) diff --git a/src/main/deploy/pathplanner/paths/Bot_Dis_1.path b/src/main/deploy/pathplanner/paths/Bot_Dis_1.path index c1f069d..d9e8f8e 100644 --- a/src/main/deploy/pathplanner/paths/Bot_Dis_1.path +++ b/src/main/deploy/pathplanner/paths/Bot_Dis_1.path @@ -81,25 +81,6 @@ "type": "sequential", "data": { "commands": [ - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "wait", - "data": { - "waitTime": 0.5 - } - }, - { - "type": "named", - "data": { - "name": "align" - } - } - ] - } - }, { "type": "parallel", "data": { diff --git a/src/main/deploy/pathplanner/paths/Shoot_Top1.path b/src/main/deploy/pathplanner/paths/Shoot_Top1.path index b682804..fb8b55c 100644 --- a/src/main/deploy/pathplanner/paths/Shoot_Top1.path +++ b/src/main/deploy/pathplanner/paths/Shoot_Top1.path @@ -86,25 +86,6 @@ "type": "sequential", "data": { "commands": [ - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "wait", - "data": { - "waitTime": 0.5 - } - }, - { - "type": "named", - "data": { - "name": "align" - } - } - ] - } - }, { "type": "parallel", "data": { @@ -226,25 +207,6 @@ "type": "sequential", "data": { "commands": [ - { - "type": "parallel", - "data": { - "commands": [ - { - "type": "wait", - "data": { - "waitTime": 0.5 - } - }, - { - "type": "named", - "data": { - "name": "align" - } - } - ] - } - }, { "type": "parallel", "data": { diff --git a/src/main/java/frc/robot/Constants.java b/src/main/java/frc/robot/Constants.java index ef49350..09225aa 100644 --- a/src/main/java/frc/robot/Constants.java +++ b/src/main/java/frc/robot/Constants.java @@ -116,6 +116,7 @@ public static final class ShooterConstants { public static final int kTopShooterMotorPort = 35; public static final int kBottomShooterMotorPort = 20; public static final double kTimeShoot = 5; + public static final double kShooterMotorSpeed = 0; } public static final class VisionConstants { diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 7a67764..1ad76c8 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -45,7 +45,7 @@ public class RobotContainer { private final ShooterSubsystem m_shooterSubsystem = new ShooterSubsystem(); public final IntakeSubsystem m_intakeSubsystem = new IntakeSubsystem(); private final SendableChooser autoChooser; - + private boolean IntakeDropped = false; private boolean lastAButton = false; @@ -56,17 +56,19 @@ public class RobotContainer { * The container for the robot. Contains subsystems, IO devices, and commands. */ public RobotContainer() { - //Registering Named Commands for autonpaths - //registerCommand is looking for XXXXXXCommand, so things may need to be renamed. - NamedCommands.registerCommand("shoot", new InstantCommand(() -> m_shooterSubsystem.shooterTimedRun(Constants.ShooterConstants.kTimeShoot, Constants.ShooterConstants.kSpinSpeedTrue))); - //NamedCommands.registerCommand("align", DriverSubsystem.autoAlign()); - NamedCommands.registerCommand("intake", new InstantCommand(() -> m_intakeSubsystem.intakeTimedRun(Constants.IntakeConstants.kTimeIntake), m_intakeSubsystem)); - - //All paths automatically + // Registering Named Commands for autonpaths + // registerCommand is looking for XXXXXXCommand, so things may need to be + // renamed. + NamedCommands.registerCommand("shoot", new InstantCommand(() -> m_shooterSubsystem + .shooterTimedRun(Constants.ShooterConstants.kTimeShoot, Constants.ShooterConstants.kShooterMotorSpeed))); + + NamedCommands.registerCommand("intake", new InstantCommand( + () -> m_intakeSubsystem.intakeTimedRun(Constants.IntakeConstants.kTimeIntake), m_intakeSubsystem)); + + // All paths automatically autoChooser = AutoBuilder.buildAutoChooser(); SmartDashboard.putData("Auto Chooser", autoChooser); - AutoBuilder.configureHolonomic(m_robotDrive::getPose, m_robotDrive::resetOdometry, m_robotDrive::getChassisSpeeds, m_robotDrive::autonDrive, @@ -121,8 +123,10 @@ private void configureBindings() { .onTrue(new InstantCommand(m_robotDrive::zeroHeading, m_robotDrive)); // new JoystickButton(m_driverController, Button.kA.value).whileTrue( - // AutoBuilder.pathfindToPose(new Pose2d(2.8, 5.5, new Rotation2d()), new PathConstraints( - // DriveConstants.kMaxSpeedMetersPerSecond - 1, 5, DriveConstants.kMaxAngularSpeedRadiansPerSecond - 1, 5))); + // AutoBuilder.pathfindToPose(new Pose2d(2.8, 5.5, new Rotation2d()), new + // PathConstraints( + // DriveConstants.kMaxSpeedMetersPerSecond - 1, 5, + // DriveConstants.kMaxAngularSpeedRadiansPerSecond - 1, 5))); new JoystickButton(m_operatorController, Button.kX.value) .onTrue(new InstantCommand(() -> m_shooterSubsystem.spin(0.75), m_shooterSubsystem)) @@ -136,8 +140,7 @@ private void configureBindings() { }).whileTrue(new IntakeCommand(m_intakeSubsystem)); } - - //adding auton Path options + // adding auton Path options /** * Use this to pass the autonomous command to the main {@link Robot} class. @@ -145,7 +148,8 @@ private void configureBindings() { * @return the command to run in autonomous */ public Command getAutonomousCommand() { - PathPlannerPath path = PathPlannerPath.fromPathFile("New New Path"); + Command follow = autoChooser.getSelected(); + PathPlannerPath path = PathPlannerPath.fromPathFile(follow.getName()); var alliance = DriverStation.getAlliance(); PathPlannerPath autonPath = path;