This commit is contained in:
Zelina974 2024-02-11 16:17:58 +01:00
parent 6f7b315ea6
commit 08cdb2a091

View file

@ -14,6 +14,7 @@ import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.qualcomm.robotcore.hardware.IMU;
import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles;
import com.qualcomm.robotcore.hardware.ImuOrientationOnRobot;
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
@ -62,15 +63,24 @@ public class ftc2024_autonome extends LinearOpMode {
double wheel_perimeter = wheel_rayon*2*Math.PI;
double speed = (tour_par_minute/60)*wheel_perimeter;//dist per second
boolean mode = true;
YawPitchRollAngles robotOrientation;
robotOrientation = imu.getRobotYawPitchRollAngles();
double Yaw = robotOrientation.getYaw(AngleUnit.DEGREES);
double Pitch = robotOrientation.getPitch(AngleUnit.DEGREES);
double Roll = robotOrientation.getRoll(AngleUnit.DEGREES);
// Wait for the game to start (driver presses PLAY)
waitForStart();
runtime.reset();
if (mode){
//mode Elina
while (opModeIsActive() && (runtime.seconds() <= Yaw != 90)) {
lm.setPower(1);
rm.setPower(-1);
while (opModeIsActive() && Yaw <= 90.0) {
lm.setPower(0.5);
rm.setPower(-0.5);
Yaw = robotOrientation.getYaw(AngleUnit.DEGREES);
telemetry.addData("Leg 1", runtime.seconds());
telemetry.update();
}
@ -115,14 +125,10 @@ public class ftc2024_autonome extends LinearOpMode {
}
}
}
YawPitchRollAngles robotOrientation;
robotOrientation = imu.getRobotYawPitchRollAngles();
// Now use these simple methods to extract each angle
// (Java type double) from the object you just created:
double Yaw = robotOrientation.getYaw(AngleUnit.DEGREES);
double Pitch = robotOrientation.getPitch(AngleUnit.DEGREES);
double Roll = robotOrientation.getRoll(AngleUnit.DEGREES);
telemetry.addData("yaw",Yaw);
telemetry.update();