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); } }
/* * Code to run when the op mode is first enabled goes here * * @see com.qualcomm.robotcore.eventloop.opmode.OpMode#start() */ @Override public void init() { /* * Use the hardwareMap to get the dc motors and servos by name. * Note that the names of the devices must match the names used * when you configured your robot and created the configuration file. */ /* * For the demo Tetrix K9 bot we assume the following, * There are two motors "motor_1" and "motor_2" * "motor_1" is on the right side of the bot. * "motor_2" is on the left side of the bot.. * * We also assume that there are two servos "servo_1" and "servo_6" * "servo_1" controls the arm joint of the manipulator. * "servo_6" controls the claw joint of the manipulator. */ motorRight = hardwareMap.dcMotor.get("motor_2"); motorLeft = hardwareMap.dcMotor.get("motor_1"); motorLeft.setDirection(DcMotor.Direction.REVERSE); arm = hardwareMap.servo.get("servo_1"); claw = hardwareMap.servo.get("servo_6"); // set the starting position of the wrist and claw armPosition = 0.4; clawPosition = 0.25; /* * We also assume that we have a LEGO light sensor * with a name of "light_sensor" configured for our robot. */ reflectedLight = hardwareMap.lightSensor.get("light_sensor"); // turn on LED of light sensor. reflectedLight.enableLed(true); }