@Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();
        left_mtr = hardwareMap.dcMotor.get("left_mtr");
        right_mtr = hardwareMap.dcMotor.get("right_mtr");
        front_left_mtr = hardwareMap.dcMotor.get("front_left_mtr");
        front_right_mtr = hardwareMap.dcMotor.get("front_right_mtr");
        Shooter = hardwareMap.dcMotor.get("Shooter");
        Conveyor = hardwareMap.dcMotor.get("Conveyor");
        clow_moter = hardwareMap.dcMotor.get("clow moter");
        Claw = hardwareMap.servo.get("Claw");
        touchfront = hardwareMap.touchSensor.get("touchfront");
        touch2 = hardwareMap.touchSensor.get("touch2");
        // values is a reference to the hsvValues array.
        float[] hsvValues = new float[3];
        final float values[] = hsvValues;
        // bPrevState and bCurrState keep track of the previous and current state of the button
        boolean bPrevState = false;
        boolean bCurrState = false;
        String mode="";
        Claw.setPosition(0);
        right_mtr.setDirection(DcMotorSimple.Direction.REVERSE);
        right_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        left_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        front_right_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        front_left_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        clow_moter.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        right_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        left_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        front_right_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        front_left_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        initVuforia();
        initTfod();
        /**
         * Activate TensorFlow Object Detection before we wait for the start command.
         * Do it here so that the Camera Stream window will have the TensorFlow annotations visible.
         **/
        if (tfod != null) {
            tfod.activate();
            // The TensorFlow software will scale the input images from the camera to a lower resolution.
            // This can result in lower detection accuracy at longer distances (> 55cm or 22").
            // If your target is at distance greater than 50 cm (20") you can adjust the magnification value
            // to artificially zoom in to the center of image.  For best results, the "aspectRatio" argument
            // should be set to the value of the images used to create the TensorFlow Object Detection model
            // (typically 1.78 or 16/9).
            // Uncomment the following line if you want to adjust the magnification and/or the aspect ratio of the input images.
            //tfod.setZoom(2.5, 1.78);
        }
        /** Wait for the game to begin */
        telemetry.addData(">", "Press Play to start op mode");
        telemetry.update();
        waitForStart();
        if (opModeIsActive()) {
            halt();
            sleep(1000);
            turnRight(0.5);
            haltSequence(450);
            goForward(.5);
            haltSequence(150);
            turnLeft(.5);
            haltSequence(450);
            goForward(0.4);
            sleep(450);
            halt();
            sleep(1000);
            telemetry.addData("Status", "Started");
            telemetry.update();
            if (tfod != null) {
                // getUpdatedRecognitions() will return null if no new information is available since
                // the last time that call was made.
                List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions();
                if (updatedRecognitions != null) {
                    telemetry.addData("# Object Detected", updatedRecognitions.size());
                    if (updatedRecognitions.size() == 0) {
                        mode = "A";
                    }
                    // step through the list of recognitions and display boundary info.
                    int i = 0;
                    for (Recognition recognition : updatedRecognitions) {
                        telemetry.addData(String.format("label (%d)", i), recognition.getLabel());
                        if (recognition.getLabel() =="Quad"){
                            mode = "C";
                        } else {
                            mode = "B";
                        }
                        telemetry.addData(String.format("  left,top (%d)", i), "%.03f , %.03f",
                                recognition.getLeft(), recognition.getTop());
                        telemetry.addData(String.format("  right,bottom (%d)", i), "%.03f , %.03f",
                                recognition.getRight(), recognition.getBottom());
                    }
                    //telemetry.addData(String.format("Mode (%s)", mode), "");
                    telemetry.update();
                    sleep(2000);
                }
            }
        }
        // go somewhere based on mode
            if (mode == "A") {
                doModeA();
            } else if (mode == "B") {
                doModeB();
            } else if (mode == "C") {
                doModeC();
            } else {
                // not sure what to do here
            }
        if (tfod != null) {
             tfod.shutdown();
        }
    }
@Override
    public void runOpMode() {
        telemetry.addData("Status", "Initialized");
        telemetry.update();
        left_mtr = hardwareMap.dcMotor.get("left_mtr");
        right_mtr = hardwareMap.dcMotor.get("right_mtr");
        front_left_mtr = hardwareMap.dcMotor.get("front_left_mtr");
        front_right_mtr = hardwareMap.dcMotor.get("front_right_mtr");
        Shooter = hardwareMap.dcMotor.get("Shooter");
        Conveyor = hardwareMap.dcMotor.get("Conveyor");
        clow_moter = hardwareMap.dcMotor.get("clow moter");
        Claw = hardwareMap.servo.get("Claw");
        touchfront = hardwareMap.touchSensor.get("touchfront");
        touch2 = hardwareMap.touchSensor.get("touch2");
       
        float[] hsvValues = new float[3];
        final float values[] = hsvValues;
       
        boolean bPrevState = false;
        boolean bCurrState = false;
        String mode="";
        Claw.setPosition(0);
        right_mtr.setDirection(DcMotorSimple.Direction.REVERSE);
        right_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        left_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        front_right_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        front_left_mtr.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        clow_moter.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
        right_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        left_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        front_right_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        front_left_mtr.setMode(DcMotor.RunMode.RUN_WITHOUT_ENCODER);
        initVuforia();
        initTfod();
       
        if (tfod != null) {
            tfod.activate();
           
           
           
           
           
           
           
           
        }
       
        telemetry.addData(">", "Press Play to start op mode");
        telemetry.update();
        waitForStart();
        if (opModeIsActive()) {
            halt();
            sleep(1000);
            turnRight(0.5);
            haltSequence(450);
            goForward(.5);
            haltSequence(150);
            turnLeft(.5);
            haltSequence(450);
            goForward(0.4);
            sleep(450);
            halt();
            sleep(1000);
            telemetry.addData("Status", "Started");
            telemetry.update();
            if (tfod != null) {
               
               
                List<Recognition> updatedRecognitions = tfod.getUpdatedRecognitions();
                if (updatedRecognitions != null) {
                    telemetry.addData("# Object Detected", updatedRecognitions.size());
                    if (updatedRecognitions.size() == 0) {
                        mode = "A";
                    }
                   
                    int i = 0;
                    for (Recognition recognition : updatedRecognitions) {
                        telemetry.addData(String.format("label (%d)", i), recognition.getLabel());
                        if (recognition.getLabel() =="Quad"){
                            mode = "C";
                        } else {
                            mode = "B";
                        }
                        telemetry.addData(String.format("  left,top (%d)", i), "%.03f , %.03f",
                                recognition.getLeft(), recognition.getTop());
                        telemetry.addData(String.format("  right,bottom (%d)", i), "%.03f , %.03f",
                                recognition.getRight(), recognition.getBottom());
                    }
                   
                    telemetry.update();
                    sleep(2000);
                }
            }
        }
       
            if (mode == "A") {
                doModeA();
            } else if (mode == "B") {
                doModeB();
            } else if (mode == "C") {
                doModeC();
            } else {
               
            }
        if (tfod != null) {
             tfod.shutdown();
        }
    }
@override public void runopmode() { telemetry.adddata("status", "initialized"); telemetry.update(); left_mtr = hardwaremap.dcmotor.get("left_mtr"); right_mtr = hardwaremap.dcmotor.get("right_mtr"); front_left_mtr = hardwaremap.dcmotor.get("front_left_mtr"); front_right_mtr = hardwaremap.dcmotor.get("front_right_mtr"); shooter = hardwaremap.dcmotor.get("shooter"); conveyor = hardwaremap.dcmotor.get("conveyor"); clow_moter = hardwaremap.dcmotor.get("clow moter"); claw = hardwaremap.servo.get("claw"); touchfront = hardwaremap.touchsensor.get("touchfront"); touch2 = hardwaremap.touchsensor.get("touch2"); float[] hsvvalues = new float[3]; final float values[] = hsvvalues; boolean bprevstate = false; boolean bcurrstate = false; string mode=""; claw.setposition(0); right_mtr.setdirection(dcmotorsimple.direction.reverse); right_mtr.setzeropowerbehavior(dcmotor.zeropowerbehavior.brake); left_mtr.setzeropowerbehavior(dcmotor.zeropowerbehavior.brake); front_right_mtr.setzeropowerbehavior(dcmotor.zeropowerbehavior.brake); front_left_mtr.setzeropowerbehavior(dcmotor.zeropowerbehavior.brake); clow_moter.setzeropowerbehavior(dcmotor.zeropowerbehavior.brake); right_mtr.setmode(dcmotor.runmode.run_without_encoder); left_mtr.setmode(dcmotor.runmode.run_without_encoder); front_right_mtr.setmode(dcmotor.runmode.run_without_encoder); front_left_mtr.setmode(dcmotor.runmode.run_without_encoder); initvuforia(); inittfod(); if (tfod != null) { tfod.activate(); } telemetry.adddata(">", "press play to start op mode"); telemetry.update(); waitforstart(); if (opmodeisactive()) { halt(); sleep(1000); turnright(0.5); haltsequence(450); goforward(.5); haltsequence(150); turnleft(.5); haltsequence(450); goforward(0.4); sleep(450); halt(); sleep(1000); telemetry.adddata("status", "started"); telemetry.update(); if (tfod != null) { list<recognition> updatedrecognitions = tfod.getupdatedrecognitions(); if (updatedrecognitions != null) { telemetry.adddata("# object detected", updatedrecognitions.size()); if (updatedrecognitions.size() == 0) { mode = "a"; } int i = 0; for (recognition recognition : updatedrecognitions) { telemetry.adddata(string.format("label (%d)", i), recognition.getlabel()); if (recognition.getlabel() =="quad"){ mode = "c"; } else { mode = "b"; } telemetry.adddata(string.format(" left,top (%d)", i), "%.03f , %.03f", recognition.getleft(), recognition.gettop()); telemetry.adddata(string.format(" right,bottom (%d)", i), "%.03f , %.03f", recognition.getright(), recognition.getbottom()); } telemetry.update(); sleep(2000); } } } if (mode == "a") { domodea(); } else if (mode == "b") { domodeb(); } else if (mode == "c") { domodec(); } else { } if (tfod != null) { tfod.shutdown(); } }