package com.qualcomm.ftcrobotcontroller.opmodes;

import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;


/**
 * TODO Created by Quest Jelinek on 10/13/2015.
 * GitHub: TofuTheBland || https://github.com/TofuTheBland
 */
public class TeleOp extends OpMode {
    // TODO Initiate all variables
    DcMotor motor_leftFront; //Forward Left
    DcMotor motor_rightFront;
    DcMotor motor_leftBack; //Backward Left
    DcMotor motor_rightBack;
    Float driver_gamepad_x;
    Float driver_gamepad_y;


    @Override
    public void init() {
        // TODO Placeholder for hardware mapping, motor names may change
        motor_left = hardwareMap.dcMotor.get("motor_1");
        motor_right = hardwareMap.dcMotor.get("motor_2");

        //Added this for the lads
        driver_gamepad_x = gamepad1.left_stick_x;
        driver_gamepad_y = gamepad1.left_stick_y;
    }

    public void forward() {
        //For the method .setPower() pass a value from -1 to 1 (inc. 0)
        motor_left.setPower(1);
        motor_right.setPower(1);
    }
    public void backward() {
        //For the method .setPower() pass a value from -1 to 1 (inc. 0)
        motor_left.setPower(-1);
        motor_right.setPower(-1);
    }
    public void left() {
        //For the method .setPower() pass a value from -1 to 1 (inc. 0)
        motor_left.setPower(1);
        motor_right.setPower(-1);
    }

    public void right(){
        motor_left.setPower(-1);
        motor_left.setPower(1);
    }

    @Override
    public void loop() {

        if(driver_gamepad_y > 100) {forward();}
        else if (driver_gamepad_y < -100) {backward();}
        else if (driver_gamepad_x > 100) {left();}
        else if (driver_gamepad_x < -100) {right();}
        else {
            motor_left.setPower(0);
            motor_right.setPower(0);
        }
    }
}

//TODO Add a separate library for movement functions and add smoothing function

@@ -356,18 +356,9 @@
 otor
-_leftFront
+L
 ; //
@@ -391,93 +391,11 @@
 otor
-_rightFront;%0A    DcMotor motor_leftBack; //Backward Left%0A    DcMotor motor_rightBack;
+R;%0A
 %0A   
@@ -574,21 +574,17 @@
    motor
-_left
+L
  = hardw
@@ -612,10 +612,9 @@
 otor
-_1
+L
 %22);%0A
@@ -626,22 +626,17 @@
    motor
-_right
+R
  = hardw
@@ -664,10 +664,9 @@
 otor
-_2
+R
 %22);%0A
@@ -704,107 +704,8 @@
 ads%0A
-        driver_gamepad_x = gamepad1.left_stick_x;%0A        driver_gamepad_y = gamepad1.left_stick_y;
 %0A   
@@ -813,37 +813,33 @@
 0)%0A        motor
-_left
+L
 .setPower(1);%0A  
@@ -841,38 +841,33 @@
 );%0A        motor
-_right
+R
 .setPower(1);%0A  
@@ -976,37 +976,33 @@
 0)%0A        motor
-_left
+L
 .setPower(-1);%0A 
@@ -1005,38 +1005,33 @@
 );%0A        motor
-_right
+R
 .setPower(-1);%0A 
@@ -1137,37 +1137,33 @@
 0)%0A        motor
-_left
+L
 .setPower(1);%0A  
@@ -1165,38 +1165,33 @@
 );%0A        motor
-_right
+R
 .setPower(-1);%0A 
@@ -1226,37 +1226,33 @@
 )%7B%0A        motor
-_left
+L
 .setPower(-1);%0A 
@@ -1255,37 +1255,33 @@
 );%0A        motor
-_left
+R
 .setPower(1);%0A  
@@ -1323,16 +1323,116 @@
 loop() %7B
+%0A        driver_gamepad_x = gamepad1.left_stick_x;%0A        driver_gamepad_y = gamepad1.left_stick_y;
 %0A%0A      
@@ -1455,18 +1455,16 @@
 pad_y %3E 
-10
 0) %7Bforw
@@ -1507,19 +1507,16 @@
 pad_y %3C 
--10
 0) %7Bback
@@ -1560,18 +1560,16 @@
 pad_x %3E 
-10
 0) %7Bleft
@@ -1613,11 +1613,8 @@
 x %3C 
--10
 0) %7B
@@ -1659,13 +1659,9 @@
 otor
-_left
+L
 .set
@@ -1691,14 +1691,9 @@
 otor
-_right
+R
 .set

Update TeleOp.java