@@ -84,6 +84,8 @@ public Tuning() {
8484 });
8585 s .folder ("Swerve" , p -> {
8686 p .add ("Analog Min / Max Tuner" , AnalogMinMaxTuner ::new );
87+ p .add ("Swerve Offsets Test" , SwerveOffsetsTest ::new );
88+ p .add ("Swerve Turn Test" , SwerveTurnTest ::new );
8789 });
8890 });
8991 }
@@ -129,12 +131,13 @@ public static void stopRobot() {
129131}
130132
131133/**
132- * This is the LocalizationTest OpMode. This is basically just a simple mecanum drive attached to a
134+ * This is the LocalizationTest OpMode. This is basically just a simple drive attached to a
133135 * PoseUpdater. The OpMode will print out the robot's pose to telemetry as well as draw the robot.
134136 * You should use this to check the robot's localization.
135137 *
136138 * @author Anyi Lin - 10158 Scott's Bots
137139 * @author Baron Henderson - 20077 The Indubitables
140+ * @author Kabir Goyal
138141 * @version 1.0, 5/6/2024
139142 */
140143class LocalizationTest extends OpMode {
@@ -143,7 +146,7 @@ class LocalizationTest extends OpMode {
143146 @ Override
144147 public void init () {}
145148
146- /** This initializes the PoseUpdater, the mecanum drive motors, and the Panels telemetry. */
149+ /** This initializes the PoseUpdater, the drive motors, and the Panels telemetry. */
147150 @ Override
148151 public void init_loop () {
149152 if (gamepad1 .aWasPressed () || gamepad2 .aWasPressed ()) {
@@ -152,7 +155,7 @@ public void init_loop() {
152155
153156
154157 telemetryM .debug ("This will print your robot's position to telemetry while "
155- + "allowing robot control through a basic mecanum drive on gamepad 1." );
158+ + "allowing robot control through a basic drive on gamepad 1." );
156159 telemetryM .debug ("Drivetrain debug string " + (((debugStringEnabled ) ? "enabled" : "disabled" )) +
157160 " (press gamepad a to toggle)" );
158161 telemetryM .update (telemetry );
@@ -167,7 +170,7 @@ public void start() {
167170 }
168171
169172 /**
170- * This updates the robot's pose estimate, the simple mecanum drive, and updates the
173+ * This updates the robot's pose estimate, the simple drive, and updates the
171174 * Panels telemetry with the robot's position as well as draws the robot's position.
172175 */
173176 @ Override
@@ -341,7 +344,7 @@ public void loop() {
341344 * reaching the end of the distance, it averages them and prints out the velocity obtained. It is
342345 * recommended to run this multiple times on a full battery to get the best results. What this does
343346 * is, when paired with StrafeVelocityTuner, allows FollowerConstants to create a Vector that
344- * empirically represents the direction your mecanum wheels actually prefer to go in, allowing for
347+ * empirically represents the direction your wheels actually prefer to go in, allowing for
345348 * more accurate following.
346349 *
347350 * @author Anyi Lin - 10158 Scott's Bots
@@ -446,7 +449,7 @@ public void loop() {
446449 * reaching the end of the distance, it averages them and prints out the velocity obtained. It is
447450 * recommended to run this multiple times on a full battery to get the best results. What this does
448451 * is, when paired with ForwardVelocityTuner, allows FollowerConstants to create a Vector that
449- * empirically represents the direction your mecanum wheels actually prefer to go in, allowing for
452+ * empirically represents the direction your wheels actually prefer to go in, allowing for
450453 * more accurate following.
451454 *
452455 * @author Anyi Lin - 10158 Scott's Bots
@@ -1490,6 +1493,122 @@ public void loop() {
14901493 }
14911494}
14921495
1496+ /**
1497+ * This is the SwerveOffsetsTest
1498+ * You should use this to check how good your swerve angle offsets are and if your motor directions are correct
1499+ * @author Kabir Goyal
1500+ *
1501+ */
1502+ class SwerveOffsetsTest extends OpMode {
1503+ boolean debugStringEnabled = false ;
1504+
1505+ @ Override
1506+ public void init () {}
1507+
1508+ /** This initializes the PoseUpdater, the drive motors, and the Panels telemetry. */
1509+ @ Override
1510+ public void init_loop () {
1511+ if (gamepad1 .aWasPressed () || gamepad2 .aWasPressed ()) {
1512+ debugStringEnabled = !debugStringEnabled ;
1513+ }
1514+
1515+
1516+ telemetryM .debug ("This OpMode will run all four swerve pods in the direction they think is forward"
1517+ + "\n ensure your bot is not on the ground while running" );
1518+ telemetryM .debug ("Drivetrain debug string " + (((debugStringEnabled ) ? "enabled" : "disabled" )) +
1519+ " (press gamepad a to toggle)" );
1520+ telemetryM .update (telemetry );
1521+ follower .update ();
1522+ drawCurrent ();
1523+ }
1524+
1525+ @ Override
1526+ public void start () {
1527+ follower .startTeleopDrive ();
1528+ follower .update ();
1529+ }
1530+
1531+ /**
1532+ * This updates the robot's pose estimate, the simple drive, and updates the
1533+ * Panels telemetry with the robot's position as well as draws the robot's position.
1534+ */
1535+ @ Override
1536+ public void loop () {
1537+ if (gamepad1 .aWasPressed () || gamepad2 .aWasPressed ()) {
1538+ debugStringEnabled = !debugStringEnabled ;
1539+ }
1540+
1541+ follower .setTeleOpDrive (0.25 , 0 , 0 , true );
1542+ follower .update ();
1543+
1544+ if (debugStringEnabled ) {
1545+ telemetryM .debug ("Drivetrain Debug String:\n " +
1546+ follower .getDrivetrain ().debugString ());
1547+ }
1548+ telemetryM .update (telemetry );
1549+
1550+ drawCurrentAndHistory ();
1551+ }
1552+ }
1553+
1554+ /**
1555+ * This is the SwerveTurnTest
1556+ * You should use this to check your encoder directions and x/y pod offsets
1557+ * @author Kabir Goyal
1558+ *
1559+ */
1560+ class SwerveTurnTest extends OpMode {
1561+ boolean debugStringEnabled = false ;
1562+
1563+ @ Override
1564+ public void init () {}
1565+
1566+ /** This initializes the PoseUpdater, the drive motors, and the Panels telemetry. */
1567+ @ Override
1568+ public void init_loop () {
1569+ if (gamepad1 .aWasPressed () || gamepad2 .aWasPressed ()) {
1570+ debugStringEnabled = !debugStringEnabled ;
1571+ }
1572+
1573+
1574+ telemetryM .debug ("This OpMode will run all four swerve pods in their turning direction (perpendicular to the center of the robot) "
1575+ + "\n run this once off the ground to check servo directions and motor directions before testing on the ground" );
1576+ telemetryM .debug ("Drivetrain debug string " + (((debugStringEnabled ) ? "enabled" : "disabled" )) +
1577+ " (press gamepad a to toggle)" );
1578+ telemetryM .update (telemetry );
1579+ follower .update ();
1580+ drawCurrent ();
1581+ }
1582+
1583+ @ Override
1584+ public void start () {
1585+ follower .startTeleopDrive ();
1586+ follower .update ();
1587+ }
1588+
1589+ /**
1590+ * This updates the robot's pose estimate, the simple drive, and updates the
1591+ * Panels telemetry with the robot's position as well as draws the robot's position.
1592+ */
1593+ @ Override
1594+ public void loop () {
1595+ if (gamepad1 .aWasPressed () || gamepad2 .aWasPressed ()) {
1596+ debugStringEnabled = !debugStringEnabled ;
1597+ }
1598+
1599+ follower .setTeleOpDrive (0 , 0 , 0.25 , true );
1600+ follower .update ();
1601+
1602+ if (debugStringEnabled ) {
1603+ telemetryM .debug ("Drivetrain Debug String:\n " +
1604+ follower .getDrivetrain ().debugString ());
1605+ }
1606+ telemetryM .update (telemetry );
1607+
1608+ drawCurrentAndHistory ();
1609+ }
1610+ }
1611+
14931612
14941613/**
14951614 * This is the Drawing class. It handles the drawing of stuff on Panels Dashboard, like the robot.
0 commit comments