Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .run/BlueAllianceBackField MeepMeep.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BlueAllianceBackField MeepMeep" type="Application" factoryName="Application">
<configuration default="false" name="BlueAllianceBackField MeepMeep" type="Application" factoryName="Application" folderName="MeepMeep">
<option name="ALTERNATIVE_JRE_PATH" value="ms-17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.example.meepmeeptesting.BlueAllianceBackField" />
Expand Down
2 changes: 1 addition & 1 deletion .run/BlueAllianceMidField MeepMeep.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BlueAllianceMidField MeepMeep" type="Application" factoryName="Application">
<configuration default="false" name="BlueAllianceMidField MeepMeep" type="Application" factoryName="Application" folderName="MeepMeep">
<option name="ALTERNATIVE_JRE_PATH" value="ms-17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.example.meepmeeptesting.BlueAllianceMidField" />
Expand Down
2 changes: 1 addition & 1 deletion .run/RedAllianceBackField MeepMeep.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="RedAllianceBackField MeepMeep" type="Application" factoryName="Application">
<configuration default="false" name="RedAllianceBackField MeepMeep" type="Application" factoryName="Application" folderName="MeepMeep">
<option name="ALTERNATIVE_JRE_PATH" value="ms-17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.example.meepmeeptesting.RedAllianceBackField" />
Expand Down
2 changes: 1 addition & 1 deletion .run/RedAllianceMidField MeepMeep.run.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="RedAllianceMidField MeepMeep" type="Application" factoryName="Application">
<configuration default="false" name="RedAllianceMidField MeepMeep" type="Application" factoryName="Application" folderName="MeepMeep">
<option name="ALTERNATIVE_JRE_PATH" value="ms-17" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="MAIN_CLASS_NAME" value="com.example.meepmeeptesting.RedAllianceMidField" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
public class TeleOpMain extends LinearOpMode {

// Constructors for the utils classes
private final DriveControls drive;
private final LaunchControls launch;
private final RampControls ramp;

public TeleOpMain(HardwareMap hardwareMap) {
this.drive = new DriveControls(hardwareMap);
this.launch = new LaunchControls(hardwareMap);
this.ramp = new RampControls(hardwareMap);
}
private DriveControls drive;
private LaunchControls launch;
private RampControls ramp;


//This function is executed when this Op Mode is selected from the Driver Station
@Override
public void runOpMode() {
// Initialize the CommonControls class
// Create the utils classes
drive = new DriveControls(hardwareMap);
launch = new LaunchControls(hardwareMap);
ramp = new RampControls(hardwareMap);

// The waitForStart() function will wait for the start button to begin
// DON'T WRITE ANY CODE AFTER THE WAIT FOR START UNTIL THE "while (opModIsActive())"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,35 @@ public void setDrivePower(float controlLeftStickY) {
setDrivePower(controlLeftStickY, 0.0f, 0.0f, 0.0f);
}

// TODO: Create JavaDoc

// TODO: Write Unit test

/**
* Sets all of the drive motors' zero power behavior to BRAKE
*/
void setDriveBrake() {
motors.leftFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motors.rightFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motors.leftBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
motors.rightBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
}

// TODO: Create JavaDoc
/**
* Sets all of the drive motors' zero power behavior to FLOAT
*/
void setDriveFloat() {
motors.leftFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
motors.rightFront.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
motors.leftBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
motors.rightBack.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.FLOAT);
}

// TODO: Create JavaDoc
/**
* Function that allows for the driver to control the zero power behavior of the drive motors
* to either BRAKE or FLOAT float is the default if no input is given on the controller
*
* @param input Controller button input to determine if the motors should be in BRAKE or FLOAT
*/
public void setDriveMotorZeroPowerBehavior(boolean input) {
if (input) {
setDriveBrake();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;

/**
* Class holds motors and servos that are used throughout the code
*/
public class MotorConstructor {
/**
* Front left drive motor
Expand Down Expand Up @@ -50,7 +53,7 @@ public class MotorConstructor {
public CRServo rampServo3;
public CRServo rampServo4;

public MotorConstructor(HardwareMap hardwareMap){
public MotorConstructor(HardwareMap hardwareMap) {
// Map main Drive Motors
leftFront = hardwareMap.get(DcMotor.class, "leftFront");
rightFront = hardwareMap.get(DcMotor.class, "rightFront");
Expand All @@ -61,7 +64,7 @@ public MotorConstructor(HardwareMap hardwareMap){
intake = hardwareMap.get(DcMotor.class, "intake");

// Map the launcher Prototype
Launcher = hardwareMap.get(DcMotor.class, "Launcher");
Launcher = hardwareMap.get(DcMotor.class, "Launcher");
Launcher2 = hardwareMap.get(DcMotor.class, "Launcher2");

rampServo1 = hardwareMap.get(CRServo.class, "rampServo1");
Expand All @@ -75,6 +78,11 @@ public MotorConstructor(HardwareMap hardwareMap){
leftBack.setDirection(DcMotorSimple.Direction.FORWARD);
rightBack.setDirection(DcMotorSimple.Direction.REVERSE);

// Set the direction of the launcher motor
Launcher.setDirection(DcMotorSimple.Direction.REVERSE);
Launcher2.setDirection(DcMotorSimple.Direction.REVERSE);


// Set the direction of the intake motor
intake.setDirection(DcMotorSimple.Direction.REVERSE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
import com.qualcomm.robotcore.hardware.HardwareMap;

public class RampControls {
private final MotorConstructor motors;

public RampControls(HardwareMap hardwareMap) {
this.motors = new MotorConstructor(hardwareMap);
}

/**
* Controls the spin direction of the intake wheel based on controller buttons
*
* @param intakeForwardInput Button mapped to forward input
* @param intakeReverseInput Button mapped to reverse input
*/
private final MotorConstructor motors;

public RampControls(HardwareMap hardwareMap) {
this.motors = new MotorConstructor(hardwareMap);
}
public void setIntakeDirection(boolean intakeForwardInput, boolean intakeReverseInput) {
double intakePower = 0;
// ^ is the XOR operator, will return true if only one variable is true
Expand Down

This file was deleted.

Loading