Exemple #1
0
 public void setCliffElevation() {
   cliffElevation.setTargetPosition((int) (climberTheta * ticksPerDegree));
   if (cliffRelaxDelay < System.nanoTime() && cliffRelaxDelay > 0) {
     cliffRelaxDelay = 0;
     cliffElevation.setPower(0);
   }
 }
  @Override
  public void init() {
    // Treads.
    rightTread = hardwareMap.dcMotor.get("rightTread");
    leftTread = hardwareMap.dcMotor.get("leftTread");

    leftTread.setDirection(DcMotor.Direction.REVERSE);

    rightTread.setMode(DcMotor.RunMode.RUN_USING_ENCODERS);
    leftTread.setMode(DcMotor.RunMode.RUN_USING_ENCODERS);

    // Servos.
    rightPusher = hardwareMap.servo.get("rightPusher");
    leftPusher = hardwareMap.servo.get("leftPusher");
    rightBumper = hardwareMap.servo.get("rightBumper");
    leftBumper = hardwareMap.servo.get("leftBumper");
    climber = hardwareMap.servo.get("climber");

    rightPusher.setPosition(NeverlandServoConstants.RIGHT_PUSHER_STOWED);
    leftPusher.setPosition(NeverlandServoConstants.LEFT_PUSHER_STOWED);
    rightBumper.setPosition(NeverlandServoConstants.RIGHT_BUMPER_DOWN);
    leftBumper.setPosition(NeverlandServoConstants.LEFT_BUMPER_DOWN);
    climber.setPosition(NeverlandServoConstants.CLIMBER_STORE);

    // Beacon arms.
    BeaconArms beacon = new BeaconArms(rightPusher, leftPusher, true);
  }
  @Override
  public void loop() {

    loopctr++;
    motorR();
    // tpos=rightmotor.getTargetPosition();
    // curpos=rightmotor.getCurrentPosition();
    // togo=tpos-curpos;
    telemetry.addData("left mode", leftmotor.getMode());
    telemetry.addData("lf pos", leftmotor.getCurrentPosition());
    telemetry.addData("lf to", leftmotor.getTargetPosition());
    /*if (togo<=0)
    {
       if (runagain==true)
       {
        resetEncode();
        rightPos=800;
        leftPos=800;
        run1();
        runagain=false;
        run3rd=true;
       }
        if (run3rd==true)
        {
            resetEncode();
            rightPos=6625;
            leftPos=-6625;
            run1();
            run3rd=false;
        }
    }*/
  } // end of loop
 @Override
 public void init() {
   leftmotor = hardwareMap.dcMotor.get("motor1a");
   rightmotor = hardwareMap.dcMotor.get("motor1b");
   mc1 = hardwareMap.dcMotorController.get("m1");
   devmodeRO = DcMotorController.DeviceMode.READ_ONLY;
   devmodeWO = DcMotorController.DeviceMode.WRITE_ONLY;
   leftmotor.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
   rightmotor.setMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
   resetEncode();
   motorW();
   leftmotor.setMode(DcMotorController.RunMode.RUN_TO_POSITION);
   rightmotor.setMode(DcMotorController.RunMode.RUN_TO_POSITION);
   rightPos = 172;
   leftPos = -172;
   run1();
   /*leftmotor.setPower(0);
   //rightmotor.setPower(0);
   motorR();
   while (rightmotor.getPower() !=0 ){
      // telemetry.addData("rt togo", togo);
       telemetry.addData("lf pos", leftmotor.getCurrentPosition());
   }
   resetEncode();
   rightPos=800;
   leftPos=800;
   run1();*/
 }
  @Override
  public void loop() {
    double rightDrive;
    double leftDrive;

    rightDrive = -gamepad1.right_stick_y;
    leftDrive = -gamepad1.left_stick_y;
    if (gamepad1.dpad_up) {
      rightDrive = 0.3;
      leftDrive = 0.3;
    } else if (gamepad1.dpad_down) {
      rightDrive = -0.3;
      leftDrive = -0.3;
    } else if (gamepad1.dpad_right) {
      rightDrive = -0.3;
      leftDrive = 0.3;
    } else if (gamepad1.dpad_left) {
      rightDrive = 0.3;
      leftDrive = -0.3;
    }
    motorRight.setPower(rightDrive);
    motorLeft.setPower(leftDrive);

    if (gamepad1.a) {
      servoClimberDumper.setPosition(1.0);
    } else {
      servoClimberDumper.setPosition(0.0);
    }

    telemetry.addData("trackLifter", Integer.toString(trackLifter.getCurrentPosition()));
    telemetry.addData("liftCheck", liftCheck.isPressed());
    telemetry.addData("ENCLeft", Integer.toString(motorLeft.getCurrentPosition()));
    telemetry.addData("ENCRight", Integer.toString(motorRight.getCurrentPosition()));
    telemetry.addData("trigger", gamepad1.right_trigger);
  }
  /*
   * Code to run when the op mode is first enabled goes here
   *
   * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#start()
   */
  @Override
  public void init() {

    /*
     *
     */
    motorFrontLeft = hardwareMap.dcMotor.get("frontleft"); // port1 left
    motorFrontRight = hardwareMap.dcMotor.get("frontright"); // port1 right
    motorBackLeft = hardwareMap.dcMotor.get("backleft"); // port2 left11a
    motorBackRight = hardwareMap.dcMotor.get("backright"); // port2 right
    set_drive_power(0, 0);
    motorFrontRight.setDirection(DcMotor.Direction.REVERSE);
    motorBackRight.setDirection(DcMotor.Direction.REVERSE);
    v_sensor_ods = hardwareMap.opticalDistanceSensor.get("distanceSensor");
    v_sensor_ods.enableLed(true);

    // rightbaseservo = hardwareMap.servo.get("rightbase"); //port1
    // leftbaseservo = hardwareMap.servo.get("leftbase"); //port6
    // rightmidservo = hardwareMap.servo.get("rightmid"); //port3
    // leftmidservo = hardwareMap.servo.get("leftmid"); //port5
    // gripper = hardwareMap.servo.get("gripper"); //port2

    // rightmidservo.setDirection(Servo.Direction.REVERSE);
    // rightbaseservo.setDirection(Servo.Direction.REVERSE);
    // calls=0;
    // winch = hardwareMap.servo.get("winch");

    // winch.setPosition(0.5);

  }
  @Override
  public void init() {
    leftMotor = hardwareMap.dcMotor.get("left_drive");
    rightMotor = hardwareMap.dcMotor.get("right_drive");

    navx_device =
        AHRS.getInstance(
            hardwareMap.deviceInterfaceModule.get("dim"),
            NAVX_DIM_I2C_PORT,
            AHRS.DeviceDataType.kProcessedData,
            NAVX_DEVICE_UPDATE_RATE_HZ);

    rightMotor.setDirection(DcMotor.Direction.REVERSE);

    /* If possible, use encoders when driving, as it results in more */
    /* predictable drive system response.                           */
    leftMotor.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);
    rightMotor.setChannelMode(DcMotorController.RunMode.RUN_USING_ENCODERS);

    /* Create a PID Controller which uses the Yaw Angle as input. */
    yawPIDController =
        new navXPIDController(navx_device, navXPIDController.navXTimestampedDataSource.YAW);

    /* Configure the PID controller */
    yawPIDController.setSetpoint(TARGET_ANGLE_DEGREES);
    yawPIDController.setContinuous(true);
    yawPIDController.setOutputRange(MIN_MOTOR_OUTPUT_VALUE, MAX_MOTOR_OUTPUT_VALUE);
    yawPIDController.setTolerance(navXPIDController.ToleranceType.ABSOLUTE, TOLERANCE_DEGREES);
    yawPIDController.setPID(YAW_PID_P, YAW_PID_I, YAW_PID_D);
    yawPIDController.enable(true);

    first_iteration = true;
  }
    private void a() {
      Iterator var1 = this.hardwareMap.servoController.iterator();

      while (var1.hasNext()) {
        ServoController var2 = (ServoController) var1.next();
        var2.pwmDisable();
      }

      var1 = this.hardwareMap.dcMotorController.iterator();

      while (var1.hasNext()) {
        DcMotorController var3 = (DcMotorController) var1.next();
        var3.setMotorControllerDeviceMode(DeviceMode.WRITE_ONLY);
      }

      var1 = this.hardwareMap.dcMotor.iterator();

      while (var1.hasNext()) {
        DcMotor var4 = (DcMotor) var1.next();
        var4.setPower(0.0D);
        var4.setChannelMode(RunMode.RUN_WITHOUT_ENCODERS);
      }

      var1 = this.hardwareMap.lightSensor.iterator();

      while (var1.hasNext()) {
        LightSensor var5 = (LightSensor) var1.next();
        var5.enableLed(false);
      }
    }
Exemple #9
0
  public void moveForwardToWall(double pow, int timeout) throws InterruptedException {
    double angle = Math.abs(sensor.getGyroYaw());
    double startAngle = angle;

    double power = pow;

    ElapsedTime time = new ElapsedTime();
    time.startTime();
    while (Math.abs(angle - startAngle) < 10 && time.milliseconds() < timeout) {
      angle = Math.abs(sensor.getGyroYaw());
      opMode.telemetry.addData("LeftPower", motorBL.getPower());
      opMode.telemetry.addData("RightPower", motorBR.getPower());
      opMode.telemetry.update();

      if (angle < startAngle - 1) {
        startMotors((power * .75), power);
      } else if (angle > startAngle + 1) {
        startMotors(power, (power * .75));
      } else {
        startMotors(power, power);
      }

      opMode.idle();
    }

    stopMotors();

    angleError = sensor.getGyroYaw();
    opMode.telemetry.update();
  }
Exemple #10
0
  public void moveFowardToLine(double ri, double le, int timeout) throws InterruptedException {
    double angle;
    double startAngle = Math.abs(sensor.getGyroYaw());
    opMode.telemetry.update();

    setNullValue();
    ElapsedTime time = new ElapsedTime();
    time.startTime();

    while (!sensor.isLeftLine() && time.milliseconds() < timeout) {
      angle = Math.abs(sensor.getGyroYaw());

      opMode.telemetry.addData("LeftPower", motorBL.getPower());
      opMode.telemetry.addData("RightPower", motorBR.getPower());
      opMode.telemetry.update();

      //            if(angle < startAngle - 2) {
      //                startMotors((power * .75), power);
      //            } else if(angle > startAngle + 2) {
      //                startMotors(power, (power * .75));
      //            } else {
      //                startMotors(power, power);
      //            }

      startMotors(ri, le);
      opMode.idle();
    }
    stopMotors();
    opMode.telemetry.update();
    angleError = sensor.getGyroYaw();
  }
Exemple #11
0
 public int getEncoderAvg() {
   return ((Math.abs(motorBR.getCurrentPosition()))
           + (Math.abs(motorBL.getCurrentPosition()))
           + (Math.abs(motorFR.getCurrentPosition()))
           + (Math.abs(motorFL.getCurrentPosition())))
       / 4;
 }
Exemple #12
0
 private void lift(double power) {
   try {
     liftLeft.setPower(power);
     liftRight.setPower(power);
   } catch (Exception ex) {
   }
 }
Exemple #13
0
 @Override
 public void loop() {
   if (this.time < 6.5d) {
     goForward(-1.0);
   } else if (this.time < 8.0d) {
     turnRight(1.0);
   } else if (this.time < 11d) {
     goForward(-1.0);
   } else if (this.time < 14d) {
     turnRight(1.0);
     armUp = true;
     motorArm.setPower(0.5);
     if (this.time > 11.2d) {
       motorArm.setPower(0.1);
     }
   } else if (this.time < 16) {
     goForward(1.0);
     motorSlide.setPower(1.0);
   } else if (this.time < 18) {
     stopMotors();
     motorSlide.setPower(0.0);
     forwardBack.setPosition(0.75);
   } else if (this.time < 22) {
     motorSlide.setPower(-1.0);
     forwardBack.setPosition(0.5);
   }
   telemetry.addData("Text", "*** Robot Data***");
   telemetry.addData("..", "time: " + String.format("%.2f", this.time));
 }
Exemple #14
0
  @Override
  public void init() {
    /* Assigns DcMotor objects to physical motors
    using Hardware Mapping */
    lbMotor = hardwareMap.dcMotor.get("lbMotor");
    lfMotor = hardwareMap.dcMotor.get("lfMotor");
    rfMotor = hardwareMap.dcMotor.get("rfMotor");
    rbMotor = hardwareMap.dcMotor.get("rbMotor");
    hangRotateMotor = hardwareMap.dcMotor.get("hangRotateMotor");
    hangSlideMotor = hardwareMap.dcMotor.get("hangSlideMotor");
    armMotor = hardwareMap.dcMotor.get("armMotor");

    /* Assigns Servo objects to physical servos
    using Hardware Mapping */
    climber = hardwareMap.servo.get("climber");
    rSwitch = hardwareMap.servo.get("rSwitch");
    lSwitch = hardwareMap.servo.get("lSwitch");

    /* resets Servo positions */
    climber.setPosition(CLIMBER_DOWN_POSITION);
    rSwitch.setPosition(RSWITCH_CLOSED_POSITION);
    lSwitch.setPosition(LSWITCH_CLOSED_POSITION);

    /* runs backward motors in opposite direction */
    lfMotor.setDirection(DcMotor.Direction.REVERSE);
    lbMotor.setDirection(DcMotor.Direction.REVERSE);

    telemetry.addData("init complete", "");
  }
Exemple #15
0
  @Override
  public void loop() {
    telemetry.addData("rightEncoder = ", motorRight.getCurrentPosition());
    if (motorRight.getCurrentPosition() <= -5000) {

      if (finishedForward) {

        finishedForward = false;
        finishedTurning = true;
        telemetry.addData("I did it!", motorRight.getCurrentPosition());

        //   wait(waitValue);

        newValue = motorRight.getCurrentPosition() - 250;

        motorRight.setTargetPosition(-newValue);
        motorRight.setPower(.50);
        motorLeft.setPower(-.50);
      }
    }

    if (motorRight.getCurrentPosition() <= -newValue) {

      if (finishedTurning) {

        finishedTurning = false;

        motorRight.setPower(0);
        motorLeft.setPower(0);
      }
    }
  }
  @Override
  public void loop() {
    /* reset the navX-Model device yaw angle so that whatever direction */
    /* it is currently pointing will be zero degrees.                   */
    if (first_iteration) {
      first_iteration = false;
      navx_device.zeroYaw();
      yawPIDResult = new navXPIDController.PIDResult();
    }

    /* Wait for new Yaw PID output values, then update the motors
      with the new PID value with each new output value.
    */

    /* Drive straight forward at 1/2 of full drive speed */
    double drive_speed = 0.5;

    if (yawPIDController.isNewUpdateAvailable(yawPIDResult)) {
      if (yawPIDResult.isOnTarget()) {
        leftMotor.setPower(drive_speed);
        rightMotor.setPower(drive_speed);
      } else {
        double output = yawPIDResult.getOutput();
        leftMotor.setPower(drive_speed + output);
        rightMotor.setPower(drive_speed - output);
      }
    } else {
      /* No sensor update has been received since the last time  */
      /* the loop() function was invoked.  Therefore, there's no */
      /* need to update the motors at this time.                 */
    }
  }
Exemple #17
0
  // ****************INITIALIZE METHOD****************//
  public void initializeMapping() {
    // Debug statements to prevent color1 error
    telemetry.addData("Version", "Sensorless. COLOR ERROR SHOULD NOT SHOW UP!");
    // Driving Mapping
    motorLeftTread = hardwareMap.dcMotor.get("m1");
    motorRightTread = hardwareMap.dcMotor.get("m2");
    motorLeftSecondTread = hardwareMap.dcMotor.get("m3");
    motorRightSecondTread = hardwareMap.dcMotor.get("m4");

    // Sensors
    // sensorRGB_1 = hardwareMap.colorSensor.get("color");

    // Other Mapping
    motorHangingMech = hardwareMap.dcMotor.get("m5");
    srvoHang_1 = hardwareMap.servo.get("s1");
    srvoHang_2 = hardwareMap.servo.get("s2");
    /*srvoDong_Left = hardwareMap.servo.get("s3"); //The left servo
    srvoDong_Right = hardwareMap.servo.get("s4"); //The right servo
    srvoPushButton = hardwareMap.servo.get("s5");
    srvoScoreClimbers = hardwareMap.servo.get("s6");*/

    // set the direction of the motors
    motorRightTread.setDirection(DcMotor.Direction.REVERSE);
    motorRightSecondTread.setDirection(DcMotor.Direction.REVERSE);

    telemetry.addData("Version", "non autonomous. COLOR ERROR SHOULD NOT SHOW UP!");
  }
  /**
   * This method does all of the things required to make each side of the robot move forward by the
   * given amounts. Seriously, It changes the channelMode, It calculates the pulse counts
   * Everything! If you understand java and can't use this, you don't deserve to!
   */
  public void measuredDrive(double Rdist, double Ldist) {

    double frrot = Rdist / frontCirc;
    double flrot = Ldist / frontCirc;
    double rPow = .5, lPow = .5;

    leftMotorf.setTargetPosition((int) flrot * pulsePerRot);
    rightMotorf.setTargetPosition((int) frrot * pulsePerRot);

    if (!encodersEnabled) {
      enableEncoders(true);
    }

    if (Rdist < 0) {
      rPow = -rPow;
    } else if (Rdist == 0) {
      rPow = 0;
    }
    if (Ldist < 0) {
      lPow = -lPow;
    } else if (Ldist == 0) {
      lPow = 0;
    }

    leftMotorf.setPower(frontRatio * lPow);
    rightMotorf.setPower(frontRatio * rPow);
  }
 @Override
 public void stop(RobotContext ctx, LinkedList<Object> out) throws Exception {
   driveForwardLeft.setPower(0);
   driveForwardRight.setPower(0);
   driveRearRight.setPower(0);
   driveRearRight.setPower(0);
 }
  @Override
  public void loop() {

    // Gamepad 1 - Drive Controller

    float rightDriveMotorSpeed = -gamepad1.right_stick_y;
    float leftDriveMotorSpeed = -gamepad1.left_stick_y;

    rightDriveMotorSpeed = Range.clip(rightDriveMotorSpeed, -1, 1);
    leftDriveMotorSpeed = Range.clip(leftDriveMotorSpeed, -1, 1);

    rightDriveMotorSpeed = (float) scaleInput(rightDriveMotorSpeed);
    leftDriveMotorSpeed = (float) scaleInput(leftDriveMotorSpeed);
    System.out.println(rightDriveMotorSpeed);

    driveRight.setPower(rightDriveMotorSpeed);
    driveLeft.setPower(leftDriveMotorSpeed);

    if (gamepad1.a & hookServoClick == 0) {
      hookServoPosition -= hookServoDelta;
      System.out.println(hookServoPosition);
      hookServoClick = 1;
      hookServo.setPosition(hookServoPosition);
    }

    if (gamepad1.a & hookServoClick == 1) {
      hookServoPosition += hookServoDelta;
      System.out.println(hookServoPosition);
      hookServoClick = 0;
      hookServo.setPosition(hookServoPosition);
    }

    if (gamepad1.x & triggerServoClick == 0) {
      triggerServoPosition -= triggerServoDelta;
      System.out.println(triggerServoPosition);
      triggerServoClick = 1;
      triggerServo.setPosition(triggerServoPosition);
    }

    if (gamepad1.x & triggerServoClick == 1) {
      triggerServoPosition += triggerServoDelta;
      System.out.println(triggerServoPosition);
      triggerServoClick = 0;
      triggerServo.setPosition(triggerServoPosition);
    }

    // Gamepad 2

    float armStage1MotorSpeed = -gamepad2.right_stick_y;
    float armStage2MotorSpeed = -gamepad2.left_stick_y;

    armStage1MotorSpeed = Range.clip(armStage1MotorSpeed, -1, 1);
    armStage2MotorSpeed = Range.clip(armStage2MotorSpeed, -1, 1);

    armStage1MotorSpeed = (float) scaleInput(armStage1MotorSpeed);
    armStage2MotorSpeed = (float) scaleInput(armStage2MotorSpeed);

    armStage1.setPower(armStage1MotorSpeed);
    armStage2.setPower(armStage2MotorSpeed);
  }
 public void rest() {
   fr.setPower(0);
   fl.setPower(0);
   bl.setPower(0);
   br.setPower(0);
   collector.setPower(0);
 }
  /*
   * This method will be called repeatedly in a loop
   *
   * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#run()
   */
  @Override
  public void loop() {
    double reflection = 0.0;
    double left, right = 0.0;

    // keep manipulator out of the way.
    arm.setPosition(armPosition);
    claw.setPosition(clawPosition);

    /*
     * Use the 'time' variable of this op mode to determine
     * how to adjust the motor power.
     */
    if (this.time <= 1) {
      // from 0 to 1 seconds, run the motors for five seconds.
      left = 0.15;
      right = 0.15;
    } else if (this.time > 5 && this.time <= 8.5) {
      // between 5 and 8.5 seconds, point turn right.
      left = 0.15;
      right = -0.15;
    } else if (this.time > 8.5 && this.time <= 15) {
      // between 8 and 15 seconds, idle.
      left = 0.0;
      right = 0.0;
    } else if (this.time > 15d && this.time <= 20.75d) {
      // between 15 and 20.75 seconds, point turn left.
      left = -0.15;
      right = 0.15;
    } else {
      // after 20.75 seconds, stop.
      left = 0.0;
      right = 0.0;
    }

    /*
     * set the motor power
     */
    motorRight.setPower(left);
    motorLeft.setPower(right);

    /*
     * read the light sensor.
     */
    // reflection = reflectedLight.getLightLevel();

    /*
     * Send telemetry data back to driver station. Note that if we are using
     * a legacy NXT-compatible motor controller, then the getPower() method
     * will return a null value. The legacy NXT-compatible motor controllers
     * are currently write only.
     */

    telemetry.addData("Text", "*** Robot Data***");
    telemetry.addData("time", "elapsed time: " + Double.toString(this.time));
    telemetry.addData("reflection", "reflection:  " + Double.toString(reflection));
    telemetry.addData("left tgt pwr", "left  pwr: " + Double.toString(left));
    telemetry.addData("right tgt pwr", "right pwr: " + Double.toString(right));
  }
  /*
   * This method will be called repeatedly in a loop
   *
   * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#run()
   */
  @Override
  public void loop() {

    /*
     * Gamepad 1
     *
     * Gamepad 1 controls the motors via the left stick, and it controls the
     * wrist/claw via the a,b, x, y buttons
     */

    // throttle: left_stick_y ranges from -1 to 1, where -1 is full up, and
    // 1 is full down
    // direction: left_stick_x ranges from -1 to 1, where -1 is full left
    // and 1 is full right
    float left_throttle = -gamepad1.left_stick_y;
    float right_throttle = -gamepad1.right_stick_y;

    // scale the joystick value to make it easier to control
    // the robot more precisely at slower speeds.
    left_throttle = (float) scaleInput(left_throttle);
    right_throttle = (float) scaleInput(right_throttle);

    // write the values to the motors
    front_right.setPower(right_throttle);
    back_right.setPower(right_throttle);
    front_left.setPower(left_throttle);
    back_left.setPower(left_throttle);

    // update the position of the arm.
    if (gamepad1.y) {
      // if the A button is pushed on gamepad1, increment the position of
      // the arm servo.
      spinnerPosition += spinnerDelta;
    }

    if (gamepad1.a) {
      // if the Y button is pushed on gamepad1, decrease the position of
      // the arm servo.
      spinnerPosition -= spinnerDelta;
    }

    // clip the position values so that they never exceed their allowed range.
    spinnerPosition = Range.clip(spinnerPosition, 0.0, 1.0);

    // write position values to the wrist and claw servo
    spinner.setPosition(spinnerPosition);

    /*
     * Send telemetry data back to driver station. Note that if we are using
     * a legacy NXT-compatible motor controller, then the getPower() method
     * will return a null value. The legacy NXT-compatible motor controllers
     * are currently write only.
     */
    telemetry.addData("Text", "*** Robot Data***");
    telemetry.addData("arm", "arm:  " + String.format("%.2f", armPosition));
    telemetry.addData("claw", "claw:  " + String.format("%.2f", clawPosition));
    telemetry.addData("left tgt pwr", "left  pwr: " + String.format("%.2f", left));
    telemetry.addData("right tgt pwr", "right pwr: " + String.format("%.2f", right));
  }
Exemple #24
0
  private void tankDrive(double leftY, double rightY) throws InterruptedException {
    rightY = -rightY; // flip the power of the right side

    leftfrontMotor.setPower(leftY); // set the according power to each motor
    leftbackMotor.setPower(leftY);
    rightfrontMotor.setPower(rightY);
    rightbackMotor.setPower(rightY);
  }
 /**
  * Applies power to lift motors based on value in {@code double direction, angle} set in {@link
  * DriverStation#getNextDrivesysCmd()}.
  *
  * @param driverCommand {@link DriverCommand} object with values.
  */
 public void applyCmd(DriverCommand driverCommand) {
   if (liftArmLengthMotorAvailable) {
     liftArmLengthMotor.setPower(driverCommand.linliftcmd.armLength);
   }
   if (liftAngleMotorAvailable) {
     liftAngleMotor.setPower(driverCommand.linliftcmd.angle);
   }
 }
 public void resetEncode() {
   motorW();
   leftmotor.setMode(DcMotorController.RunMode.RESET_ENCODERS);
   rightmotor.setMode(DcMotorController.RunMode.RESET_ENCODERS);
   motorR();
   while (leftmotor.getCurrentPosition() != 0) {}
   return;
 }
  @Override
  public void init_loop() {
    // Reverses the Right Wheel
    driveRight.setDirection(DcMotor.Direction.REVERSE);

    // Sets motors to run without incoders
    driveLeft.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
    driveRight.setChannelMode(DcMotorController.RunMode.RUN_WITHOUT_ENCODERS);
  }
  public void getEncoderValues() {
    telemetry.addData("motorBL", motorBL.getCurrentPosition());

    telemetry.addData("motorFR", motorFR.getCurrentPosition());

    telemetry.addData("motorBR", motorBR.getCurrentPosition());

    telemetry.addData("motorFL", motorFL.getCurrentPosition());
  }
 @Override
 public void init() {
   left1 = hardwareMap.dcMotor.get("motor1");
   right1 = hardwareMap.dcMotor.get("motor2");
   left2 = hardwareMap.dcMotor.get("motor3");
   right2 = hardwareMap.dcMotor.get("motor4");
   left1.setDirection(DcMotor.Direction.REVERSE);
   left2.setDirection(DcMotor.Direction.REVERSE);
 }
  /**
   * This method just sets the power of the Left and right motors to the provided values It also
   * scales the power to the front motors.
   */
  public void tankDrive(double leftVal, double rightVal) {

    if (encodersEnabled) {
      enableEncoders(false);
    }

    leftMotorf.setPower(frontRatio * leftVal);
    rightMotorf.setPower(frontRatio * rightVal);
  }