Masters/src/main/java/org/firstinspires/ftc/masters/MecanumOpModeCopy.java
@Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();

        /* Initialize the hardware variables. Note that the strings used here as parameters
         * to 'get' must correspond to the names assigned during the robot configuration
         * step (using the FTC Robot Controller app on the phone).
         */
        leftFrontMotor = hardwareMap.dcMotor.get("motorFrontLeft");
        rightFrontMotor = hardwareMap.dcMotor.get("motorFrontRight");
        leftRearMotor = hardwareMap.dcMotor.get("motorBackLeft");
        rightRearMotor = hardwareMap.dcMotor.get("motorBackRight");

        // Set the drive motor direction:
        // "Reverse" the motor that runs backwards when connected directly to the battery
        // These polarities are for the Neverest 20 motors
        leftFrontMotor.setDirection(DcMotor.Direction.REVERSE);
        rightFrontMotor.setDirection(DcMotor.Direction.FORWARD);
        leftRearMotor.setDirection(DcMotor.Direction.REVERSE);
        rightRearMotor.setDirection(DcMotor.Direction.FORWARD);

        // Set the drive motor run modes:
        // "RUN_USING_ENCODER" causes the motor to try to run at the specified fraction of full velocity
        // Note: We were not able to make this run mode work until we switched Channel A and B encoder wiring into
        // the motor controllers. (Neverest Channel A connects to MR Channel B input, and vice versa.)
        leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        leftRearMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        rightRearMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

        // Wait for the game to start (driver presses PLAY)
        waitForStart();
        runtime.reset();

        // run until the end of the match (driver presses STOP)
        while (opModeIsActive()) {
            telemetry.addData("Status", "Run Time: " + runtime.toString());
            telemetry.update();

            // Reset speed variables
            LF = 0; RF = 0; LR = 0; RR = 0;

            // Get joystick values
            //Everyone sitting behind me is an idiot
            Y1 = -gamepad1.right_stick_y * joyScale; // invert so up is positive
            X1 = gamepad1.right_stick_x * joyScale;
            Y2 = -gamepad1.left_stick_y * joyScale; // Y2 is not used at present
            X2 = gamepad1.left_stick_x * joyScale;

            // Forward/back movement
            // The people behind me don't value my input
            LF += Y1; RF += Y1; LR += Y1; RR += Y1;

            // Side to Side movement
            LF += X1; RF -= X1; LR -= X1; RR += X1;

            // Rotation movement
            LF += X2; RF -= X2; LR += X2; RR -= X2;

            // Clip motor power values to +-motorMax
            LF = Math.max(-motorMax, Math.min(LF, motorMax)); //Not entirely sure what this does
            RF = Math.max(-motorMax, Math.min(RF, motorMax));
            LR = Math.max(-motorMax, Math.min(LR, motorMax));
            RR = Math.max(-motorMax, Math.min(RR, motorMax));

            // Send values to the motors
            leftFrontMotor.setPower(LF);
            rightFrontMotor.setPower(RF);
            leftRearMotor.setPower(LR);
            rightRearMotor.setPower(RR);

            // Send some useful parameters to the driver station
            telemetry.addData("LF", "%.3f", LF);
            telemetry.addData("RF", "%.3f", RF);
            telemetry.addData("LR", "%.3f", LR);
            telemetry.addData("RR", "%.3f", RR);
        }
    }
// Limit motor power to this value for Andymark RUN_USING_ENCODER mode
Limit motor power to this value for Andymark RUN_USING_ENCODER mode
Limit motor power to this value for Andymark RUN_USING_ENCODER mode
@Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();
        /* Initialize the hardware variables. Note that the strings used here as parameters
         * to 'get' must correspond to the names assigned during the robot configuration
         * step (using the FTC Robot Controller app on the phone).
         */
        leftFrontMotor = hardwareMap.dcMotor.get("motorFrontLeft");
        rightFrontMotor = hardwareMap.dcMotor.get("motorFrontRight");
        leftRearMotor = hardwareMap.dcMotor.get("motorBackLeft");
        rightRearMotor = hardwareMap.dcMotor.get("motorBackRight");
        leftFrontMotor.setDirection(DcMotor.Direction.REVERSE);
        rightFrontMotor.setDirection(DcMotor.Direction.FORWARD);
        leftRearMotor.setDirection(DcMotor.Direction.REVERSE);
        rightRearMotor.setDirection(DcMotor.Direction.FORWARD);
        leftFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        rightFrontMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        leftRearMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        rightRearMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
        waitForStart();
        runtime.reset();
        while (opModeIsActive()) {
            telemetry.addData("Status", "Run Time: " + runtime.toString());
            telemetry.update();
            LF = 0; RF = 0; LR = 0; RR = 0;
            Y1 = -gamepad1.right_stick_y * joyScale; 
            X1 = gamepad1.right_stick_x * joyScale;
            Y2 = -gamepad1.left_stick_y * joyScale; 
            X2 = gamepad1.left_stick_x * joyScale;
            LF += Y1; RF += Y1; LR += Y1; RR += Y1;
            LF += X1; RF -= X1; LR -= X1; RR += X1;
            LF += X2; RF -= X2; LR += X2; RR -= X2;
            LF = Math.max(-motorMax, Math.min(LF, motorMax)); 
            RF = Math.max(-motorMax, Math.min(RF, motorMax));
            LR = Math.max(-motorMax, Math.min(LR, motorMax));
            RR = Math.max(-motorMax, Math.min(RR, motorMax));
            leftFrontMotor.setPower(LF);
            rightFrontMotor.setPower(RF);
            leftRearMotor.setPower(LR);
            rightRearMotor.setPower(RR);
            telemetry.addData("LF", "%.3f", LF);
            telemetry.addData("RF", "%.3f", RF);
            telemetry.addData("LR", "%.3f", LR);
            telemetry.addData("RR", "%.3f", RR);
        }
    }
@ Override public void runOpMode ( ) { telemetry . addData ( "Status" , "Initialized" ) ; telemetry . update ( ) ; /* Initialize the hardware variables. Note that the strings used here as parameters
         * to 'get' must correspond to the names assigned during the robot configuration
         * step (using the FTC Robot Controller app on the phone).
         */ leftFrontMotor = hardwareMap . dcMotor . get ( "motorFrontLeft" ) ; rightFrontMotor = hardwareMap . dcMotor . get ( "motorFrontRight" ) ; leftRearMotor = hardwareMap . dcMotor . get ( "motorBackLeft" ) ; rightRearMotor = hardwareMap . dcMotor . get ( "motorBackRight" ) ; leftFrontMotor . setDirection ( DcMotor . Direction . REVERSE ) ; rightFrontMotor . setDirection ( DcMotor . Direction . FORWARD ) ; leftRearMotor . setDirection ( DcMotor . Direction . REVERSE ) ; rightRearMotor . setDirection ( DcMotor . Direction . FORWARD ) ; leftFrontMotor . setMode ( DcMotor . RunMode . RUN_USING_ENCODER ) ; rightFrontMotor . setMode ( DcMotor . RunMode . RUN_USING_ENCODER ) ; leftRearMotor . setMode ( DcMotor . RunMode . RUN_USING_ENCODER ) ; rightRearMotor . setMode ( DcMotor . RunMode . RUN_USING_ENCODER ) ; waitForStart ( ) ; runtime . reset ( ) ; while ( opModeIsActive ( ) ) { telemetry . addData ( "Status" , "Run Time: " + runtime . toString ( ) ) ; telemetry . update ( ) ; LF = 0 ; RF = 0 ; LR = 0 ; RR = 0 ; Y1 = - gamepad1 . right_stick_y * joyScale ; X1 = gamepad1 . right_stick_x * joyScale ; Y2 = - gamepad1 . left_stick_y * joyScale ; X2 = gamepad1 . left_stick_x * joyScale ; LF += Y1 ; RF += Y1 ; LR += Y1 ; RR += Y1 ; LF += X1 ; RF -= X1 ; LR -= X1 ; RR += X1 ; LF += X2 ; RF -= X2 ; LR += X2 ; RR -= X2 ; LF = Math . max ( - motorMax , Math . min ( LF , motorMax ) ) ; RF = Math . max ( - motorMax , Math . min ( RF , motorMax ) ) ; LR = Math . max ( - motorMax , Math . min ( LR , motorMax ) ) ; RR = Math . max ( - motorMax , Math . min ( RR , motorMax ) ) ; leftFrontMotor . setPower ( LF ) ; rightFrontMotor . setPower ( RF ) ; leftRearMotor . setPower ( LR ) ; rightRearMotor . setPower ( RR ) ; telemetry . addData ( "LF" , "%.3f" , LF ) ; telemetry . addData ( "RF" , "%.3f" , RF ) ; telemetry . addData ( "LR" , "%.3f" , LR ) ; telemetry . addData ( "RR" , "%.3f" , RR ) ; } }
Limit motor power to this value for Andymark RUN_USING_ENCODER mode
Limit motor power to this value for Andymark RUN_USING_ENCODER mode
// Set the drive motor direction: // "Reverse" the motor that runs backwards when connected directly to the battery // These polarities are for the Neverest 20 motors // Set the drive motor run modes: // "RUN_USING_ENCODER" causes the motor to try to run at the specified fraction of full velocity // Note: We were not able to make this run mode work until we switched Channel A and B encoder wiring into // the motor controllers. (Neverest Channel A connects to MR Channel B input, and vice versa.) // Wait for the game to start (driver presses PLAY) // run until the end of the match (driver presses STOP) // Reset speed variables // Get joystick values //Everyone sitting behind me is an idiot // invert so up is positive // Y2 is not used at present // Forward/back movement // The people behind me don't value my input // Side to Side movement // Rotation movement // Clip motor power values to +-motorMax //Not entirely sure what this does // Send values to the motors // Send some useful parameters to the driver station