This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
-
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.
* added boxop oi rough draft * robot works! made some very temporary code for climber and nudge: FIXME * added boxop oi rough draft * robot works! made some very temporary code for climber and nudge: FIXME * getCurrentSpeed * no climber comp controls * lint * put boxop oi into unified file --------- Co-authored-by: qntmcube <[email protected]> Co-authored-by: BCNOFNeNaMg <[email protected]>
- Loading branch information
1 parent
0ce7acb
commit 4528b72
Showing
10 changed files
with
159 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package com.team766.robot.reva; | ||
|
||
import com.team766.framework.Context; | ||
import com.team766.hal.JoystickReader; | ||
import com.team766.robot.reva.constants.InputConstants; | ||
import com.team766.robot.reva.mechanisms.Climber; | ||
import com.team766.robot.reva.mechanisms.Intake; | ||
import com.team766.robot.reva.mechanisms.Shooter; | ||
import com.team766.robot.reva.mechanisms.Shoulder; | ||
import com.team766.robot.reva.mechanisms.Shoulder.ShoulderPosition; | ||
|
||
public class BoxOpOI { | ||
private final JoystickReader gamepad; | ||
|
||
private final Shoulder shoulder; | ||
private final Intake intake; | ||
private final Shooter shooter; | ||
private final Climber climber; | ||
|
||
public BoxOpOI( | ||
JoystickReader gamepad, | ||
Shoulder shoulder, | ||
Intake intake, | ||
Shooter shooter, | ||
Climber climber) { | ||
this.gamepad = gamepad; | ||
this.shoulder = shoulder; | ||
this.intake = intake; | ||
this.shooter = shooter; | ||
this.climber = climber; | ||
} | ||
|
||
public void handleOI(Context context) { | ||
|
||
// shoulder positions | ||
if (gamepad.getButtonPressed(InputConstants.XBOX_A)) { | ||
context.takeOwnership(shoulder); | ||
shoulder.rotate(ShoulderPosition.SHOOT_MEDIUM); | ||
context.releaseOwnership(shoulder); | ||
} else if (gamepad.getButtonPressed(InputConstants.XBOX_B)) { | ||
context.takeOwnership(shoulder); | ||
shoulder.rotate(ShoulderPosition.BOTTOM); | ||
context.releaseOwnership(shoulder); | ||
} else if (gamepad.getButtonPressed(InputConstants.XBOX_X)) { | ||
context.takeOwnership(shoulder); | ||
shoulder.rotate(ShoulderPosition.TOP); | ||
context.releaseOwnership(shoulder); | ||
} else if (gamepad.getButtonPressed(InputConstants.XBOX_Y)) { | ||
context.takeOwnership(shoulder); | ||
shoulder.rotate(ShoulderPosition.SHOOT_LOW); | ||
context.releaseOwnership(shoulder); | ||
} | ||
|
||
// dpad | ||
// shoulder up 5 | ||
if (gamepad.getPOV() == 0) { | ||
context.takeOwnership(shoulder); | ||
shoulder.nudgeUp(); | ||
context.releaseOwnership(shoulder); | ||
} | ||
|
||
if (gamepad.getPOV() == 180) { | ||
context.takeOwnership(shoulder); | ||
shoulder.nudgeDown(); | ||
context.releaseOwnership(shoulder); | ||
} | ||
|
||
if (gamepad.getPOV() == 90) { | ||
context.takeOwnership(climber); | ||
// climber down method | ||
context.releaseOwnership(climber); | ||
} | ||
|
||
if (gamepad.getPOV() == 360) { | ||
context.takeOwnership(climber); | ||
// climber up method | ||
context.releaseOwnership(climber); | ||
} | ||
|
||
// shooter | ||
if (gamepad.getAxis(InputConstants.XBOX_RT) > 0) { | ||
context.takeOwnership(shooter); | ||
shooter.shoot(); | ||
context.releaseOwnership(shooter); | ||
} else { | ||
context.takeOwnership(shooter); | ||
shooter.stop(); | ||
context.releaseOwnership(shooter); | ||
} | ||
|
||
// intake | ||
if (gamepad.getButton(InputConstants.XBOX_RB)) { | ||
context.takeOwnership(intake); | ||
intake.out(); | ||
context.releaseOwnership(intake); | ||
} else if (gamepad.getButton(InputConstants.XBOX_LB)) { | ||
context.takeOwnership(intake); | ||
intake.in(); | ||
context.releaseOwnership(intake); | ||
} else { | ||
context.takeOwnership(intake); | ||
intake.stop(); | ||
context.releaseOwnership(intake); | ||
} | ||
} | ||
} |
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
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
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