TeamCode/src/main/java/org/firstinspires/ftc/teamcode/DRSS_Alan_TeleOp.java
//Declare all variables that will be used by the program.
Declare all variables that will be used by the program.
Declare all variables that will be used by the program .
@Override
    public void init() {
        /*The following series of try/catch statements attempt to assign each declared hardware
         *device to a physical hardware device on the robot
         */
        try {
            leftMotor = hardwareMap.dcMotor.get("leftMotor");
            leftMotor.setDirection(DcMotor.Direction.REVERSE);
        } catch (Exception eLeftMotor) {
            telemetry.addData("Exception ", "leftMotor not found");
            leftMotor = new DummyDcMotor();
        }
        try {
            driveMotorController = hardwareMap.dcMotorController.get("DriveMotorController");
        } catch (Exception eDriveMotorController) {
            driveMotorController = new DummyDcMotorController();
            telemetry.addData("Exception ", "DriveMotorController not found");
        }
        try {
            shooterMotorController = hardwareMap.dcMotorController.get("ShooterMotorController");
        } catch (Exception eShooterMotorController) {
            shooterMotorController = new DummyDcMotorController();
            telemetry.addData("Exception ", "ShooterMotorController not found");
        }
        try {
            colorSensor = hardwareMap.colorSensor.get("colorSensor");
        } catch (Exception eColorSensor) {
            colorSensor = new DummyColorSensor();
            telemetry.addData("Exception ", "colorSensor not found");
        }
        try {
            opticalDistanceSensor = hardwareMap.opticalDistanceSensor.get("opticalSensor");
        } catch (Exception eColorSensor) {
            opticalDistanceSensor = new DummyOpticalDistanceSensor();
            telemetry.addData("Exception ", "opticalSensor not found");
        }
        try {
            rightMotor = hardwareMap.dcMotor.get("rightMotor");
            rightMotor.setDirection(DcMotor.Direction.FORWARD);
        } catch (Exception eRightMotor) {
            telemetry.addData("Exception ", "rightMotor not found");
            rightMotor = new DummyDcMotor();
        }
        try {
            particleAccelerator = hardwareMap.dcMotor.get("particleAccelerator");
        } catch (Exception eParticleAccelerator) {
            telemetry.addData("Exception ", "particleAccelerator not found");
            particleAccelerator = new DummyDcMotor();
        }
        try {
            backFlap = hardwareMap.servo.get("backFlap");
            backFlap.setDirection(Servo.Direction.FORWARD);
        } catch (Exception eBackFlap) {
            telemetry.addData("Exception ", "backFlap not found");
            backFlap = new DummyServo();
        }
        try {
            capballGrip = hardwareMap.servo.get("capballGrip");
            capballGrip.setDirection(Servo.Direction.FORWARD);
            capballGrip.setPosition(0);
        } catch (Exception eBackFlap) {
            telemetry.addData("Exception ", "capballGrip not found");
            capballGrip = new DummyServo();
        }
        try {
            pushRod = hardwareMap.crservo.get("pushRod");
        } catch (Exception ePushRod) {
            telemetry.addData("Exception ", "pushRod not found");
            pushRod = new DummyCRServo();
        }
        try {
            servoController = hardwareMap.servoController.get("ServoController");
        } catch (Exception eServoController){
            telemetry.addData("Exception: ", "ServoController not found");
            servoController = new DummyServoController();
        }
        try {
            servoControllerButtonPusher = hardwareMap.servoController.get("Servo Controller button pusher");
        } catch (Exception eServoController){
            telemetry.addData("Exception: ", "ServoController not found");
            servoController = new DummyServoController();
        }
        try {
            particleLift = hardwareMap.dcMotor.get("particleLift");
        } catch (Exception eParticleLift) {
            telemetry.addData("Exception ", "particleLift not found");
            particleLift = new DummyDcMotor();
        }
        try{
            capBall = hardwareMap.dcMotor.get("capBall");
        } catch (Exception eCapBall){
            telemetry.addData("Exception ", "capBall not found");
            capBall = new DummyDcMotor();
        }
        try{
            clawTrigger = hardwareMap.servo.get("clawTrigger");
            clawTrigger.setPosition(0.0);
        } catch(Exception eClawTrigger){
            telemetry.addData("Exception ", "clawTrigger not found");
            clawTrigger = new DummyServo();
        }
        try{
            capBallMotorController = hardwareMap.dcMotorController.get("CapBallMotorController");
        } catch(Exception eCapBalMotorController){
            telemetry.addData("Exception ", "CapBallMotorController not found");
            capBallMotorController = new DummyDcMotorController();
        }
        try{
            cannonSeal = hardwareMap.servo.get("cannonSeal");
            cannonSeal.setPosition(gateclosed);
        } catch(Exception eCannonSeal){
            telemetry.addData("Exception ", "cannonSeal not found");
            cannonSeal = new DummyServo();
        }
    }
@ Override public void init ( ) { /*The following series of try/catch statements attempt to assign each declared hardware
         *device to a physical hardware device on the robot
         */ try { leftMotor = hardwareMap . dcMotor . get ( "leftMotor" ) ; leftMotor . setDirection ( DcMotor . Direction . REVERSE ) ; } catch ( Exception eLeftMotor ) { telemetry . addData ( "Exception " , "leftMotor not found" ) ; leftMotor = new DummyDcMotor ( ) ; } try { driveMotorController = hardwareMap . dcMotorController . get ( "DriveMotorController" ) ; } catch ( Exception eDriveMotorController ) { driveMotorController = new DummyDcMotorController ( ) ; telemetry . addData ( "Exception " , "DriveMotorController not found" ) ; } try { shooterMotorController = hardwareMap . dcMotorController . get ( "ShooterMotorController" ) ; } catch ( Exception eShooterMotorController ) { shooterMotorController = new DummyDcMotorController ( ) ; telemetry . addData ( "Exception " , "ShooterMotorController not found" ) ; } try { colorSensor = hardwareMap . colorSensor . get ( "colorSensor" ) ; } catch ( Exception eColorSensor ) { colorSensor = new DummyColorSensor ( ) ; telemetry . addData ( "Exception " , "colorSensor not found" ) ; } try { opticalDistanceSensor = hardwareMap . opticalDistanceSensor . get ( "opticalSensor" ) ; } catch ( Exception eColorSensor ) { opticalDistanceSensor = new DummyOpticalDistanceSensor ( ) ; telemetry . addData ( "Exception " , "opticalSensor not found" ) ; } try { rightMotor = hardwareMap . dcMotor . get ( "rightMotor" ) ; rightMotor . setDirection ( DcMotor . Direction . FORWARD ) ; } catch ( Exception eRightMotor ) { telemetry . addData ( "Exception " , "rightMotor not found" ) ; rightMotor = new DummyDcMotor ( ) ; } try { particleAccelerator = hardwareMap . dcMotor . get ( "particleAccelerator" ) ; } catch ( Exception eParticleAccelerator ) { telemetry . addData ( "Exception " , "particleAccelerator not found" ) ; particleAccelerator = new DummyDcMotor ( ) ; } try { backFlap = hardwareMap . servo . get ( "backFlap" ) ; backFlap . setDirection ( Servo . Direction . FORWARD ) ; } catch ( Exception eBackFlap ) { telemetry . addData ( "Exception " , "backFlap not found" ) ; backFlap = new DummyServo ( ) ; } try { capballGrip = hardwareMap . servo . get ( "capballGrip" ) ; capballGrip . setDirection ( Servo . Direction . FORWARD ) ; capballGrip . setPosition ( 0 ) ; } catch ( Exception eBackFlap ) { telemetry . addData ( "Exception " , "capballGrip not found" ) ; capballGrip = new DummyServo ( ) ; } try { pushRod = hardwareMap . crservo . get ( "pushRod" ) ; } catch ( Exception ePushRod ) { telemetry . addData ( "Exception " , "pushRod not found" ) ; pushRod = new DummyCRServo ( ) ; } try { servoController = hardwareMap . servoController . get ( "ServoController" ) ; } catch ( Exception eServoController ) { telemetry . addData ( "Exception: " , "ServoController not found" ) ; servoController = new DummyServoController ( ) ; } try { servoControllerButtonPusher = hardwareMap . servoController . get ( "Servo Controller button pusher" ) ; } catch ( Exception eServoController ) { telemetry . addData ( "Exception: " , "ServoController not found" ) ; servoController = new DummyServoController ( ) ; } try { particleLift = hardwareMap . dcMotor . get ( "particleLift" ) ; } catch ( Exception eParticleLift ) { telemetry . addData ( "Exception " , "particleLift not found" ) ; particleLift = new DummyDcMotor ( ) ; } try { capBall = hardwareMap . dcMotor . get ( "capBall" ) ; } catch ( Exception eCapBall ) { telemetry . addData ( "Exception " , "capBall not found" ) ; capBall = new DummyDcMotor ( ) ; } try { clawTrigger = hardwareMap . servo . get ( "clawTrigger" ) ; clawTrigger . setPosition ( 0.0 ) ; } catch ( Exception eClawTrigger ) { telemetry . addData ( "Exception " , "clawTrigger not found" ) ; clawTrigger = new DummyServo ( ) ; } try { capBallMotorController = hardwareMap . dcMotorController . get ( "CapBallMotorController" ) ; } catch ( Exception eCapBalMotorController ) { telemetry . addData ( "Exception " , "CapBallMotorController not found" ) ; capBallMotorController = new DummyDcMotorController ( ) ; } try { cannonSeal = hardwareMap . servo . get ( "cannonSeal" ) ; cannonSeal . setPosition ( gateclosed ) ; } catch ( Exception eCannonSeal ) { telemetry . addData ( "Exception " , "cannonSeal not found" ) ; cannonSeal = new DummyServo ( ) ; } }
Declare all variables that will be used by the program.
Declare all variables that will be used by the program .