-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands; | ||
|
||
import edu.wpi.first.wpilibj2.command.CommandBase; | ||
import frc.robot.subsystems.DriveSubsystem; | ||
import java.util.function.DoubleSupplier; | ||
|
||
/** An example command that uses an example subsystem. */ | ||
public class BreakCommand extends CommandBase { | ||
private final DriveSubsystem m_driveSubsystem; | ||
private final DoubleSupplier m_left_y; // this gives us the left y axis for current controller | ||
private final DoubleSupplier m_right_y; // this gives us the right y axis for current controller | ||
/** | ||
* Creates a new StraightCommand. | ||
* | ||
* @param d_subsystem The drive subsystem used by this command. | ||
* @param xbox_left_y A function that returns the value of the left y axis for the joystick. | ||
* @param xbox_right_y A function that returns the value of the right Y axis for the joystick. | ||
*/ | ||
public BreakCommand( | ||
DriveSubsystem d_subsystem, DoubleSupplier xbox_left_y, DoubleSupplier xbox_right_y) { | ||
m_driveSubsystem = d_subsystem; | ||
m_left_y = xbox_left_y; | ||
m_right_y = xbox_right_y; | ||
|
||
// Change this to match the name of your camera | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
addRequirements(d_subsystem); | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
System.out.println("Starting 'StraightCommand."); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
m_driveSubsystem.tankDrive(0.7, 0.7); | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
m_driveSubsystem.turnResetPID(); // we make sure to clear the PID angle | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters