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
|
@Autonomous
|
||||||
|
|
||||||
public class HelloWorld_ElapsedTime extends LinearOpMode {
|
public class ftc2024_autonome extends LinearOpMode {
|
||||||
private DcMotor leftMotor;
|
private DcMotor rm;
|
||||||
private DcMotor rightMotor;
|
private DcMotor lm;
|
||||||
private DcMotor arm;
|
|
||||||
private Servo claw;
|
|
||||||
private DigitalChannel touch;
|
|
||||||
private Gyroscope imu;
|
|
||||||
private ElapsedTime runtime = new ElapsedTime();
|
private ElapsedTime runtime = new ElapsedTime();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runOpMode() {
|
public void runOpMode() {
|
||||||
imu = hardwareMap.get(Gyroscope.class, "imu");
|
lm = hardwareMap.get(DcMotor.class, "blm");
|
||||||
leftMotor = hardwareMap.get(DcMotor.class, "leftmotor");
|
rm = hardwareMap.get(DcMotor.class, "brm");
|
||||||
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);
|
|
||||||
|
|
||||||
telemetry.addData("Status", "Initialized");
|
telemetry.addData("Status", "Initialized");
|
||||||
telemetry.update();
|
telemetry.update();
|
||||||
|
boolean mode = true;
|
||||||
// Wait for the game to start (driver presses PLAY)
|
// Wait for the game to start (driver presses PLAY)
|
||||||
waitForStart();
|
waitForStart();
|
||||||
|
|
||||||
// run until the end of the match (driver presses STOP)
|
|
||||||
|
|
||||||
runtime.reset();
|
runtime.reset();
|
||||||
|
if (mode){
|
||||||
|
//mode Elina
|
||||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||||
leftMotor.setPower(1);
|
leftMotor.setPower(1);
|
||||||
rightMotor.setPower(1);
|
rightMotor.setPower(1);
|
||||||
telemetry.addData("Leg 1", runtime.seconds());
|
telemetry.addData("Leg 1", runtime.seconds());
|
||||||
telemetry.update();
|
telemetry.update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
runtime.reset();
|
else {
|
||||||
|
//mode Aurelien
|
||||||
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
while (opModeIsActive() && (runtime.seconds() <= 3.0)) {
|
||||||
leftMotor.setPower(-1);
|
leftMotor.setPower(-1);
|
||||||
rightMotor.setPower(-1);
|
rightMotor.setPower(-1);
|
||||||
telemetry.addData("Leg 2", runtime.seconds());
|
telemetry.addData("Leg 2", runtime.seconds());
|
||||||
telemetry.update();
|
telemetry.update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// run until the end of the match (driver presses STOP)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue