2 Commits

Author SHA1 Message Date
5932d44350 Almost perfect, just need to get path 6 working properly 2025-01-26 12:51:21 -08:00
a36f40be45 Added new paths for autonomous 2025-01-26 12:32:43 -08:00
7 changed files with 204 additions and 92 deletions

View File

@ -1,35 +1,19 @@
package org.firstinspires.ftc.teamcode.cometbots.paths; package org.firstinspires.ftc.teamcode.cometbots.paths;
import static com.qualcomm.hardware.lynx.commands.core.LynxSetMotorPIDFControlLoopCoefficientsCommand.InternalMotorControlAlgorithm.Max;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.acmerobotics.dashboard.telemetry.TelemetryPacket; import com.acmerobotics.dashboard.telemetry.TelemetryPacket;
import com.acmerobotics.roadrunner.Action; import com.acmerobotics.roadrunner.Action;
import com.acmerobotics.roadrunner.SequentialAction;
import com.acmerobotics.roadrunner.SleepAction;
import com.acmerobotics.roadrunner.ftc.Actions;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode; import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.util.ElapsedTime; import com.qualcomm.robotcore.util.ElapsedTime;
//import org.firstinspires.ftc.teamcode.cometbots.CometBotTeleopCompetition;
//import org.firstinspires.ftc.teamcode.cometbots.paths.HighBasketPath1;
import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower; import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
//import org.firstinspires.ftc.teamcode.subsystem.AutoPark;
import org.firstinspires.ftc.teamcode.cometbots.paths.HighBasketPath1;
import org.firstinspires.ftc.teamcode.subsystem.ArmSubsystem; import org.firstinspires.ftc.teamcode.subsystem.ArmSubsystem;
import org.firstinspires.ftc.teamcode.subsystem.ClawSubsystem; import org.firstinspires.ftc.teamcode.subsystem.ClawSubsystem;
import org.firstinspires.ftc.teamcode.subsystem.DualMotorSliderSubsystem; import org.firstinspires.ftc.teamcode.subsystem.DualMotorSliderSubsystem;
import org.firstinspires.ftc.teamcode.subsystem.WristSubsystem; import org.firstinspires.ftc.teamcode.subsystem.WristSubsystem;
//import org.firstinspires.ftc.teamcode.subsystem.HighBasketAutoPath2;
//import org.firstinspires.ftc.teamcode.subsystem.HighBasketAutoPath3;
//import org.firstinspires.ftc.teamcode.subsystem.HighBasketAutoPath4;
//import org.firstinspires.ftc.teamcode.subsystem.HighBasketAutoPath5;
//import org.firstinspires.ftc.teamcode.subsystem.HighBasketAutoPath6;
//import org.firstinspires.ftc.teamcode.subsystem.LiftActionsSubsystem;
//import org.firstinspires.ftc.teamcode.subsystem.SkyHookSubsystem;
@Autonomous(name = "Auto Test Competition V2", group = "Dev") @Autonomous(name = "Auto Test Competition V2", group = "Dev")
public class CometBotDriveV2 extends OpMode { public class CometBotDriveV2 extends OpMode {
@ -40,6 +24,8 @@ public class CometBotDriveV2 extends OpMode {
private HighBasketPath2 path2; private HighBasketPath2 path2;
private HighBasketPath3 path3; private HighBasketPath3 path3;
private HighBasketPath4 path4; private HighBasketPath4 path4;
private HighBasketPath5 path5;
private HighBasketPath6 path6;
//private CometBotTeleopCompetition comp; //private CometBotTeleopCompetition comp;
@ -60,6 +46,8 @@ public class CometBotDriveV2 extends OpMode {
path2 = new HighBasketPath2(); path2 = new HighBasketPath2();
path3 = new HighBasketPath3(); path3 = new HighBasketPath3();
path4 = new HighBasketPath4(); path4 = new HighBasketPath4();
path5 = new HighBasketPath5();
path6 = new HighBasketPath6();
lift = new DualMotorSliderSubsystem(hardwareMap); lift = new DualMotorSliderSubsystem(hardwareMap);
arm = new ArmSubsystem(hardwareMap); arm = new ArmSubsystem(hardwareMap);
wrist = new WristSubsystem(hardwareMap); wrist = new WristSubsystem(hardwareMap);
@ -91,61 +79,79 @@ public class CometBotDriveV2 extends OpMode {
} }
switch (state) { switch (state) {
case 0: case 0:
// claw.thumbOutOfTheWay();
runtime.reset();
moveToPathOneAndHighBucket(); moveToPathOneAndHighBucket();
break; break;
case 1: case 1:
//doArmThing(); doArmThing();
//lift.update();
state = 2; state = 2;
break; break;
case 2: case 2:
moveToPathTwoAndPickSampleUp(); moveToPathTwoAndPickSampleUp();
//lift.update();
break; break;
case 3: case 3:
// doPickUpThing(); doPickUpThing();
// runtime.reset();
state = 4;
break; break;
case 4: case 4:
moveToBasketPath3(); moveToBasketPath3();
break; break;
case 5: case 5:
// theArmThing(); theArmThing();
state = 6;
break; break;
case 6: case 6:
moveToPickupAgainPath4(); moveToPickupAgainPath4();
break; break;
case 7: case 7:
// doPickUpThingAgain(); doPickUpThingAgain();
break; break;
case 8: case 8:
moveToPickupAgainPath5(); moveToBasketPath5();
break;
case 9:
theArmThingAgain();
break;
case 10:
moveToParkPath6();
break;
case 11:
moveToPark();
break;
case 99:
break; break;
// case 9:
// //theArmThingAgain();
// break;
// case 10:
// //moveToParkPath6();
// break;
// case 11:
default: default:
telemetry.addLine("default"); telemetry.addLine("default");
} }
telemetry.update(); telemetry.update();
lift.update();
follower.update(); follower.update();
} }
public void moveToPark() {
if (runtime.seconds() > 26) {
path6.moveToBasketPath6(follower);
wrist.toTravelPosition();
state = 99;
}
}
private void moveToPathOneAndHighBucket() { private void moveToPathOneAndHighBucket() {
path1.moveToPath1(follower); path1.moveToPath1(follower);
state = 1; state = 1;
} }
private void moveToBasketPath5() {
if(runtime.seconds() > 19){
path5.moveToBasketPath5(follower);
lift.toHighBucketReverseDrop();
wrist.toTravelPosition();
state = 9;
}
}
public class SetStateAction implements Action { public class SetStateAction implements Action {
@ -168,35 +174,54 @@ public class CometBotDriveV2 extends OpMode {
private void doArmThing() { private void doArmThing() {
claw.thumbOutOfTheWay();
wrist.toTravelPosition();
lift.toHighBucketReverseDrop(); lift.toHighBucketReverseDrop();
arm.toReverseBucket(); //arm.toReverseBucket();
wrist.toReverseBucket(); //wrist.toReverseBucket();
claw.openClaw(); //claw.openClaw();
wrist.toFloorPosition(); //wrist.toFloorPosition();
state = 2;
} }
// private void theArmThing() { private void theArmThing() {
// telemetry.addData("busy?", follower.isBusy()); if(lift.getFixedPosition() >= 4280){
// telemetry.addData("end?", follower.atParametricEnd()); arm.toReverseBucket();
// if (follower.atParametricEnd()){ if(runtime.seconds() > 12) {
// follower.breakFollowing(); wrist.toReverseBucket();
// comp.highBucketDropAuto(); }
// state = 6; if(runtime.seconds() > 12.75) {
// } claw.openClaw();
// follower.breakFollowing(); state = 6;
// } }
}
}
private void theArmThingAgain() {
if(lift.getFixedPosition() >= 4280){
arm.toReverseBucket();
if(runtime.seconds() > 22) {
wrist.toReverseBucket();
}
if(runtime.seconds() > 23.00) {
claw.openClaw();
state = 10;
}
}
}
// private void theArmThingAgain() {
// follower.breakFollowing();
// comp.highBucketDropAuto();
// state = 10;
// }
private void moveToPathTwoAndPickSampleUp() { private void moveToPathTwoAndPickSampleUp() {
if (runtime.seconds() > 6) { if (runtime.seconds() > 3.25 && runtime.seconds() < 4) {
wrist.toReverseBucket();
}
if (runtime.seconds() > 3.5) {
claw.openClaw();
}
if (runtime.seconds() > 4) {
wrist.toTravelPosition();
lift.toFloorPosition();
path2.moveToPath2(follower); path2.moveToPath2(follower);
state = 3; state = 3;
} }
@ -204,15 +229,19 @@ public class CometBotDriveV2 extends OpMode {
// //
private void moveToBasketPath3() { private void moveToBasketPath3() {
if (runtime.seconds() > 10) if (runtime.seconds() > 7.25) {
{ lift.toHighBucketReverseDrop();
path3.moveToBasketPath3(follower); path3.moveToBasketPath3(follower);
state = 5; state = 5;
} }
} }
private void moveToPickupAgainPath4() { private void moveToPickupAgainPath4() {
if (runtime.seconds() > 13) {
wrist.toTravelPosition();
}
if (runtime.seconds() > 14) { if (runtime.seconds() > 14) {
lift.toFloorPosition();
path4.moveToPickupPath4(follower); path4.moveToPickupPath4(follower);
state = 7; state = 7;
} }
@ -222,19 +251,17 @@ public class CometBotDriveV2 extends OpMode {
} }
// private void moveToParkPath6() { private void moveToParkPath6() {
// if (!followingPath) { if (runtime.seconds() > 24.5) {
// path6.moveToParkPath6(follower); arm.toBucketPosition();
// followingPath = true; wrist.toTravelPosition();
// } }
// if (runtime != null) { if (runtime.seconds() > 25.) {
// telemetry.addData("Runtime (seconds)", runtime.seconds()); lift.toFloorPosition();
// if (follower.atParametricEnd() || runtime.seconds() > 48.0) { claw.closeClaw();
// state = 11; state = 11;
// followingPath = false; }
// } }
// }
// }
// //
// private void moveToBasketPath3() { // private void moveToBasketPath3() {
// if (!followingPath) { // if (!followingPath) {
@ -283,18 +310,24 @@ public class CometBotDriveV2 extends OpMode {
// )); // ));
// } // }
// //
// private void doPickUpThing() { private void doPickUpThing() {
// follower.breakFollowing(); wrist.toPickupPosition();
// thePickUpAuto(); arm.toFloorPosition();
// state = 4; if (runtime.seconds() > 7){
// } claw.closeClaw();
// state = 4;
// private void doPickUpThingAgain() { }
// follower.breakFollowing(); }
// thePickUpAuto();
// state = 8; private void doPickUpThingAgain() {
// } wrist.toPickupPosition();
// arm.toFloorPosition();
// if (runtime.seconds() > 18){
claw.closeClaw();
state = 8;
}
}
} }

View File

@ -24,7 +24,7 @@ public class HighBasketPath2 {
// Line 1 // Line 1
new BezierLine( new BezierLine(
new Point(20.000, 130.000, Point.CARTESIAN), new Point(20.000, 130.000, Point.CARTESIAN),
new Point(26.000, 117.000, Point.CARTESIAN) new Point(27.000, 117.000, Point.CARTESIAN)
) )
) )
.setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(0)); .setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(0));

View File

@ -23,7 +23,7 @@ public class HighBasketPath4 {
// Line 1 // Line 1
new BezierLine( new BezierLine(
new Point(22.000, 132.000, Point.CARTESIAN), new Point(22.000, 132.000, Point.CARTESIAN),
new Point(26.000, 127.500, Point.CARTESIAN) new Point(27.000, 128.500, Point.CARTESIAN)
) )
) )
.setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(0)); .setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(0));

View File

@ -0,0 +1,35 @@
package org.firstinspires.ftc.teamcode.cometbots.paths;
import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.BezierLine;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathBuilder;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathChain;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Point;
/*
AutoLine# - This file does something of a path......
*/
public class HighBasketPath5 {
public void moveToBasketPath5(Follower robot) {
PathChain pathChain;
PathBuilder builder = new PathBuilder();
builder
.addPath(
// Line 1
new BezierLine(
new Point(27.000, 127.000, Point.CARTESIAN),
new Point(22.000, 132.000, Point.CARTESIAN)
)
)
.setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(320));
pathChain = builder.build();
robot.followPath(pathChain);
}
}

View File

@ -0,0 +1,36 @@
package org.firstinspires.ftc.teamcode.cometbots.paths;
import org.firstinspires.ftc.teamcode.pedroPathing.follower.Follower;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.BezierCurve;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.BezierLine;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathBuilder;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathChain;
import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Point;
/*
AutoLine# - This file does something of a path......
*/
public class HighBasketPath6 {
public void moveToBasketPath6(Follower robot) {
PathChain pathChain;
PathBuilder builder = new PathBuilder();
builder
.addPath(
// Line 1
new BezierLine(
new Point(27.000, 128.500, Point.CARTESIAN),
new Point(104.00, 100.00, Point.CARTESIAN)
)
)
.setLinearHeadingInterpolation(Math.toRadians(0), Math.toRadians(270));
pathChain = builder.build();
robot.followPath(pathChain);
}
}

View File

@ -21,18 +21,20 @@ public class RobotConstants {
public final static int slideBelowFloor = -150; public final static int slideBelowFloor = -150;
public final static int backwardBucketDrop = 4670; public final static int backwardBucketDrop = 4670;
public final static double armBucket = 0.45; public final static double armBucket = 0.45;
public final static double armInit = 0.135; public final static double armInit = 0.13;
public final static double wristInit = 0.25; public final static double wristInit = 0.125;
public final static double wristPickup = 0.475; public final static double wristPickup = 0.475;
public final static double wristBucket = 0.56; public final static double wristBucket = 0.56;
public final static double wristFloor = 0.75; public final static double wristFloor = 0.75;
public final static double wristBackwardBucket = 0.775; public final static double wristBackwardBucket = 0.725;
public final static double wristRung = 0.55; public final static double wristRung = 0.55;
public final static double wristSpeciemen = 0.1; public final static double wristSpeciemen = 0.1;
public final static int toBar = 500; public final static int toBar = 500;
public final static double wristtravel = 0.525;
public final static int toFloor = 0; public final static int toFloor = 0;
public final static int liftToFloorPos = 350; public final static int liftToFloorPos = 350;
public final static int liftToSubmarinePos = 350; public final static int liftToSubmarinePos = 350;
@ -43,6 +45,6 @@ public class RobotConstants {
public final static int liftToHighRungAttach = 1050; public final static int liftToHighRungAttach = 1050;
public final static int liftToHighBucketPos = 4000; public final static int liftToHighBucketPos = 4500;
public final static double liftPower = 1; public final static double liftPower = 1;
} }

View File

@ -9,6 +9,7 @@ import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristHangBlu
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristInit; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristInit;
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristPickup; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristPickup;
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristSpeciemen; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristSpeciemen;
import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristtravel;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -21,7 +22,7 @@ import com.qualcomm.robotcore.hardware.ServoImplEx;
public class WristSubsystem { public class WristSubsystem {
public enum WristState { public enum WristState {
FLOOR, BUCKET, PICKUP, RUNG, SPECIMEN, GRAB_BLUEBERRY_SKYHOOK, HANG_BLUEBERRY_SKYHOOK, INIT, REVERSE_BUCKET FLOOR, BUCKET, PICKUP, RUNG, SPECIMEN, GRAB_BLUEBERRY_SKYHOOK, HANG_BLUEBERRY_SKYHOOK, INIT, REVERSE_BUCKET, TRAVEL
} }
public ServoImplEx wrist; public ServoImplEx wrist;
@ -97,6 +98,11 @@ public class WristSubsystem {
wrist.setPosition(wristBackwardBucket); wrist.setPosition(wristBackwardBucket);
setState(WristState.REVERSE_BUCKET); setState(WristState.REVERSE_BUCKET);
} }
public void toTravelPosition(){
wrist.setPosition(wristtravel);
setState(WristState.TRAVEL);
}
public WristState getState() { public WristState getState() {
return this.state; return this.state;
} }