Skip to content

Commit

Permalink
Merge branch 'Pathfinding' of https://github.com/Tigerbotics7125/FRC2024
Browse files Browse the repository at this point in the history
 into Pathfinding
  • Loading branch information
DAflamingFOX committed Mar 20, 2024
2 parents 3b4f745 + 1da68c5 commit 21fed43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
36 changes: 14 additions & 22 deletions src/main/java/io/github/tigerbotics7125/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package io.github.tigerbotics7125;

import com.pathplanner.lib.auto.AutoBuilder;
import com.pathplanner.lib.commands.PathPlannerAuto;
import com.revrobotics.CANSparkBase.IdleMode;
import edu.wpi.first.cameraserver.CameraServer;
import edu.wpi.first.wpilibj.RobotController;
Expand Down Expand Up @@ -38,25 +37,21 @@ public class Robot extends TimedRobot {
private Intake m_intake = new Intake();
private Shooter m_shooter = new Shooter();
private Arm m_arm = new Arm();



//SendableChooser<PathPlannerAuto> m_autoChooser = new SendableChooser<>();
private SendableChooser<Command> autoChooser;
// SendableChooser<PathPlannerAuto> m_autoChooser = new SendableChooser<>();
private SendableChooser<Command> autoChooser;

SendableChooser<Constants.DriveTrain.ControlType> m_driveControlChooser =
new SendableChooser<>();
Command m_autonomousCommand;
Command m_autonomousCommand;

@Override
public void robotInit() {
//SmartDashboard.putData("Example Auto", new PathPlannerAuto("Example"));
// SmartDashboard.putData("Example Auto", new PathPlannerAuto("Example"));
autoChooser = AutoBuilder.buildAutoChooser("Example");
SmartDashboard.putData("Auto Mode", autoChooser);



//m_autoChooser.setDefaultOption("Example", new PathPlannerAuto("Example"));
// m_autoChooser.setDefaultOption("Example", new PathPlannerAuto("Example"));
m_driveControlChooser.setDefaultOption(
ControlType.CURVE_ROCKETLEAGUE.name(), ControlType.CURVE_ROCKETLEAGUE);
for (ControlType controlType : ControlType.values()) {
Expand Down Expand Up @@ -147,12 +142,12 @@ public void disabledPeriodic() {}

@Override
public void autonomousInit() {
m_autonomousCommand = getAutonomousCommand();
if(m_autonomousCommand != null){
m_autonomousCommand.schedule();
}
// Auto auto = m_autoChooser.getSelected();
m_autonomousCommand = getAutonomousCommand();

if (m_autonomousCommand != null) {
m_autonomousCommand.schedule();
}
// Auto auto = m_autoChooser.getSelected();

// auto.autoCommand()
// .ifPresentOrElse(
Expand All @@ -169,15 +164,12 @@ public void autonomousInit() {
}

@Override
public void autonomousPeriodic() {
}
public void autonomousPeriodic() {}

@Override
public void teleopInit() {
// Make sure autonomous commands are canceled for teleop
CommandScheduler.getInstance().cancelAll();


}

@Override
Expand All @@ -194,8 +186,8 @@ public void simulationInit() {}

@Override
public void simulationPeriodic() {}
public Command getAutonomousCommand(){

public Command getAutonomousCommand() {
return autoChooser.getSelected();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ public Command disable() {
}

public Command prepShooter() {
return runOnce(() -> m_PID.setSetpoint(Constants.Shooter.kShootRPM))
.andThen(pidControl());
return runOnce(() -> m_PID.setSetpoint(Constants.Shooter.kShootRPM)).andThen(pidControl());
}

public Command shootNote(Intake intake) {
Expand Down

0 comments on commit 21fed43

Please sign in to comment.