helloworld

This commit is contained in:
GZod01 2024-04-01 17:58:08 +02:00
parent dbcbd09dcf
commit c7e9bf4d3c

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.Position;
import org.firstinspires.ftc.robotcore.external.navigation.Velocity; 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 class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
public enum RobotMode { public enum RobotMode {
ESSAIFRANCK, ELINA, NORMAL, TANK; ESSAIFRANCK, ELINA, NORMAL, TANK;
@ -198,8 +198,11 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
} }
double lpower = 0.0; double lpower = 0.0;
double rpower = 0.0; double rpower = 0.0;
double vmean;
double a;
double b;
switch (mode) { switch (mode) {
case NORMAL: case NORMAL:
double ysign = Math.signum(y); double ysign = Math.signum(y);
double xsign = Math.signum(x); double xsign = Math.signum(x);
@ -207,17 +210,18 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
rpower = ysign * t + (xsign - 2 * x) * t; rpower = ysign * t + (xsign - 2 * x) * t;
break; break;
case TANK: case TANK:
lpower = y; lpower = -y;
rpower = gamepad1.right_stick_y; rpower = -gamepad1.right_stick_y;
break; break;
case ESSAIFRANCK: case ESSAIFRANCK:
double a = (-y + x) / Math.pow(2, 1 / 2); a = (-y + x) / 2;//Math.pow(2, 1 / 2);
double b = (-y - x) / Math.pow(2, 1 / 2); b = (-y - x) / 2;//Math.pow(2, 1 / 2);
double vmean = (Math.abs(a) + Math.abs(b)) / 2; vmean = (Math.abs(a) + Math.abs(b)) / 2;
lpower = (a / vmean) * t2; lpower = a*t2;//(a / vmean) * t2;
rpower = (b / vmean) * t2; rpower = a*t2;//(b / vmean) * t2;
break; break;
case ELINA: case ELINA:
@ -227,6 +231,7 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
lpower = (a / vmean) * t3; lpower = (a / vmean) * t3;
rpower = (b / vmean) * t3; rpower = (b / vmean) * t3;
break; break;
} }
if (gamepad1.left_trigger > 0.1) { if (gamepad1.left_trigger > 0.1) {