Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Collaborator

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.

Copy link
Collaborator

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

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add this functionality to BackupOpMode (needs aforementioned merge and rebase).

Copy link
Collaborator

Choose a reason for hiding this comment

The 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
Expand Down
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();
}
}