zfzfafafafeafaefaefaef
This commit is contained in:
parent
4d56bd4dfa
commit
b2aa4d052c
4 changed files with 174 additions and 147 deletions
|
@ -30,3 +30,4 @@ moissoneuse: b
|
|||
moissoneuse reverse: b + right\_bumber
|
||||
déplacement: left\_joystick
|
||||
|
||||
jkdssdhdssdf
|
5
ftc2024_auto_b4d.java
Normal file
5
ftc2024_auto_b4d.java
Normal file
|
@ -0,0 +1,5 @@
|
|||
package org.firstinspires.ftc.teamcode;
|
||||
import org.firstinspires.ftc.teamcode.Ftc2024_autonome_api;
|
||||
public class ftc2024_auto_b4d extends Ftc2024_autonome_api{
|
||||
public AutoMode autonomous_mode = AutoMode.B4D;
|
||||
}
|
|
@ -3,6 +3,7 @@ package org.firstinspires.ftc.teamcode;
|
|||
//import FTC2024WeRobotControl; //a tester car pas sur que ça fonctionne
|
||||
|
||||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
|
||||
import com.qualcomm.robotcore.hardware.DcMotorEx;
|
||||
|
||||
import com.qualcomm.robotcore.hardware.IMU;
|
||||
import org.firstinspires.ftc.robotcore.external.navigation.YawPitchRollAngles;
|
||||
|
@ -22,19 +23,27 @@ import com.qualcomm.robotcore.util.ElapsedTime;
|
|||
@Autonomous
|
||||
|
||||
public class Ftc2024_autonome_api extends LinearOpMode {
|
||||
public String autonomous_mode;
|
||||
public enum AutoMode{
|
||||
B2D,B4D,B2N,B4N,R2D,R4D,R2N,R4N
|
||||
}
|
||||
public AutoMode autonomous_mode;
|
||||
public DcMotor lm;
|
||||
public DcMotor rm;
|
||||
public DcMotorEx lmelevator;
|
||||
public DcMotorEx rmelevator;
|
||||
public DcMotor harvestmotor;
|
||||
public IMU imu;
|
||||
public DcMotorEx rotation;
|
||||
|
||||
@Override
|
||||
public void runOpMode() {
|
||||
lm = hardwareMap.get(DcMotor.class, "blm");
|
||||
rm = hardwareMap.get(DcMotor.class, "brm");
|
||||
harvestmotor = hardwareMap.get(DcMotor.class, "moissonneuse");
|
||||
rotation = hardwareMap.get(DcMotorEx.class, "elvRot");
|
||||
|
||||
rm.setDirection(DcMotor.Direction.REVERSE);
|
||||
rotation.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
|
||||
imu = hardwareMap.get(IMU.class, "imu");
|
||||
imu.initialize(
|
||||
|
@ -50,12 +59,14 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
telemetry.addData("wait for start", "");
|
||||
telemetry.update();
|
||||
|
||||
|
||||
|
||||
waitForStart();
|
||||
telemetry.addData("started", "");
|
||||
telemetry.update();
|
||||
robotOrientation = imu.getRobotYawPitchRollAngles();
|
||||
|
||||
if (opModeIsRunning()) {
|
||||
if (opModeIsActive()) {
|
||||
/*
|
||||
* autonomous_mode differents possibles values respect the next scheme:
|
||||
* team_color_shortcode + start_line_index + direct_or_no
|
||||
|
@ -70,6 +81,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
*/
|
||||
switch (autonomous_mode) {
|
||||
default:
|
||||
robot.boxElv();
|
||||
robot.forward(0.5);
|
||||
robot.rotate((-90));
|
||||
robot.forward(1.5);
|
||||
|
@ -78,6 +90,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("b2d"):
|
||||
robot.boxElv();
|
||||
robot.forward(0.5);
|
||||
robot.rotate((-90));
|
||||
robot.forward(2.5);
|
||||
|
@ -86,6 +99,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("r4d"):
|
||||
robot.boxElv();
|
||||
robot.forward(0.5);
|
||||
robot.rotate(90);
|
||||
robot.forward(1.5);
|
||||
|
@ -94,6 +108,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("r2d"):
|
||||
robot.boxElv();
|
||||
robot.forward(0.5);
|
||||
robot.rotate(90);
|
||||
robot.forward(2.5);
|
||||
|
@ -102,6 +117,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("b4n"):
|
||||
robot.boxElv();
|
||||
robot.forward(1.5);
|
||||
robot.rotate(90);
|
||||
robot.harvest();
|
||||
|
@ -118,6 +134,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("b2n"):
|
||||
robot.boxElv();
|
||||
robot.forward(1.5);
|
||||
robot.rotate(90);
|
||||
robot.harvest();
|
||||
|
@ -134,6 +151,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("r4n"):
|
||||
robot.boxElv();
|
||||
robot.forward(1.5);
|
||||
robot.rotate(-90);
|
||||
robot.harvest();
|
||||
|
@ -150,6 +168,7 @@ public class Ftc2024_autonome_api extends LinearOpMode {
|
|||
robot.harvest(0);
|
||||
break;
|
||||
case ("r2n"):
|
||||
robot.boxElv();
|
||||
robot.forward(1.5);
|
||||
robot.rotate(-90);
|
||||
robot.harvest();
|
||||
|
|
|
@ -370,6 +370,7 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
|
|||
|
||||
rotation.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
|
||||
box.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
|
||||
telemetry.addData("mode","MANUEL");
|
||||
// Elevator manual mode
|
||||
if (gamepad1.dpad_up) {
|
||||
// rmelevator.setPower(0.3);
|
||||
|
@ -406,6 +407,7 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
|
|||
// lmelevator.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
// rmelevator.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
rotation.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
|
||||
|
||||
}
|
||||
// Box manual mode
|
||||
if (gamepad1.dpad_left) {
|
||||
|
@ -434,6 +436,7 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
|
|||
|
||||
} else {
|
||||
gamepad1.setLedColor(0.0, 0.0, 0.0,10);
|
||||
telemetry.addData("mode","AUTOMATIQUE");
|
||||
|
||||
if (!gamepad1.dpad_right && already_padright) {
|
||||
already_padright = false;
|
||||
|
@ -539,7 +542,6 @@ public class WEROBOT_FTC2024_New_carlike extends LinearOpMode {
|
|||
telemetry.addData("ltrigg", t);
|
||||
telemetry.addData("t2", t2);
|
||||
telemetry.addData("rotation power", boxRot);
|
||||
telemetry.addData("mode manuel", manualMode);
|
||||
telemetry.addData("Position elevateur l", lmelevator.getCurrentPosition());
|
||||
telemetry.addData("Position elevateur r", rmelevator.getCurrentPosition());
|
||||
telemetry.addData("Position rotation", rotation.getCurrentPosition());
|
||||
|
|
Loading…
Reference in a new issue