-
Notifications
You must be signed in to change notification settings - Fork 1
First phase rumble to prevent robot from entering opponent's Barge #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
neo-Aditya
wants to merge
42
commits into
main
Choose a base branch
from
first_phase_rumble
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
3dec6a7
path changes
2af2c92
broken
JAMthepersonj 1a7a3f7
Merge branch 'main' of https://github.com/FRC4048/FRC2025_Java into n…
JAMthepersonj 88683d0
merge errors
JAMthepersonj c421942
update
JAMthepersonj 13931bf
update
JAMthepersonj 566751c
UPDATE
JAMthepersonj c8dd298
updated to use lamda
JAMthepersonj 5afb845
added two square collison?
JAMthepersonj 5e42285
update
JAMthepersonj 2796432
update
JAMthepersonj 895ea49
update
JAMthepersonj f0df905
Fixed a few things
neo-Aditya 7b5eabb
removed unnecesary symbol
neo-Aditya 099f5d9
renamed method to be clearer
neo-Aditya aa7a13e
renamed variable
neo-Aditya 55bb754
Removed unused classes
neo-Aditya 0dd4b00
idk why these didn't commit aswell
neo-Aditya 5a323c5
IT WORKKKKKSKSKSKKSKSKS
JAMthepersonj 48be9f2
Merge branch 'first_phase_rumble' of https://github.com/FRC4048/FRC20…
JAMthepersonj f6751f3
error con merge
JAMthepersonj 34dd4dc
stuff
JAMthepersonj 39516a7
added toggle for rumble
JAMthepersonj d45b9f5
updated With noah changes
JAMthepersonj 434b21f
name
JAMthepersonj bea9836
add enum
JAMthepersonj 57790b7
added max rumble
JAMthepersonj a0ea03a
added changes
JAMthepersonj 6a5381b
names
JAMthepersonj 456a951
Updated#1
JAMthepersonj d48d435
added fieldZoneUtils
JAMthepersonj 8791600
Merge branch 'main' of https://github.com/FRC4048/FRC2025_Java into f…
JAMthepersonj 19b62bc
added erro message / backup if we do not have an alliance color
JAMthepersonj 80ee41c
lint
JAMthepersonj 7c629c7
update
JAMthepersonj b8adff8
Merge branch 'main' of https://github.com/FRC4048/FRC2025_Java into f…
JAMthepersonj 7b78d2e
Actually used the command in robot container :cry:
JAMthepersonj 83195a2
Merge branch 'main' of https://github.com/FRC4048/FRC2025_Java into f…
JAMthepersonj ef05224
Merge branch 'main' of https://github.com/FRC4048/FRC2025_Java into f…
JAMthepersonj 23c54b5
Changed name of second GetY
JAMthepersonj 823c9c1
added rumble toggle
JAMthepersonj 025601f
changed
JAMthepersonj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,42 @@ | ||
| // 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.math.geometry.Pose2d; | ||
| import edu.wpi.first.wpilibj.GenericHID.RumbleType; | ||
| import edu.wpi.first.wpilibj2.command.button.CommandXboxController; | ||
| import frc.robot.utils.FieldZoneUtils; | ||
| import frc.robot.utils.logging.commands.LoggableCommand; | ||
| import java.util.function.Supplier; | ||
|
|
||
| /* You should consider using the more terse Command factories API instead https://docs.wpilib.org/en/stable/docs/software/commandbased/organizing-command-based.html#defining-commands */ | ||
| public class RumbleController extends LoggableCommand { | ||
|
|
||
| private final Supplier<Pose2d> robotPose; | ||
| private final CommandXboxController controller; | ||
|
|
||
| public RumbleController(Supplier<Pose2d> robotPose, CommandXboxController controller) { | ||
| this.robotPose = robotPose; | ||
| this.controller = controller; | ||
| } | ||
|
|
||
| @Override | ||
| public void initialize() {} | ||
|
|
||
| @Override | ||
| public void execute() { | ||
| if (FieldZoneUtils.isInOppositeBarge(robotPose.get().getX(), robotPose.get().getY())) { | ||
| controller.setRumble(RumbleType.kBothRumble, 1); | ||
| } else controller.setRumble(RumbleType.kBothRumble, 0); | ||
| } | ||
|
|
||
| @Override | ||
| public void end(boolean interrupted) {} | ||
|
|
||
| @Override | ||
| public boolean isFinished() { | ||
| return false; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
neo-Aditya marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,39 @@ | ||
| // 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.utils; | ||
|
|
||
| import edu.wpi.first.wpilibj.DriverStation; | ||
| import edu.wpi.first.wpilibj.DriverStation.Alliance; | ||
| import frc.robot.Robot; | ||
|
|
||
| /** Add your docs here. */ | ||
| public enum Barge { | ||
| RIGHT_LOWER(8.9246, 0), | ||
| RIGHT_HIGHER(8.9246, 4), | ||
| LEFT_LOWER(7.56, 0), | ||
| LEFT_HIGHER(7.56, 4); | ||
|
|
||
| private final double x; | ||
| private final double y; | ||
|
|
||
| Barge(double x, double y) { | ||
| this.x = x; | ||
| this.y = y; | ||
| } | ||
|
|
||
| public double getX() { | ||
| return x; | ||
| } | ||
|
|
||
| public double getY(DriverStation.Alliance AllianceColor) { | ||
neo-Aditya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return AllianceColor.equals(Alliance.Blue) ? y : y + 4; | ||
| } | ||
|
|
||
| public double getY() { | ||
| return Robot.getAllianceColor().isPresent() | ||
| ? Robot.getAllianceColor().get().equals(Alliance.Blue) ? y : y + 4 | ||
| : -1; | ||
| } | ||
| } | ||
This file contains hidden or 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,24 @@ | ||
| // 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.utils; | ||
|
|
||
| import edu.wpi.first.wpilibj.DriverStation; | ||
| import edu.wpi.first.wpilibj.DriverStation.Alliance; | ||
| import frc.robot.Robot; | ||
| import java.util.Optional; | ||
|
|
||
| /** Add your docs here. */ | ||
| public class FieldZoneUtils { | ||
|
|
||
| public static boolean isInOppositeBarge(double x, double y) { | ||
| Optional<DriverStation.Alliance> al = Robot.getAllianceColor(); | ||
| if ((x < Barge.RIGHT_HIGHER.getX()) && (x > Barge.LEFT_LOWER.getX()) && (al.isPresent())) { | ||
| return al.get().equals(Alliance.Red) | ||
| ? (y < Barge.RIGHT_HIGHER.getY()) | ||
| : (y > Barge.RIGHT_HIGHER.getY()); | ||
| } | ||
| return false; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.