mirror of
https://github.com/trc492/FtcTemplate.git
synced 2025-07-01 13:01:24 -07:00
Made Drive PID tuning re-read Dashboard whenever the robot is back at startPoint.
This commit is contained in:
@ -248,18 +248,6 @@ public class FtcTest extends FtcTeleOp
|
||||
TrcDbgTrace.MsgLevel.INFO, logEvents, debugPid, false);
|
||||
}
|
||||
break;
|
||||
|
||||
case TUNE_DRIVE_PID:
|
||||
if (robot.robotDrive != null && robot.robotDrive.purePursuitDrive != null)
|
||||
{
|
||||
robot.robotDrive.driveBase.resetOdometry();
|
||||
tuneDriveStartPoint = robot.robotDrive.driveBase.getFieldPosition();
|
||||
tuneDriveEndPoint = tuneDriveStartPoint.addRelativePose(
|
||||
new TrcPose2D(Dashboard.Drive.xTarget*12.0, Dashboard.Drive.yTarget*12.0,
|
||||
Dashboard.Drive.turnTarget));
|
||||
tuneDriveAtEndPoint = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} //startMode
|
||||
|
||||
@ -508,10 +496,21 @@ public class FtcTest extends FtcTeleOp
|
||||
switch (button)
|
||||
{
|
||||
case A:
|
||||
if (robot.robotDrive != null && testChoices.test == Test.TUNE_DRIVE_PID)
|
||||
if (testChoices.test == Test.TUNE_DRIVE_PID)
|
||||
{
|
||||
if (robot.robotDrive != null && robot.robotDrive.purePursuitDrive != null)
|
||||
{
|
||||
if (pressed)
|
||||
{
|
||||
if (!tuneDriveAtEndPoint)
|
||||
{
|
||||
robot.robotDrive.driveBase.resetOdometry();
|
||||
tuneDriveStartPoint = robot.robotDrive.driveBase.getFieldPosition();
|
||||
tuneDriveEndPoint = tuneDriveStartPoint.addRelativePose(
|
||||
new TrcPose2D(Dashboard.Drive.xTarget*12.0, Dashboard.Drive.yTarget*12.0,
|
||||
Dashboard.Drive.turnTarget));
|
||||
tuneDriveAtEndPoint = false;
|
||||
}
|
||||
robot.robotDrive.purePursuitDrive.setXPositionPidCoefficients(Dashboard.Drive.xPidCoeffs);
|
||||
robot.robotDrive.purePursuitDrive.setYPositionPidCoefficients(Dashboard.Drive.yPidCoeffs);
|
||||
robot.robotDrive.purePursuitDrive.setTurnPidCoefficients(Dashboard.Drive.turnPidCoeffs);
|
||||
@ -527,6 +526,7 @@ public class FtcTest extends FtcTeleOp
|
||||
}
|
||||
passToTeleOp = false;
|
||||
}
|
||||
}
|
||||
else if (testChoices.test == Test.CALIBRATE_SWERVE_STEERING)
|
||||
{
|
||||
if (pressed && robot.robotDrive != null && robot.robotDrive instanceof FtcSwerveDrive)
|
||||
|
Reference in New Issue
Block a user