-
-
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.
* create note intake assit manager * rename * intake assist manager inital code * intake assist manager changes * implement intake assist logic into swerveSubsytem & robotManager * remove unused subsystem * fix duplicated code in robotManager Co-authored-by: Jonah Snider <[email protected]> * changes * button bindings * fix button bindings * changes * revert back to updateSwerveSpeeds() to finish change tmr & fomat * remove stopIntakingRequest in favor of stowRequest * intake assist changes --------- Co-authored-by: fcuellar13 <[email protected]> Co-authored-by: Jonah Snider <[email protected]>
- Loading branch information
1 parent
32d1f67
commit 12c8446
Showing
11 changed files
with
139 additions
and
21 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
51 changes: 51 additions & 0 deletions
51
src/main/java/frc/robot/intake_assist/IntakeAssistManager.java
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,51 @@ | ||
package frc.robot.intake_assist; | ||
|
||
import dev.doglog.DogLog; | ||
import edu.wpi.first.math.MathUtil; | ||
import edu.wpi.first.math.geometry.Rotation2d; | ||
import edu.wpi.first.math.geometry.Translation2d; | ||
import edu.wpi.first.math.kinematics.ChassisSpeeds; | ||
import frc.robot.imu.ImuSubsystem; | ||
import frc.robot.util.scheduling.LifecycleSubsystem; | ||
import frc.robot.util.scheduling.SubsystemPriority; | ||
import frc.robot.vision.LimelightHelpers; | ||
|
||
public class IntakeAssistManager extends LifecycleSubsystem { | ||
private static final double ASSIST_KP = 3.5; | ||
private static final String LIMELIGHT_NAME = "limelight-note"; | ||
private static final double MAX_ANGLE_CHANGE = -35.0; | ||
private static final double MIN_ANGLE_CHANGE = 35.0; | ||
|
||
public IntakeAssistManager() { | ||
super(SubsystemPriority.INTAKE_ASSIST_MANAGER); | ||
} | ||
|
||
public ChassisSpeeds getRobotRelativeAssistSpeeds(ChassisSpeeds fieldRelativeInputSpeeds) { | ||
|
||
double tx = LimelightHelpers.getTX(LIMELIGHT_NAME); | ||
|
||
if (tx == 0) { | ||
return fieldRelativeInputSpeeds; | ||
} | ||
|
||
DogLog.log("IntakeAssist/TX", tx); | ||
|
||
double fieldRelativeNoteAngle = ImuSubsystem.getRobotHeading() + tx; | ||
|
||
double angleError = ImuSubsystem.getRobotHeading() - fieldRelativeNoteAngle; | ||
|
||
double angleChange = MathUtil.clamp(MIN_ANGLE_CHANGE, MAX_ANGLE_CHANGE, angleError * ASSIST_KP); | ||
|
||
Translation2d requestedFieldRelativeDrive = | ||
new Translation2d( | ||
fieldRelativeInputSpeeds.vxMetersPerSecond, fieldRelativeInputSpeeds.vyMetersPerSecond); | ||
|
||
Translation2d newDriveRequest = | ||
requestedFieldRelativeDrive.rotateBy(Rotation2d.fromDegrees(angleChange)); | ||
|
||
return new ChassisSpeeds( | ||
newDriveRequest.getX(), | ||
newDriveRequest.getY(), | ||
fieldRelativeInputSpeeds.omegaRadiansPerSecond); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -20,6 +20,7 @@ public enum RobotState { | |
INTAKING_BACK, | ||
INTAKING_FORWARD_PUSH, | ||
OUTTAKING, | ||
INTAKE_ASSIST, | ||
|
||
UNJAM, | ||
|
||
|
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
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