Class TrackingWheelForwardOffsetTuner
java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
org.firstinspires.ftc.teamcode.subsystems.roadrunner.drive.opmode.TrackingWheelForwardOffsetTuner
@Autonomous(group="drive")
public class TrackingWheelForwardOffsetTuner
extends com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
This routine determines the effective forward offset for the lateral tracking wheel.
The procedure executes a point turn at a given angle for a certain number of trials,
along with a specified delay in milliseconds. The purpose of this is to track the
change in the y position during the turn. The offset, or distance, of the lateral tracking
wheel from the center or rotation allows the wheel to spin during a point turn, leading
to an incorrect measurement for the y position. This creates an arc around around
the center of rotation with an arc length of change in y and a radius equal to the forward
offset. We can compute this offset by calculating (change in y position) / (change in heading)
which returns the radius if the angle (change in heading) is in radians. This is based
on the arc length formula of length = theta * radius.
To run this routine, simply adjust the desired angle and specify the number of trials and the desired delay. Then, run the procedure. Once it finishes, it will print the average of all the calculated forward offsets derived from the calculation. This calculated forward offset is then added onto the current forward offset to produce an overall estimate for the forward offset. You can run this procedure as many times as necessary until a satisfactory result is produced.
-
Field Summary
Modifier and TypeFieldDescriptionstatic double
static int
com.qualcomm.robotcore.hardware.Gamepad
com.qualcomm.robotcore.hardware.Gamepad
com.qualcomm.robotcore.hardware.HardwareMap
static final int
int
Deprecated.static int
org.firstinspires.ftc.robotcore.external.Telemetry
Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time
-
Constructor Summary
-
Method Summary
Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
idle, init, init_loop, isStarted, isStopRequested, loop, opModeInInit, opModeIsActive, sleep, start, stop, waitForStart
Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode
getRuntime, internalPostInitLoop, internalPostLoop, internalPreInit, internalUpdateTelemetryNow, resetRuntime, terminateOpModeNow, updateTelemetry
-
Field Details
-
ANGLE
public static double ANGLE -
NUM_TRIALS
public static int NUM_TRIALS -
DELAY
public static int DELAY -
MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED
public static final int MS_BEFORE_FORCE_STOP_AFTER_STOP_REQUESTED- See Also:
-
gamepad1
public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad1 -
gamepad2
public volatile com.qualcomm.robotcore.hardware.Gamepad gamepad2 -
telemetry
public org.firstinspires.ftc.robotcore.external.Telemetry telemetry -
hardwareMap
public volatile com.qualcomm.robotcore.hardware.HardwareMap hardwareMap -
msStuckDetectStop
Deprecated.
-
-
Constructor Details
-
TrackingWheelForwardOffsetTuner
public TrackingWheelForwardOffsetTuner()
-
-
Method Details
-
runOpMode
- Specified by:
runOpMode
in classcom.qualcomm.robotcore.eventloop.opmode.LinearOpMode
- Throws:
InterruptedException
-
requestOpModeStop
public final void requestOpModeStop()
-