-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
dca0b48
commit a8a5cf6
Showing
4 changed files
with
92 additions
and
0 deletions.
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
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,70 @@ | ||
package frc.robot.commands; | ||
|
||
import java.util.function.BooleanSupplier; | ||
import java.util.function.DoubleSupplier; | ||
|
||
import frc.robot.subsystems.Swerve; | ||
|
||
public class AbsoluteDriveAdv { | ||
|
||
private final Swerve swerve; | ||
private final DoubleSupplier vX, vY, headingAdjust; | ||
private final BooleanSupplier lookAway, lookTowards, lookLeft, lookRight; | ||
private boolean resetHeading; | ||
|
||
/** | ||
* @param swerve Swerve Subsystem | ||
* @param vX Double supplier X component of joystick input after deadband is applied, should be -1 to 1 | ||
* @param vY Double supplier Y component of joystick input after deadband is applied, should be -1 to 1 | ||
* @param headingAdjust Double supplier current robot heading to be adjusted after deadband is applied | ||
* @param lookAway Faces the robot towards the opposind alliance wall from the driver | ||
* @param lookTowards Faces the robot towards the driver | ||
* @param lookLeft Faces the robot left | ||
* @param lookRight Faces the robot right | ||
* | ||
* @return | ||
*/ | ||
public AbsoluteDriveAdv(Swerve swerve, DoubleSupplier vX, DoubleSupplier vY, DoubleSupplier headingAdjust, | ||
BooleanSupplier lookAway, BooleanSupplier lookTowards, BooleanSupplier lookLeft, | ||
BooleanSupplier lookRight) { | ||
|
||
this.swerve = swerve; | ||
this.vX = vX; | ||
this.vY = vY; | ||
this.headingAdjust = headingAdjust; | ||
this.lookAway = lookAway; | ||
this.lookTowards = lookTowards; | ||
this.lookLeft = lookLeft; | ||
this.lookRight = lookRight; | ||
} | ||
|
||
public void initialize() { | ||
resetHeading = true; | ||
} | ||
|
||
public void execute() { | ||
double headingX = 0; // Resets values | ||
double headingY = 0; | ||
|
||
if (lookAway.getAsBoolean()) { // Y | ||
headingY = -1; | ||
} | ||
if (lookTowards.getAsBoolean()) { // Y | ||
headingY = 1; | ||
} | ||
if (lookLeft.getAsBoolean()) { // X | ||
headingX = -1; | ||
} | ||
if (lookRight.getAsBoolean()) { // X | ||
headingX = 1; | ||
} | ||
} | ||
|
||
public void end() { | ||
|
||
} | ||
|
||
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