-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fulton
committed
Dec 17, 2019
1 parent
62245a1
commit b9e1617
Showing
2 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/LinearAutoLeft.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package org.firstinspires.ftc.teamcode; | ||
|
||
import com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cRangeSensor; | ||
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; | ||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; | ||
import com.qualcomm.robotcore.hardware.CRServo; | ||
import com.qualcomm.robotcore.hardware.ColorSensor; | ||
import com.qualcomm.robotcore.hardware.DcMotor; | ||
import com.qualcomm.robotcore.hardware.DcMotorSimple; | ||
|
||
import org.firstinspires.ftc.teamcode.framework.Color; | ||
import org.firstinspires.ftc.teamcode.framework.Move; | ||
@Autonomous | ||
public class LinearAutoLeft extends LinearOpMode | ||
{ | ||
|
||
|
||
@Override | ||
public void runOpMode() { | ||
DcMotor motor0 = hardwareMap.dcMotor.get("motor0"); | ||
DcMotor motor1 = hardwareMap.dcMotor.get("motor1"); | ||
DcMotor motor2 = hardwareMap.dcMotor.get("motor2"); | ||
DcMotor motor3 = hardwareMap.dcMotor.get("motor3"); | ||
CRServo servo1 = hardwareMap.crservo.get("servo1"); | ||
ModernRoboticsI2cRangeSensor range0 = hardwareMap.get(ModernRoboticsI2cRangeSensor.class, "range0"); | ||
ColorSensor colorSensor = hardwareMap.colorSensor.get("color0"); | ||
motor0.setDirection(DcMotorSimple.Direction.REVERSE); | ||
motor1.setDirection(DcMotorSimple.Direction.REVERSE); | ||
motor2.setDirection(DcMotorSimple.Direction.REVERSE); | ||
motor3.setDirection(DcMotorSimple.Direction.REVERSE); | ||
waitForStart(); | ||
new Move().left(motor0, motor1, motor2, motor3); | ||
sleep(2700); | ||
new Move().back(motor0, motor1, motor2, motor3); | ||
telemetry.addData("while is running", ""); | ||
while (true) { | ||
boolean scan = new Color().colors(colorSensor, telemetry); | ||
if (scan) { | ||
telemetry.addData("is true", ""); | ||
break; | ||
} | ||
} | ||
new Move().back(motor0, motor1, motor2, motor3); | ||
telemetry.addData("while is running", ""); | ||
while (true) { | ||
boolean scan = new Color().colors(colorSensor, telemetry); | ||
if (!scan) { | ||
telemetry.addData("is true", ""); | ||
break; | ||
} | ||
} | ||
sleep(5400); | ||
new Move().spinOtherWay(motor0, motor1, motor2, motor3); | ||
sleep(25); | ||
new Move().left(motor0, motor1, motor2, motor3); | ||
sleep(1000); | ||
new Move().forward(motor0, motor1, motor2, motor3); | ||
sleep(700); | ||
new Move().stop(motor0, motor1, motor2, motor3); | ||
new Move().openClaw(servo1); | ||
sleep(2000); | ||
new Move().crON(servo1, 0.0); | ||
new Move().right(motor0, motor1, motor2, motor3); | ||
sleep(1800); | ||
new Move().stop(motor0, motor1, motor2, motor3); | ||
new Move().forward(motor0, motor1, motor2, motor3); | ||
telemetry.addData("while is running", ""); | ||
while (true) { | ||
boolean scan = range0.rawUltrasonic() < 40; | ||
if (scan) { | ||
telemetry.addData("is true", ""); | ||
break; | ||
} | ||
} | ||
sleep(2000); | ||
new Move().back(motor0, motor1, motor2, motor3); | ||
sleep(2000); | ||
new Move().stop(motor0, motor1, motor2, motor3); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters