-
Notifications
You must be signed in to change notification settings - Fork 0
Added Intake Subsystem #22
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,17 @@ | |
| import com.qualcomm.robotcore.eventloop.opmode.TeleOp; | ||
| import com.qualcomm.robotcore.hardware.HardwareMap; | ||
|
|
||
| import org.firstinspires.ftc.teamcode.commands.RunIntake; | ||
| import org.firstinspires.ftc.teamcode.commands.RunShooter; | ||
| import org.firstinspires.ftc.teamcode.subsystems.Intake; | ||
| import org.firstinspires.ftc.teamcode.subsystems.Shooter; | ||
|
|
||
| @TeleOp(name = "PrimaryOpMode", group= "NormalOpModes") | ||
| public class PrimaryOpMode extends OpMode { | ||
| private Motor fL, fR, bL, bR; | ||
| private MecanumDrive drive; | ||
| private Shooter shooter; | ||
| private Intake intake; | ||
| private GamepadEx driverOp; | ||
|
|
||
| private GamepadEx coOp; | ||
|
|
@@ -33,7 +36,10 @@ public void init() { | |
|
|
||
| shooter = new Shooter(hardwareMap, "shooterMotor"); | ||
|
|
||
| intake = new Intake(hardwareMap, "intakeMotor"); | ||
|
|
||
| coOp.getGamepadButton(GamepadKeys.Button.A).whileHeld(new RunShooter(shooter, 1)); | ||
| coOp.getGamepadButton(GamepadKeys.Button.B).whileHeld(new RunIntake(intake, 0.5)); | ||
|
Comment on lines
+39
to
+42
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also add this functionality to BackupOpMode (needs aforementioned merge and rebase).
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have not done this. If you resolve a comment without a fix comment as to why you are resolving |
||
| } | ||
|
|
||
| @Override | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package org.firstinspires.ftc.teamcode.commands; | ||
|
|
||
| import com.arcrobotics.ftclib.command.CommandBase; | ||
| import com.qualcomm.robotcore.hardware.HardwareMap; | ||
|
|
||
| import org.firstinspires.ftc.teamcode.subsystems.Intake; | ||
|
|
||
| public class RunIntake extends CommandBase { | ||
|
|
||
| private Intake subsystem; | ||
|
|
||
| private double speed; | ||
|
|
||
| public RunIntake(Intake _subsystem, double _speed) { | ||
| subsystem = _subsystem; | ||
| addRequirements(subsystem); | ||
| speed = _speed; | ||
| } | ||
|
|
||
| @Override | ||
| public void initialize() { | ||
| subsystem.run(speed); | ||
| } | ||
|
|
||
| @Override | ||
| public void end(boolean interrupted) { | ||
| subsystem.stop(); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package org.firstinspires.ftc.teamcode.subsystems; | ||
|
|
||
| import com.arcrobotics.ftclib.command.SubsystemBase; | ||
| import com.arcrobotics.ftclib.hardware.motors.Motor; | ||
| import com.qualcomm.robotcore.hardware.HardwareMap; | ||
|
|
||
| public class Intake extends SubsystemBase { | ||
| private Motor intakeMotor; | ||
|
|
||
| public Intake(HardwareMap map, String motorName) { | ||
| intakeMotor = new Motor(map, motorName); | ||
| intakeMotor.setRunMode(Motor.RunMode.RawPower); | ||
| } | ||
|
|
||
| public void run(double speed) { | ||
| double clampedSpeed = Math.max(-1.0, Math.min(1.0, speed)); | ||
| intakeMotor.set(clampedSpeed); | ||
| } | ||
|
|
||
| public void stop() { | ||
| intakeMotor.stopMotor(); | ||
| } | ||
| } |
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.
Get Nate to approve #17 and then rebase this branch against main and move all magic values (I.E. 1, "intakeMotor") to the Constants class.
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.
This has not been done or you have failed to push