From f2f99a357ca01b4931cf5deff4ee036d1a70088a Mon Sep 17 00:00:00 2001 From: Benny0Li Date: Mon, 19 Aug 2024 10:30:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20AutonomousProgramTemplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RIC.zip | Bin 36431 -> 37940 bytes .../DriveControls/SimpleMecanumDrive.java | 19 +++---- .../RIC_samples/AutonomousSample.java | 49 ++++++++++++++++++ .../org/firstinspires/ftc/teamcode/Robot.java | 16 ++++++ .../utils/AutonomousProgramTemplate.java | 31 +++++++++++ 5 files changed, 104 insertions(+), 11 deletions(-) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RIC_samples/AutonomousSample.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/AutonomousProgramTemplate.java diff --git a/RIC.zip b/RIC.zip index 3251f28271465d36cfd1b6dce55acb4e863b280e..050551c6a8c710b4e7f3ec6d8e132683f50043c9 100644 GIT binary patch delta 8920 zcmZ{J1z1#F*Y+?&cZYOJiMnzLmA!Z5`5h%U^N2ZSlB zCIN;6d=GU&p8bI!uv-t%9=yOGhz%hR0!>!N(SomeDzpa=0-fW4K*%5xkcxw`gDb1G zk-L$)8WIRXR{YWY{&Mp~0l~m-LO`I0uP>T9s<_g){`&rs1Q=7Lp}{|K#qDrK(UKe) zIxk*@t8t9?#|^p1yBJk57vq|UOi19gP*_^U$f!hVsAxn+U8Q7vU1xwoDc?V-;rJA! zC8JWMX5KW+dwk0K?Xrm&f!N}ZP;`KFJo?SfCH^T%KW(P|3EINr23t13wXROfEWAs+Bi%!rnKdrrC=yIGs{%Bm|qkWGeW? zO{wsqvwbx2`sL??lsRKZXqy1hT>nfKN+p_bf0HBoTe%Z#_d(>aaGZu0B)0Xow~gML z-3p26WgHov08&;1?%YqrD%q5az030W<}S%GA3dA&6SnQA8pI>mAs`gmY;jT!OwCwLs5)$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BLNUvl)$JN2lBm^5>}HDBk%R?1vC6MBsdp9L^6UE0dKf0#55TQ4`aAyjl)$TLAn3V z#KJVM1;fMKi2i$(0bGQ!L5!}or~!dkC1@_~(fW!pa zzv9f-afRZD6{Mp@d(lJqKWhn-yD^`bfJ^ZA+6-M8f1^Y9k8C0g@>KptBs`G|;_y#s z=r($XX5=Z{FbI==JwSRJY-BquXU>L%8L4cP!!!=_L zagzjeZ^4pbkXm5+_Pmm2_1;{}$I=^zCf zz-6)>2C)vhZuQuJm=sokIF%8yq6-M7T0=th0Ys`jB+(E!OVz~~Hw2}d(*QPU3K(@J zAmFP7Ezp&w0I{ poseHistory = new LinkedList<>(); - private Pose2d RobotPosition; + public Pose2d RobotPosition; private double BufPower=1f; private final Localizer localizer; @@ -83,7 +82,7 @@ public class DriveCommand { public abstract class commandRunningNode{ public void runCommand() {} } - + public commandRunningNode MEAN; private double BufPower; private Pose2d DeltaTrajectory; @@ -97,7 +96,7 @@ public void runCommand() {} this.BufPower=BufPower; this.pose=pose; } - + /** * 在该节点只修改电机BufPower,不会在定义时影响主程序 * @param power 目标设置的电机BufPower @@ -111,7 +110,7 @@ public void runCommand() { } }; } - + /** * 在该节点让机器旋转指定弧度 * @param radians 要转的弧度 @@ -125,7 +124,7 @@ public void runCommand() { }; DeltaTrajectory=new Pose2d(new Vector2d(0,0),radians); } - + /** * 在该节点让机器在指定角度行驶指定距离 * @param radians 相较于机器的正方向,目标点位的度数(注意不是相较于当前机器方向,而是坐标系定义时给出的机器正方向) @@ -144,7 +143,7 @@ public void runCommand() { .toVector2d() ,radians); } - + /** * 在该节点让机器在不旋转的情况下平移 * @param pose 目标矢量点位 @@ -159,7 +158,7 @@ public void runCommand() { }; DeltaTrajectory=new Pose2d(cache.toVector2d(),this.pose.heading); } - + /** * 不要在自动程序中调用这个函数,否则你会后悔的 */ @@ -169,12 +168,11 @@ public void RUN(){ public Pose2d getDeltaTrajectory(){ return DeltaTrajectory; } - + /** * @return 该Command节点的目标点位 */ @NonNull - @Contract(" -> new") public Pose2d NEXT(){ return new Pose2d( pose.position.x+DeltaTrajectory.position.x, @@ -383,7 +381,6 @@ public void runDriveCommandPackage(@NonNull DriveCommandPackage driveCommandPack * @return 在目标进度下机器的理想位置 */ @NonNull - @Contract ("_, _, _ -> new") private Pose2d getAimPositionThroughTrajectory(@NonNull Pose2d from, @NonNull Pose2d end, double progress){ Complex cache=new Complex(new Vector2d( end.position.x-from.position.x, diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RIC_samples/AutonomousSample.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RIC_samples/AutonomousSample.java new file mode 100644 index 0000000..f2c64af --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/RIC_samples/AutonomousSample.java @@ -0,0 +1,49 @@ +package org.firstinspires.ftc.teamcode.RIC_samples; + +import com.acmerobotics.roadrunner.Pose2d; +import com.acmerobotics.roadrunner.Vector2d; +import com.qualcomm.robotcore.eventloop.opmode.Autonomous; + +import org.firstinspires.ftc.teamcode.DriveControls.SimpleMecanumDrive.DriveCommandPackage; +import org.firstinspires.ftc.teamcode.utils.AutonomousProgramTemplate; +import org.firstinspires.ftc.teamcode.utils.enums.AutonomousLocation; + +@Autonomous(name = "AutonomousSample",group = "SAMPLE") +public class AutonomousSample extends AutonomousProgramTemplate { + @Override + public void runOpMode() { + Init(new Pose2d(0,0,0)); + robot.client.addData("Position","WAITING FOR REQUEST"); + AutonomousLocation location = AutonomousLocation.failed; + while (opModeIsNotActive()) { + location=robot.webcam.getLocation(); + robot.client.changeDate("Position",location.name()); + sleep(50); + } + + if(!WaitForStartRequest())return; + + robot.client.deleteDate("Position"); + switch (location){ + case left: + robot.strafeTo(robot.pose().position.plus(new Vector2d(0,24))); + robot.turnAngle(90); + robot.strafeTo(new Vector2d(24,0)); + break; + case centre: + DriveCommandPackage command=drive.drivingCommandsBuilder() + .StrafeTo(robot.pose().position.plus(new Vector2d(0,24))) + .TurnAngle(90) + .StrafeInDistance(Math.toRadians(-90),Math.sqrt(1152)) + .END(); + drive.runDriveCommandPackage(command); + break; + case right: + break; + case failed: + return; + } + + sleep(1145141919); + } +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Robot.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Robot.java index b0bf5d1..916f366 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Robot.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Robot.java @@ -4,6 +4,7 @@ import com.acmerobotics.roadrunner.Pose2d; import com.acmerobotics.roadrunner.SleepAction; +import com.acmerobotics.roadrunner.Vector2d; import com.acmerobotics.roadrunner.ftc.Actions; import com.qualcomm.robotcore.hardware.Gamepad; import com.qualcomm.robotcore.hardware.HardwareMap; @@ -100,6 +101,12 @@ private void InitInManualDrive(){ } public void update() { + NowTimeMills=System.currentTimeMillis(); + + if(NowTimeMills-StartTimeMills>=90000){ + state=State.FinalState; + } + sensors.update(); servos.update(); if(RuntimeOption.driverUsingAxisPowerInsteadOfCurrentPower) { @@ -131,6 +138,15 @@ public void turnAngle(double angle){ if(RunningState==runningState.ManualDrive)return; drive.runDriveCommandPackage(drive.drivingCommandsBuilder().TurnAngle(angle).END()); } + public void strafeTo(Vector2d pose){ + if(RunningState==runningState.ManualDrive)return; + drive.runDriveCommandPackage(drive.drivingCommandsBuilder().StrafeTo(pose).END()); + } + + public Pose2d pose(){ + drive.update(); + return drive.RobotPosition; + } /** * 将会把BufPower全部分配给电机 diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/AutonomousProgramTemplate.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/AutonomousProgramTemplate.java new file mode 100644 index 0000000..d6a2aa1 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/utils/AutonomousProgramTemplate.java @@ -0,0 +1,31 @@ +package org.firstinspires.ftc.teamcode.utils; + +import com.acmerobotics.roadrunner.Pose2d; +import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; + +import org.firstinspires.ftc.teamcode.DriveControls.SimpleMecanumDrive; +import org.firstinspires.ftc.teamcode.Robot; +import org.firstinspires.ftc.teamcode.utils.enums.runningState; + +public abstract class AutonomousProgramTemplate extends LinearOpMode { + public Robot robot; + public SimpleMecanumDrive drive; + + public void Init(Pose2d position){ + robot=new Robot(hardwareMap, runningState.Autonomous,telemetry); + drive=robot.enableSimpleMecanumDrive(position); + } + public boolean WaitForStartRequest(){ + while(opModeIsNotActive()){ + sleep(50); + } + + return opModeStopped(); + } + public boolean opModeIsNotActive(){ + return !opModeIsActive()&&!isStopRequested(); + } + public boolean opModeStopped(){ + return opModeIsActive() && ! isStopRequested(); + } +}