updates
This commit is contained in:
parent
6f7b315ea6
commit
08cdb2a091
1 changed files with 100 additions and 94 deletions
|
@ -14,6 +14,7 @@ import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||||
import com.qualcomm.robotcore.util.ElapsedTime;
|
import com.qualcomm.robotcore.util.ElapsedTime;
|
||||||
|
|
||||||
import com.qualcomm.robotcore.hardware.IMU;
|
import com.qualcomm.robotcore.hardware.IMU;
|
||||||
|
import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles;
|
||||||
import com.qualcomm.robotcore.hardware.ImuOrientationOnRobot;
|
import com.qualcomm.robotcore.hardware.ImuOrientationOnRobot;
|
||||||
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
|
import com.qualcomm.hardware.rev.RevHubOrientationOnRobot;
|
||||||
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;
|
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 wheel_perimeter = wheel_rayon*2*Math.PI;
|
||||||
double speed = (tour_par_minute/60)*wheel_perimeter;//dist per second
|
double speed = (tour_par_minute/60)*wheel_perimeter;//dist per second
|
||||||
boolean mode = true;
|
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)
|
// Wait for the game to start (driver presses PLAY)
|
||||||
waitForStart();
|
waitForStart();
|
||||||
|
|
||||||
runtime.reset();
|
runtime.reset();
|
||||||
if (mode){
|
if (mode){
|
||||||
//mode Elina
|
//mode Elina
|
||||||
while (opModeIsActive() && (runtime.seconds() <= Yaw != 90)) {
|
while (opModeIsActive() && Yaw <= 90.0) {
|
||||||
lm.setPower(1);
|
lm.setPower(0.5);
|
||||||
rm.setPower(-1);
|
rm.setPower(-0.5);
|
||||||
|
Yaw = robotOrientation.getYaw(AngleUnit.DEGREES);
|
||||||
telemetry.addData("Leg 1", runtime.seconds());
|
telemetry.addData("Leg 1", runtime.seconds());
|
||||||
telemetry.update();
|
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
|
// Now use these simple methods to extract each angle
|
||||||
// (Java type double) from the object you just created:
|
// (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.addData("yaw",Yaw);
|
||||||
|
|
||||||
telemetry.update();
|
telemetry.update();
|
||||||
|
|
Loading…
Reference in a new issue