TeamCode/src/main/java/org/firstinspires/ftc/teamcode/StartDrive.java
/*
     * Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
     */
Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
@Override
    public void loop() 
    {
        flipper.defaultCommand(gamepad1, gamepad2);
        double leftPower;
        double rightPower;
        double drive =- gamepad1.left_stick_y;
        double turn  =  gamepad1.right_stick_x;
        double speedMultiplier;
        if (gamepad1.left_bumper) {
            speedMultiplier = 1;
        } else if (gamepad1.right_bumper) {
            speedMultiplier = 0.3;
        } else {
            speedMultiplier = 0.6;
        }
        double rotate = gamepad2.right_trigger;
        double Lift = gamepad2.left_stick_y;
        leftPower    = Range.clip(drive + turn, -1.0, 1.0) ;
        rightPower   = Range.clip(drive - turn, -1.0, 1.0) ;
        robot.leftFront.setPower(leftPower * speedMultiplier);
        robot.leftRear.setPower(leftPower * speedMultiplier);
        robot.rightRear.setPower(rightPower * speedMultiplier);
        robot.rightFront.setPower(rightPower * speedMultiplier);
        if (gamepad1.right_trigger >= 0.1)
                robot.Intake.setPower(1);
        if (gamepad1.left_trigger >= 0.1)
            robot.Intake.setPower(-1);
        else if (gamepad1.right_trigger < 0.1 && gamepad1.left_trigger < 0.1)
            robot.Intake.setPower(0);
        if (gamepad1.b) {
            robot.duck.setPower(.35);
        }
        if (gamepad1.x){
            robot.duck.setPower(-.8);
        }
        if (!gamepad1.b && !gamepad2.x) {
            robot.duck.setPower(0);
        }
        if(gamepad2.a) {
            box.Box.setPosition(BoxSubsystem.BOX_HIGH);
        }
        if(gamepad2.x){
            box.Box.setPosition(BoxSubsystem.BOX_DOWN);
        }
        if(gamepad2.b){
            box.Box.setPosition(BoxSubsystem.BOX_SHARED);
        }
        if(gamepad2.y) {
            box.Box.setPosition(BoxSubsystem.BOX_SHARED);
        }
        if (gamepad2.dpad_up){
            robot.slide.setPower(.8);
            robot.slide.setTargetPosition(-400);
        }
        if (gamepad2.dpad_down){
            robot.slide.setPower(-.8);
            robot.slide.setTargetPosition(0);
        }
            }
@ Override public void loop ( ) { flipper . defaultCommand ( gamepad1 , gamepad2 ) ; double leftPower ; double rightPower ; double drive = - gamepad1 . left_stick_y ; double turn = gamepad1 . right_stick_x ; double speedMultiplier ; if ( gamepad1 . left_bumper ) { speedMultiplier = 1 ; } else if ( gamepad1 . right_bumper ) { speedMultiplier = 0.3 ; } else { speedMultiplier = 0.6 ; } double rotate = gamepad2 . right_trigger ; double Lift = gamepad2 . left_stick_y ; leftPower = Range . clip ( drive + turn , - 1.0 , 1.0 ) ; rightPower = Range . clip ( drive - turn , - 1.0 , 1.0 ) ; robot . leftFront . setPower ( leftPower * speedMultiplier ) ; robot . leftRear . setPower ( leftPower * speedMultiplier ) ; robot . rightRear . setPower ( rightPower * speedMultiplier ) ; robot . rightFront . setPower ( rightPower * speedMultiplier ) ; if ( gamepad1 . right_trigger >= 0.1 ) robot . Intake . setPower ( 1 ) ; if ( gamepad1 . left_trigger >= 0.1 ) robot . Intake . setPower ( - 1 ) ; else if ( gamepad1 . right_trigger < 0.1 && gamepad1 . left_trigger < 0.1 ) robot . Intake . setPower ( 0 ) ; if ( gamepad1 . b ) { robot . duck . setPower ( .35 ) ; } if ( gamepad1 . x ) { robot . duck . setPower ( - .8 ) ; } if ( ! gamepad1 . b && ! gamepad2 . x ) { robot . duck . setPower ( 0 ) ; } if ( gamepad2 . a ) { box . Box . setPosition ( BoxSubsystem . BOX_HIGH ) ; } if ( gamepad2 . x ) { box . Box . setPosition ( BoxSubsystem . BOX_DOWN ) ; } if ( gamepad2 . b ) { box . Box . setPosition ( BoxSubsystem . BOX_SHARED ) ; } if ( gamepad2 . y ) { box . Box . setPosition ( BoxSubsystem . BOX_SHARED ) ; } if ( gamepad2 . dpad_up ) { robot . slide . setPower ( .8 ) ; robot . slide . setTargetPosition ( - 400 ) ; } if ( gamepad2 . dpad_down ) { robot . slide . setPower ( - .8 ) ; robot . slide . setTargetPosition ( 0 ) ; } }
Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
// DO all thecrap with all the arm and stuff //   arm.findArmPosition(gamepad1, gamepad2); // arm.loopCommand(); //Controls the speed of the bot //if the left bumper= fast, right bump= slow, if not keep it at normal //ArmPower = Range.clip(Lift, -0.2, 0.2) ; //right and left trigger control the intake //buttons control the carousel // flipper is right bumper //         if (gamepad2.right_bumper) { //             flipper.flipperServo.setPosition(-.9); //         } //         if (gamepad2.left_bumper) { //             flipper.flipperServo.setPosition(.5); //         } //         if (gamepad2.dpad_left){ //             flipper.flipperServo.setPosition(0); //         } // Box is buttons //        if (gamepad2.a) { //            box.Box.setPosition(.8); //        } //        if (gamepad2.x) { //            box.Box.setPosition(-1); //        } //        if (gamepad2.b){ //            box.Box.setPosition(.9); //        } // slide is dpad //        if (!gamepad2.dpad_up && !gamepad2.dpad_down){ //            robot.slide.setPower(0); //        }