-
Notifications
You must be signed in to change notification settings - Fork 3
Componentization of the Launcher #116
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
kevinfrei
wants to merge
9
commits into
main
Choose a base branch
from
componentization
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
9 commits
Select commit
Hold shift + click to select a range
c470e2d
Trying some stuff to make the launcher a single-file component
kevinfrei 55433c3
Cranked through the codebase, and have most everything self-contained…
kevinfrei d158644
It's not a subsystem: It's a *component*.
kevinfrei 2ee2582
FeedFwd looks very complicated, but at the end of it...wrong?
kevinfrei 84aac4f
Did some fun stuff in the Launcher component. Going to try moving it …
kevinfrei 795f065
Getting Mouse working with the launcher component
kevinfrei 97fa7ab
LaunchComponent auto FeedForward opmode actually seems to be working
kevinfrei 524d9fd
Updated/trimmed LauncherComponent in Mouse
kevinfrei 97bc4e8
Untested additions to the whole power constants automatic thing
kevinfrei 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
589 changes: 589 additions & 0 deletions
589
LearnBot/src/main/java/org/firstinspires/ftc/learnbot/component/LauncherComponent.java
Large diffs are not rendered by default.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
LearnBot/src/main/java/org/firstinspires/ftc/learnbot/opmodes/LauncherValidator.java
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,76 @@ | ||
| package org.firstinspires.ftc.learnbot.opmodes; | ||
|
|
||
| import com.bylazar.configurables.annotations.Configurable; | ||
| import com.qualcomm.hardware.lynx.LynxModule; | ||
| import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
| import com.qualcomm.robotcore.eventloop.opmode.TeleOp; | ||
| import com.qualcomm.robotcore.hardware.DcMotorEx; | ||
| import com.technototes.library.hardware.motor.EncodedMotor; | ||
| import java.util.List; | ||
| import java.util.function.DoubleSupplier; | ||
| import org.firstinspires.ftc.learnbot.component.LauncherComponent; | ||
| import org.firstinspires.ftc.robotcore.external.navigation.VoltageUnit; | ||
|
|
||
| @Configurable | ||
| @SuppressWarnings("unused") | ||
| @TeleOp(name = "Launcher Cfg") | ||
| public class LauncherValidator extends LinearOpMode { | ||
|
|
||
| public static String MotorName = "rr"; | ||
|
|
||
| public boolean anyDpad() { | ||
| return ( | ||
| gamepad1.dpadUpWasReleased() || | ||
| gamepad1.dpadDownWasReleased() || | ||
| gamepad1.dpadLeftWasReleased() || | ||
| gamepad1.dpadRightWasReleased() | ||
| ); | ||
| } | ||
|
|
||
| public boolean anyButtons() { | ||
| return ( | ||
| gamepad1.aWasReleased() || | ||
| gamepad1.bWasReleased() || | ||
| gamepad1.xWasReleased() || | ||
| gamepad1.yWasReleased() | ||
| ); | ||
| } | ||
|
|
||
| @Override | ||
| public void runOpMode() throws InterruptedException { | ||
| // We need to get the voltage for | ||
| List<LynxModule> hubs = hardwareMap.getAll(LynxModule.class); | ||
| DoubleSupplier getVoltage = () -> { | ||
| double volts = 0; | ||
| for (LynxModule lm : hubs) { | ||
| volts += lm.getInputVoltage(VoltageUnit.VOLTS); | ||
| } | ||
| return volts / hubs.size(); | ||
| }; | ||
| EncodedMotor<DcMotorEx> m = new EncodedMotor<>( | ||
| hardwareMap.get(DcMotorEx.class, MotorName), | ||
| MotorName | ||
| ); | ||
| LauncherComponent lc = new LauncherComponent(m, null, getVoltage); | ||
| waitForStart(); | ||
| telemetry.addLine(">>> Press the dpad for feedfwd <<<"); | ||
| telemetry.addLine(">>> Press any button for validation <<<"); | ||
| telemetry.update(); | ||
| while (opModeIsActive()) { | ||
| if (anyDpad()) { | ||
| lc.feedFwdHelper(telemetry, gamepad1, this::opModeIsActive); | ||
| break; | ||
| } else if (anyButtons()) { | ||
| while (opModeIsActive() && !anyDpad()) { | ||
| telemetry.addLine(">>> Press left trigger for Launcher1 control"); | ||
| telemetry.addLine(">>> Press right trigger for Launcher2 control"); | ||
| telemetry.addLine(">>> Hit the dpad to stop"); | ||
| telemetry.addLine( | ||
| lc.hardwareValidation(gamepad1.left_trigger, gamepad1.right_trigger) | ||
| ); | ||
| telemetry.update(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
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
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
34 changes: 0 additions & 34 deletions
34
Sixteen750/src/main/java/org/firstinspires/ftc/sixteen750/commands/AltAutoVelocity.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure would be cool if this were available as part of the component (I should try it)