This commit is contained in:
Zelina974 2024-04-01 18:01:04 +02:00
commit 04e1e64407
4 changed files with 48 additions and 7 deletions

View file

@ -23,7 +23,7 @@ import org.firstinspires.ftc.robotcore.external.navigation.Orientation;
import org.firstinspires.ftc.robotcore.external.navigation.Position;
import org.firstinspires.ftc.robotcore.external.navigation.Velocity;
@TeleOp(name = "WeRobot: FTC2024 NEW!!! Carlike", group = "WeRobot")
@TeleOp(name = "WeRobot: FTC2024 NEW! Carlike", group = "WeRobot")
public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
public enum RobotMode {
ESSAIFRANCK, ELINA, NORMAL, TANK;
@ -200,8 +200,11 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
}
double lpower = 0.0;
double rpower = 0.0;
double vmean;
double a;
double b;
switch (mode) {
case NORMAL:
double ysign = Math.signum(y);
double xsign = Math.signum(x);
@ -209,17 +212,18 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
rpower = ysign * t + (xsign - 2 * x) * t;
break;
case TANK:
lpower = -y;
rpower = -gamepad1.right_stick_y;
break;
case ESSAIFRANCK:
double a = (-y + x) / Math.pow(2, 1 / 2);
double b = (-y - x) / Math.pow(2, 1 / 2);
double vmean = (Math.abs(a) + Math.abs(b)) / 2;
lpower = (a / vmean) * t2;
rpower = (b / vmean) * t2;
a = (-y + x) / 2;//Math.pow(2, 1 / 2);
b = (-y - x) / 2;//Math.pow(2, 1 / 2);
vmean = (Math.abs(a) + Math.abs(b)) / 2;
lpower = a*t2;//(a / vmean) * t2;
rpower = a*t2;//(b / vmean) * t2;
break;
case ELINA:
@ -229,6 +233,7 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
lpower = (a / vmean) * t3;
rpower = (b / vmean) * t3;
break;
}
if (gamepad1.left_trigger > 0.1) {