|
6 | 6 | import static org.firstinspires.ftc.teamcode.pedroPathing.Tuning.follower; |
7 | 7 | import static org.firstinspires.ftc.teamcode.pedroPathing.Tuning.stopRobot; |
8 | 8 | import static org.firstinspires.ftc.teamcode.pedroPathing.Tuning.telemetryM; |
| 9 | +import static org.firstinspires.ftc.teamcode.pedroPathing.Tuning.format; |
9 | 10 |
|
10 | 11 | import com.bylazar.configurables.PanelsConfigurables; |
11 | 12 | import com.bylazar.configurables.annotations.Configurable; |
@@ -127,6 +128,10 @@ public static void stopRobot() { |
127 | 128 | follower.startTeleopDrive(true); |
128 | 129 | follower.setTeleOpDrive(0,0,0,true); |
129 | 130 | } |
| 131 | + |
| 132 | + public static String format(double value, int decimalPlaces) { |
| 133 | + return String.format("%." + decimalPlaces + "f", value); |
| 134 | + } |
130 | 135 | } |
131 | 136 |
|
132 | 137 | /** |
@@ -429,7 +434,7 @@ public void loop() { |
429 | 434 | average += velocity; |
430 | 435 | } |
431 | 436 | average /= velocities.size(); |
432 | | - telemetryM.debug("Forward Velocity: " + average); |
| 437 | + telemetryM.debug("Forward Velocity: " + format(average, 3)); |
433 | 438 | telemetryM.debug("\n"); |
434 | 439 | telemetryM.debug("Press A to set the Forward Velocity temporarily (while robot remains on)."); |
435 | 440 |
|
@@ -537,7 +542,7 @@ public void loop() { |
537 | 542 | } |
538 | 543 | average /= velocities.size(); |
539 | 544 |
|
540 | | - telemetryM.debug("Strafe Velocity: " + average); |
| 545 | + telemetryM.debug("Strafe Velocity: " + format(average, 3)); |
541 | 546 | telemetryM.debug("\n"); |
542 | 547 | telemetryM.debug("Press A to set the Lateral Velocity temporarily (while robot remains on)."); |
543 | 548 | telemetryM.update(telemetry); |
@@ -643,7 +648,7 @@ public void loop() { |
643 | 648 | } |
644 | 649 | average /= accelerations.size(); |
645 | 650 |
|
646 | | - telemetryM.debug("Forward Zero Power Acceleration (Deceleration): " + average); |
| 651 | + telemetryM.debug("Forward Zero Power Acceleration (Deceleration): " + format(average, 3)); |
647 | 652 | telemetryM.debug("\n"); |
648 | 653 | telemetryM.debug("Press A to set the Forward Zero Power Acceleration temporarily (while robot remains on)."); |
649 | 654 | telemetryM.update(telemetry); |
@@ -747,7 +752,7 @@ public void loop() { |
747 | 752 | } |
748 | 753 | average /= accelerations.size(); |
749 | 754 |
|
750 | | - telemetryM.debug("Lateral Zero Power Acceleration (Deceleration): " + average); |
| 755 | + telemetryM.debug("Lateral Zero Power Acceleration (Deceleration): " + format(average, 3)); |
751 | 756 | telemetryM.debug("\n"); |
752 | 757 | telemetryM.debug("Press A to set the Lateral Zero Power Acceleration temporarily (while robot remains on)."); |
753 | 758 | telemetryM.update(telemetry); |
@@ -919,13 +924,13 @@ public void loop() { |
919 | 924 |
|
920 | 925 | telemetryM.debug("Tuning Complete"); |
921 | 926 | telemetryM.debug("Braking Profile:"); |
922 | | - telemetryM.debug("kQuadratic", String.format("%.8f", coefficients[1])); |
923 | | - telemetryM.debug("kLinear", String.format("%.8f", coefficients[0])); |
| 927 | + telemetryM.debug("kQuadratic", format(coefficients[1], 8))); |
| 928 | + telemetryM.debug("kLinear", format(coefficients[0], 7)); |
924 | 929 | telemetryM.update(telemetry); |
925 | 930 | telemetryM.debug("Tuning Complete"); |
926 | 931 | telemetryM.debug("Braking Profile:"); |
927 | | - telemetryM.debug("kQuadraticFriction", String.format("%.8f", coefficients[1])); |
928 | | - telemetryM.debug("kLinearBraking", String.format("%.8f", coefficients[0])); |
| 932 | + telemetryM.debug("kQuadraticFriction", format(coefficients[1], 8)); |
| 933 | + telemetryM.debug("kLinearBraking", format(coefficients[0], 7)); |
929 | 934 | for (BrakeRecord record : brakeData) { |
930 | 935 | Pose p = record.pose; |
931 | 936 | telemetryM.debug(String.format("t=%.0f ms, x=%.2f, y=%.2f, θ=%.2f, v=%.2f", |
|
0 commit comments