Skip to content

Commit

Permalink
Did I mention youre picky?
Browse files Browse the repository at this point in the history
  • Loading branch information
blazeboy75 committed Nov 26, 2021
1 parent 6fc583a commit 520b0a6
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;



/** This file contains an example of an iterative (Non-Linear) "OpMode".
* An OpMode is a 'program' that runs in either the autonomous or the teleop period of an FTC match.
* The names of OpModes appear on the menu of the FTC Driver Station.
Expand Down Expand Up @@ -64,7 +62,6 @@ public class StarterTeleOp extends OpMode
private DcMotor backR = null;



/** Code to run ONCE when the driver hits INIT. */
@Override
public void init() {
Expand All @@ -78,14 +75,14 @@ public void init() {
backL = hardwareMap.get(DcMotor.class, "Back Left");
backR = hardwareMap.get(DcMotor.class, "Back Right");


/** Sets the motors to run using encoders. */
frontL.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
frontR.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
backL.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
backR.setMode(DcMotor.RunMode.RUN_USING_ENCODER);



/** Most robots need the motor on one side to be reversed to drive forward.
* Reverse the motor that runs backwards when connected directly to the battery. */
frontL.setDirection(DcMotor.Direction.FORWARD);
Expand All @@ -98,23 +95,19 @@ public void init() {
}



/** Code to run REPEATEDLY after the driver hits INIT, but before they hit PLAY. */
@Override
public void init_loop() {
}




/** Code to run ONCE when the driver hits PLAY. */
@Override
public void start() {
runtime.reset();
}



/** Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP. */
@Override
public void loop() {
Expand All @@ -125,7 +118,6 @@ public void loop() {
double rightBPower;



/**POV Mode uses right stick to go forward, and left stick to turn
* will be combined in later release.
* This uses basic math to combine motions and is easier to drive straight. */
Expand All @@ -134,7 +126,6 @@ public void loop() {
double strafe = gamepad1.left_stick_x;



if (strafe !=0){
/** Untested on the robot. May need to be reversed or changed entirely. */
leftFPower = -strafe;
Expand All @@ -143,30 +134,26 @@ public void loop() {
rightBPower = -strafe;
}


else if(drive !=0 || turn !=0) {
leftFPower = Range.clip(drive + turn, -1.0, 1.0);
rightFPower = Range.clip(drive - turn, -1.0, 1.0);
leftBPower = Range.clip(drive + turn, -1.0, 1.0);
rightBPower = Range.clip(drive - turn, -1.0, 1.0);
}


else{
leftFPower = 0;
rightFPower = 0;
leftBPower = 0;
rightBPower = 0;
}


/**Send calculated power to wheels. */
frontL.setPower(leftFPower);
backL.setPower(leftBPower);
frontR.setPower(rightFPower);
backR.setPower(rightBPower);


/** Show the elapsed game time and wheel power. */
telemetry.addData("Status", "Run Time: " + runtime.toString());
telemetry.addData("Motors", "left (%.2f), right (%.2f)", leftFPower, rightFPower);
Expand Down

0 comments on commit 520b0a6

Please sign in to comment.