From c1076a832c4d383e87939ad11df46018462ccebf Mon Sep 17 00:00:00 2001 From: carlos Date: Thu, 17 Oct 2024 11:05:12 -0700 Subject: [PATCH] Rebased changes --- TeamCode/src/main/java/GeneratedPath.java | 107 ++++++++++++++++++ TeamCode/src/main/java/nbRedAutoV1/Java.java | 8 ++ .../ftc/teamcode/PedroConstants.java | 10 +- .../ftc/teamcode/pedroPathing/TUNING.md | 3 +- .../tuning/FollowerConstants.java | 2 +- 5 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 TeamCode/src/main/java/GeneratedPath.java create mode 100644 TeamCode/src/main/java/nbRedAutoV1/Java.java diff --git a/TeamCode/src/main/java/GeneratedPath.java b/TeamCode/src/main/java/GeneratedPath.java new file mode 100644 index 0000000..301a70a --- /dev/null +++ b/TeamCode/src/main/java/GeneratedPath.java @@ -0,0 +1,107 @@ +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.BezierLine; +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathBuilder; +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Point; + +public class GeneratedPath { + public GeneratedPath() { + PathBuilder builder = new PathBuilder(); + + builder + .addPath( + // Line 1 + new BezierLine( + new Point(9.757, 84.983, Point.CARTESIAN), + new Point(28.573, 76.302, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 2 + new BezierLine( + new Point(28.573, 76.302, Point.CARTESIAN), + new Point(36.203, 76.140, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 3 + new BezierLine( + new Point(36.203, 76.140, Point.CARTESIAN), + new Point(35.067, 35.716, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 4 + new BezierLine( + new Point(35.067, 35.716, Point.CARTESIAN), + new Point(73.705, 34.742, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 5 + new BezierLine( + new Point(73.705, 34.742, Point.CARTESIAN), + new Point(73.705, 24.839, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 6 + new BezierLine( + new Point(73.705, 24.839, Point.CARTESIAN), + new Point(7.630, 26.462, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 7 + new BezierLine( + new Point(7.630, 26.462, Point.CARTESIAN), + new Point(64.126, 22.728, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 8 + new BezierLine( + new Point(64.126, 22.728, Point.CARTESIAN), + new Point(63.964, 13.150, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 9 + new BezierLine( + new Point(63.964, 13.150, Point.CARTESIAN), + new Point(12.338, 15.260, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 10 + new BezierLine( + new Point(12.338, 15.260, Point.CARTESIAN), + new Point(63.802, 13.150, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 11 + new BezierLine( + new Point(63.802, 13.150, Point.CARTESIAN), + new Point(63.639, 11.689, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation() + .addPath( + // Line 12 + new BezierLine( + new Point(63.639, 11.689, Point.CARTESIAN), + new Point(12.014, 11.689, Point.CARTESIAN) + ) + ) + .setTangentHeadingInterpolation(); + } +} diff --git a/TeamCode/src/main/java/nbRedAutoV1/Java.java b/TeamCode/src/main/java/nbRedAutoV1/Java.java new file mode 100644 index 0000000..c8df1e0 --- /dev/null +++ b/TeamCode/src/main/java/nbRedAutoV1/Java.java @@ -0,0 +1,8 @@ +package nbRedAutoV1; + +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.BezierLine; +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.PathBuilder; +import org.firstinspires.ftc.teamcode.pedroPathing.pathGeneration.Point; + +public class Java { +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java index bbef593..6ed40c0 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java @@ -56,19 +56,19 @@ public class PedroConstants { public static final double ROBOT_WEIGHT_IN_KG = 10.5; // Maximum velocity of the robot going forward - public static final double ROBOT_SPEED_FORWARD = 72.0693; + public static final double ROBOT_SPEED_FORWARD = 79.0257; // Maximum velocity of the robot going right - public static final double ROBOT_SPEED_LATERAL = 24.1401; + public static final double ROBOT_SPEED_LATERAL = 12.3941; // Rate of deceleration when power is cut-off when the robot is moving forward - public static final double FORWARD_ZERO_POWER_ACCEL = -74.3779; + public static final double FORWARD_ZERO_POWER_ACCEL = -50.7945; // Rate of deceleration when power is cut-off when the robot is moving to the right - public static final double LATERAL_ZERO_POWER_ACCEL = -111.8409; + public static final double LATERAL_ZERO_POWER_ACCEL = -92.733; // Determines how fast your robot will decelerate as a factor of how fast your robot will coast to a stop - public static final double ZERO_POWER_ACCEL_MULT = 4; + public static final double ZERO_POWER_ACCEL_MULT = 2.5; /* Centripetal force correction - increase if robot is correcting into the path - decrease if robot is correcting away from the path */ diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/TUNING.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/TUNING.md index bd22f46..c7fa481 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/TUNING.md +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/TUNING.md @@ -71,7 +71,8 @@ measurements will be in centimeters. of how fast your robot will coast to a stop. Honestly, this is up to you. I personally used 4, but what works best for you is most important. Higher numbers will cause a faster brake, but increase oscillations at the end. Lower numbers will do the opposite. This can be found on line `107` in - `FollowerConstants`, named `zeroPowerAccelerationMultiplier`. The drive PID is much, much more sensitive than the others. For reference, + `FollowerConstants`, named `zeroPowerAccelerationMultiplier`. The drive PID is much, much more +* sensitive than the others. For reference, my P values were in the hundredths and thousandths place values, and my D values were in the hundred thousandths and millionths place values. To tune this, enable `useDrive`, `useHeading`, and `useTranslational` in the `Follower` dropdown in FTC Dashboard. Next, run `StraightBackAndForth` diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/tuning/FollowerConstants.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/tuning/FollowerConstants.java index ba53959..4830913 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/tuning/FollowerConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/tuning/FollowerConstants.java @@ -40,7 +40,7 @@ public class FollowerConstants { // Translational PIDF coefficients (don't use integral) public static CustomPIDFCoefficients translationalPIDFCoefficients = new CustomPIDFCoefficients( - 0.06, + 0.1, 0, 0, 0);