Skip to content

Commit

Permalink
Milo is very picky
Browse files Browse the repository at this point in the history
  • Loading branch information
blazeboy75 committed Nov 26, 2021
1 parent 2b8920a commit 6fc583a
Showing 1 changed file with 22 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,10 @@
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
//import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.util.Range;

//import com.qualcomm.robotcore.eventloop.opmode.Disabled;
//import com.qualcomm.robotcore.eventloop.opmode.OpMode;
//import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
//import com.qualcomm.robotcore.hardware.DcMotor;
//import com.qualcomm.robotcore.hardware.DcMotorSimple;
//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.
Expand All @@ -56,8 +49,10 @@
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list. */


@TeleOp(name="Starter TeleOp", group="Iterative Opmode")


// @Disabled
public class StarterTeleOp extends OpMode
{
Expand All @@ -68,6 +63,8 @@ public class StarterTeleOp extends OpMode
private DcMotor backL = null;
private DcMotor backR = null;



/** Code to run ONCE when the driver hits INIT. */
@Override
public void init() {
Expand Down Expand Up @@ -100,17 +97,24 @@ public void init() {
telemetry.addData("Status", "Initialized");
}



/** 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 @@ -120,39 +124,49 @@ public void loop() {
double leftBPower ;
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. */
double drive = -gamepad1.right_stick_y;
double turn = gamepad1.right_stick_x;
double strafe = gamepad1.left_stick_x;



if (strafe !=0){
/** Untested on the robot. May need to be reversed or changed entirely. */
leftFPower = -strafe;
rightFPower = strafe;
leftBPower = strafe;
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 6fc583a

Please sign in to comment.