Skip to content

Commit

Permalink
kitbot auto (i think??)
Browse files Browse the repository at this point in the history
  • Loading branch information
team5338 committed Dec 5, 2024
1 parent e2a1098 commit 8e56b7f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import frc.robot.Constants.PneumaticConstants;
import frc.robot.subsystems.CANDrivetrain;
import frc.robot.subsystems.Pneumatics;
import frc.robot.commands.Auto;
import frc.robot.commands.PneumaticCommands;
import frc.robot.subsystems.Auto;

/**
* This class is where the bulk of the robot should be declared. Since
Expand Down Expand Up @@ -83,6 +83,6 @@ private void configureBindings() {

public Command getAutonomousCommand() {
// An example command will be run in autonomous
return Auto.getAuto(this);
return Auto.exampleAuto();
}
}
35 changes: 35 additions & 0 deletions src/main/java/frc/robot/commands/Auto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package frc.robot.commands;

import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.InstantCommand;
import edu.wpi.first.wpilibj2.command.RunCommand;
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
import edu.wpi.first.wpilibj2.command.WaitCommand;
import frc.robot.RobotContainer;
import frc.robot.subsystems.CANDrivetrain;

// import frc.robot.subsystems.CANDrivetrain;

public final class Auto {
/** Example static factory for an autonomous command. */
public static Command exampleAuto() {
/**
* RunCommand is a helper class that creates a command from a single method, in
* this case we
* pass it the arcadeDrive method to drive straight back at half power. We
* modify that command
* with the .withTimeout(1) decorator to timeout after 1 second, and use the
* .andThen decorator
* to stop the drivetrain after the first command times out
*/
return new SequentialCommandGroup(PneumaticCommands.pistonExtend(), new WaitCommand(2),
new RunCommand(() -> RobotContainer.m_drivetrain.arcadeDrive(-.5, 0), RobotContainer.m_drivetrain)
.withTimeout(1),
new InstantCommand(() -> RobotContainer.m_drivetrain.arcadeDrive(0, 0), RobotContainer.m_drivetrain),
PneumaticCommands.pistonRetract());
// return new InstantCommand(() -> PneumaticCommands.pistonExtend()).andThen(new
// RunCommand(() -> drivetrain.arcadeDrive(-.5, 0), drivetrain)
// .withTimeout(1)
// .andThen(new RunCommand(() -> drivetrain.arcadeDrive(0, 0), drivetrain)));
}
}
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/commands/PneumaticCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@ public static Command solenoidOff() {
public static Command solenoidToggle() {
return new InstantCommand(() -> RobotContainer.m_piston.toggleSolenoid());
}

public class pistonExtend {
}
}
20 changes: 0 additions & 20 deletions src/main/java/frc/robot/subsystems/Auto.java

This file was deleted.

0 comments on commit 8e56b7f

Please sign in to comment.