Skip to content

Commit

Permalink
autonchooser implemented?
Browse files Browse the repository at this point in the history
  • Loading branch information
JadedHearth committed Feb 23, 2024
1 parent f6519e4 commit 73fa609
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
34 changes: 33 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.auto.NamedCommands;
import com.pathplanner.lib.commands.PathPlannerAuto;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.XboxController;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.Commands;
import edu.wpi.first.wpilibj2.command.button.CommandXboxController;
Expand Down Expand Up @@ -59,6 +62,10 @@
import frc.robot.subsystems.wrist.WristIO;
import frc.robot.subsystems.wrist.WristIOSim;
import frc.robot.subsystems.wrist.WristIOSparkMax;

import java.util.ArrayList;
import java.util.List;

import org.littletonrobotics.junction.networktables.LoggedDashboardChooser;
import org.littletonrobotics.junction.networktables.LoggedDashboardNumber;

Expand Down Expand Up @@ -173,7 +180,32 @@ public RobotContainer() {
sIntake)
.withTimeout(5.0));

autoChooser = new LoggedDashboardChooser<>("Auto Choices", AutoBuilder.buildAutoChooser());
// Build SmartDashboard auto chooser
if (!AutoBuilder.isConfigured()) {
throw new RuntimeException(
"AutoBuilder was not configured before attempting to build auto chooser");
}

SendableChooser<Command> chooser = new SendableChooser<>();
// ! Add new autos here. The autogenerated one is bad because it includes all of the ones in the chache of the RoboRIO.
String[] autoNames =
new String[] {
"BlueLClose3",
"BlueLMid3",
"BlueLClose3Mid1Far"
};


chooser.setDefaultOption("None", Commands.none());
List<PathPlannerAuto> options = new ArrayList<>();

for (String autoName : autoNames) {
PathPlannerAuto auto = new PathPlannerAuto(autoName);
options.add(auto);
}

options.forEach(auto -> chooser.addOption(auto.getName(), auto));
autoChooser = new LoggedDashboardChooser<>("Auto Choices", chooser);

// Set up feedforward characterization
autoChooser.addOption(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public class ArmCommands {
private static final double DEADBAND = 0.3;
private static final double MAXRPM =
0.1; // TODO idk what a realistic one is so this is roughly 90 degrees per 2 seconds
0.1;

private ArmCommands() {}

Expand Down

0 comments on commit 73fa609

Please sign in to comment.