Added Robot.cancelAll() and remapped some buttons similar to FRC.

This commit is contained in:
Titan Robotics Club
2024-08-24 23:27:49 -07:00
parent f7a1dc0a9c
commit 5cf9a40402
2 changed files with 21 additions and 16 deletions

View File

@ -249,22 +249,6 @@ public class FtcTeleOp extends FtcOpMode
switch (button)
{
case A:
case B:
break;
case X:
if (pressed)
{
robot.globalTracer.traceInfo(moduleName, ">>>>> CancelAll is pressed.");
if (robot.robotDrive != null)
{
// Cancel all auto-assist driving.
robot.robotDrive.cancel();
}
}
break;
case Y:
// Toggle between field or robot oriented driving, only applicable for holonomic drive base.
if (driverAltFunc)
{
@ -302,6 +286,11 @@ public class FtcTeleOp extends FtcOpMode
}
break;
case B:
case X:
case Y:
break;
case LeftBumper:
robot.globalTracer.traceInfo(moduleName, ">>>>> DriverAltFunc=" + pressed);
driverAltFunc = pressed;
@ -333,6 +322,7 @@ public class FtcTeleOp extends FtcOpMode
if (pressed)
{
robot.globalTracer.traceInfo(moduleName, ">>>>> ZeroCalibrate pressed.");
robot.cancelAll();
robot.zeroCalibrate();
if (robot.robotDrive != null && robot.robotDrive instanceof FtcSwerveDrive)
{
@ -404,6 +394,7 @@ public class FtcTeleOp extends FtcOpMode
{
// Zero calibrate all subsystems (arm, elevator and turret).
robot.globalTracer.traceInfo(moduleName, ">>>>> ZeroCalibrate pressed.");
robot.cancelAll();
robot.zeroCalibrate(moduleName);
}
break;

View File

@ -272,6 +272,20 @@ public class Robot
}
} //updateStatus
/**
* This method is called to cancel all pending operations and release the ownership of all subsystems.
*/
public void cancelAll()
{
globalTracer.traceInfo(moduleName, "Cancel all operations.");
if (robotDrive != null)
{
// Cancel all auto-assist driving.
robotDrive.cancel();
}
} //cancelAll
/**
* This method zero calibrates all subsystems.
*