Adapting the sample ConceptAutoDriveToAprilTagOmni to Autonomous

We’ve had good results using this very helpful sample as a TeleOp OpMode. But in Autonomous the question is how to know when the automatic drive is complete and the robot is positioned in front of the desired AprilTag. Do we need to check that the rangeError, headingError, and yawError have not changed in a certain amount of time or is there a better way?

If you’re going to adapt the RobotAutoDriveToAprilTagOmni.java sample to autonomous, the first step is truly understand the sample code. How does the robot know when to stop driving?

Currently the sample uses the three local variables (that you’ve identified) to drive the robot. Do we have to “watch” the values to see “if they haven’t changed in a while” or can we be smarter?

  1. When the desiredTag.ftcPose.range is not equal to the DESIRED_DISTANCE global variable, the rangeError is the difference between the two - when that difference is nonzero, it causes the robot to drive.

  2. When the yawError is nonzero, it causes the robot to strafe.

  3. When the headingError is nonzero, it causes the robot to turn.

Is there some value you can check to know when the robot no longer has to do anything else to drive to the location? I think so.

-Danny