complete autonome
This commit is contained in:
parent
64056b6fef
commit
808c7e5bd5
1 changed files with 29 additions and 30 deletions
|
@ -16,48 +16,47 @@ import com.qualcomm.robotcore.util.ElapsedTime;
|
|||
|
||||
@Autonomous
|
||||
|
||||
public class HelloWorld_ElapsedTime extends LinearOpMode {
|
||||
private DcMotor leftMotor;
|
||||
private DcMotor rightMotor;
|
||||
private DcMotor arm;
|
||||
private Servo claw;
|
||||
private DigitalChannel touch;
|
||||
private Gyroscope imu;
|
||||
public class ftc2024_autonome extends LinearOpMode {
|
||||
private DcMotor rm;
|
||||
private DcMotor lm;
|
||||
private ElapsedTime runtime = new ElapsedTime();
|
||||
|
||||
@Override
|
||||
public void runOpMode() {
|
||||
imu = hardwareMap.get(Gyroscope.class, "imu");
|
||||
leftMotor = hardwareMap.get(DcMotor.class, "leftmotor");
|
||||
rightMotor = hardwareMap.get(DcMotor.class, "rightmotor");
|
||||
arm = hardwareMap.get(DcMotor.class, "arm");
|
||||
claw = hardwareMap.get(Servo.class, "claw");
|
||||
touch = hardwareMap.get(DigitalChannel.class, "touch");
|
||||
leftMotor.setDirection(DcMotor.Direction.FORWARD); // Set to REVERSE if using AndyMark motors
|
||||
rightMotor.setDirection(DcMotor.Direction.REVERSE);
|
||||
|
||||
lm = hardwareMap.get(DcMotor.class, "blm");
|
||||
rm = hardwareMap.get(DcMotor.class, "brm");
|
||||
telemetry.addData("Status", "Initialized");
|
||||
telemetry.update();
|
||||
boolean mode = true;
|
||||
// Wait for the game to start (driver presses PLAY)
|
||||
waitForStart();
|
||||
|
||||
runtime.reset();
|
||||
if (mode){
|
||||
//mode Elina
|
||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||
leftMotor.setPower(1);
|
||||
rightMotor.setPower(1);
|
||||
telemetry.addData("Leg 1", runtime.seconds());
|
||||
telemetry.update();
|
||||
}
|
||||
}
|
||||
else {
|
||||
//mode Aurelien
|
||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||
leftMotor.setPower(-1);
|
||||
rightMotor.setPower(-1);
|
||||
telemetry.addData("Leg 2", runtime.seconds());
|
||||
telemetry.update();
|
||||
}
|
||||
}
|
||||
// run until the end of the match (driver presses STOP)
|
||||
|
||||
runtime.reset();
|
||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||
leftMotor.setPower(1);
|
||||
rightMotor.setPower(1);
|
||||
telemetry.addData("Leg 1", runtime.seconds());
|
||||
telemetry.update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
runtime.reset();
|
||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||
leftMotor.setPower(-1);
|
||||
rightMotor.setPower(-1);
|
||||
telemetry.addData("Leg 2", runtime.seconds());
|
||||
telemetry.update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue