<xml xmlns="https://developers.google.com/blockly/xml"><variables><variable id="roundtrip_var_validFps">validFps</variable><variable id="roundtrip_var_pinMm">pinMm</variable><variable id="roundtrip_var_power">power</variable><variable id="roundtrip_var_phase">phase</variable><variable id="roundtrip_var_displayPhase">displayPhase</variable><variable id="roundtrip_var_reason">reason</variable><variable id="roundtrip_var_targetMm">targetMm</variable><variable id="roundtrip_var_settleUntil">settleUntil</variable><variable id="roundtrip_var_targetInches">targetInches</variable></variables><block type="procedures_defnoreturn" id="roundtrip_0246" x="30" y="30"><field name="NAME">runOpMode</field><statement name="STACK"><block type="procedures_callnoreturn" id="roundtrip_0222"><mutation name="configureRoundTrip"/><next><block type="comment" id="student_roundtrip_init"><field name="COMMENT">Look at sensors while staying still
INIT updates sensor observations and displays them while repeatedly requesting zero power. This is a chance to inspect readings before START. Displaying a range reading does not make it a motion guard: the INIT ranges are display-only.
For example: A range value can change while the robot is in INIT, but that display does not add an automatic obstacle stop to this program.
Think first: What should the motor command be throughout INIT?</field><next><block type="controls_whileUntil" id="roundtrip_0235"><field name="MODE">WHILE</field><value name="BOOL"><block type="linearOpMode_opModeInInit" id="roundtrip_0224"/></value><statement name="DO"><block type="misc_callJava_noReturn" id="roundtrip_0226"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripObserve(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="initPhase" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripObserve</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0225"><field name="BOOL">TRUE</field></block></value><next><block type="misc_callJava_noReturn" id="roundtrip_0231"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripReport(java.lang.String,java.lang.String,double,double) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="4" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="java.lang.String" argLabel0="phase" argAuto0="" argType1="java.lang.String" argLabel1="reason" argAuto1="" argType2="double" argLabel2="commandedPower" argAuto2="" argType3="double" argLabel3="targetInches" argAuto3=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripReport</field><value name="ARG0"><block type="text" id="roundtrip_0227"><field name="TEXT">INIT</field></block></value><value name="ARG1"><block type="text" id="roundtrip_0228"><field name="TEXT">INIT observation only; zero output</field></block></value><value name="ARG2"><block type="math_number" id="roundtrip_0229"><field name="NUM">0</field></block></value><value name="ARG3"><block type="variables_get" id="roundtrip_0230"><field name="VAR" id="roundtrip_var_targetInches">targetInches</field></block></value><next><block type="procedures_callnoreturn" id="roundtrip_0232"><mutation name="zeroDrive"/><next><block type="linearOpMode_sleep_Number" id="roundtrip_0234"><value name="MILLISECONDS"><block type="math_number" id="roundtrip_0233"><field name="NUM">10</field></block></value></block></next></block></next></block></next></block></statement><next><block type="linearOpMode_waitForStart" id="roundtrip_0236"><next><block type="comment" id="student_roundtrip_calibrationlimits"><field name="COMMENT">Compare measurements with a real reference
Pinpoint, wheels, and the camera estimate travel in different ways. Compare their settled changes with a tape measurement in matching units and directions. Two estimates can share a scale error, so agreement alone does not replace the tape. The camera neither chooses a distance stop nor automatically fits a scale. A stationary cluster is a local reference; a tag on a moving HIVE moves too, so it is not fixed field GPS.
For example: Against 900 mm on the tape, an estimate of 914.4 mm is 14.4 mm high. At the return origin, report signed millimeters from zero rather than dividing by a zero reference.
Think first: If wheels and Pinpoint both read 914.4 mm but tape reads 900 mm, what should you investigate?</field><next><block type="controls_whileUntil" id="roundtrip_0242"><field name="MODE">WHILE</field><value name="BOOL"><block type="linearOpMode_opModeIsActive" id="roundtrip_0238"/></value><statement name="DO"><block type="procedures_callnoreturn" id="roundtrip_0239"><mutation name="roundTripTick"/><next><block type="linearOpMode_sleep_Number" id="roundtrip_0241"><value name="MILLISECONDS"><block type="math_number" id="roundtrip_0240"><field name="NUM">5</field></block></value></block></next></block></statement><next><block type="comment" id="student_roundtrip_stop"><field name="COMMENT">End the trial, not just pause it
Driver Station STOP ends the active program. Exit cleanup requests zero, stops vision, and closes the measurement session. Releasing the bumper is different: it pauses travel but leaves the trip available to resume. An unfinished trip is not appended as a completed result.
For example: Use bumper release for a planned pause on a clear path. Use Driver Station STOP promptly for drift, an obstruction, or stalled motion.
Think first: Can you resume the same active trip by holding the bumper after Driver Station STOP?</field><next><block type="procedures_callnoreturn" id="roundtrip_0244"><mutation name="zeroDrive"/><next><block type="misc_callJava_noReturn" id="roundtrip_0245"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripEnd() void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripEnd</field></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="roundtrip_0247" x="30" y="816"><field name="NAME">configureRoundTrip</field><statement name="STACK"><block type="comment" id="student_roundtrip_setup"><field name="COMMENT">Give four motors a shared convention
Setup configures front-right FORWARD and the other three motors REVERSE, with BRAKE and RUN_USING_ENCODER on all four. These settings define how a shared signed power command is applied. The program starts with zero power and a WAIT phase, so preparation is separate from travel.
For example: All four motors can receive +0.10 even though their configured direction labels are not all the same. Wiring and mounting determine how those settings produce chassis motion.
Think first: Does BRAKE mean the robot cannot coast at all?</field><next><block type="dcMotor_setProperty_Direction" id="roundtrip_0167"><field name="IDENTIFIER">front_left_driveAsDcMotor</field><field name="PROP">Direction</field><value name="VALUE"><block type="dcMotor_typedEnum_direction" id="roundtrip_0166"><field name="DIRECTION">REVERSE</field></block></value><next><block type="dcMotor_setProperty_Direction" id="roundtrip_0169"><field name="IDENTIFIER">back_left_driveAsDcMotor</field><field name="PROP">Direction</field><value name="VALUE"><block type="dcMotor_typedEnum_direction" id="roundtrip_0168"><field name="DIRECTION">REVERSE</field></block></value><next><block type="dcMotor_setProperty_Direction" id="roundtrip_0171"><field name="IDENTIFIER">front_right_driveAsDcMotor</field><field name="PROP">Direction</field><value name="VALUE"><block type="dcMotor_typedEnum_direction" id="roundtrip_0170"><field name="DIRECTION">FORWARD</field></block></value><next><block type="dcMotor_setProperty_Direction" id="roundtrip_0173"><field name="IDENTIFIER">back_right_driveAsDcMotor</field><field name="PROP">Direction</field><value name="VALUE"><block type="dcMotor_typedEnum_direction" id="roundtrip_0172"><field name="DIRECTION">REVERSE</field></block></value><next><block type="dcMotor_setProperty_ZeroPowerBehavior" id="roundtrip_0175"><field name="IDENTIFIER">front_left_driveAsDcMotor</field><field name="PROP">ZeroPowerBehavior</field><value name="VALUE"><block type="dcMotor_typedEnum_zeroPowerBehavior" id="roundtrip_0174"><field name="ZERO_POWER_BEHAVIOR">BRAKE</field></block></value><next><block type="dcMotor_setProperty_ZeroPowerBehavior" id="roundtrip_0177"><field name="IDENTIFIER">back_left_driveAsDcMotor</field><field name="PROP">ZeroPowerBehavior</field><value name="VALUE"><block type="dcMotor_typedEnum_zeroPowerBehavior" id="roundtrip_0176"><field name="ZERO_POWER_BEHAVIOR">BRAKE</field></block></value><next><block type="dcMotor_setProperty_ZeroPowerBehavior" id="roundtrip_0179"><field name="IDENTIFIER">front_right_driveAsDcMotor</field><field name="PROP">ZeroPowerBehavior</field><value name="VALUE"><block type="dcMotor_typedEnum_zeroPowerBehavior" id="roundtrip_0178"><field name="ZERO_POWER_BEHAVIOR">BRAKE</field></block></value><next><block type="dcMotor_setProperty_ZeroPowerBehavior" id="roundtrip_0181"><field name="IDENTIFIER">back_right_driveAsDcMotor</field><field name="PROP">ZeroPowerBehavior</field><value name="VALUE"><block type="dcMotor_typedEnum_zeroPowerBehavior" id="roundtrip_0180"><field name="ZERO_POWER_BEHAVIOR">BRAKE</field></block></value><next><block type="dcMotor_setProperty_RunMode" id="roundtrip_0183"><field name="IDENTIFIER">front_left_driveAsDcMotor</field><field name="PROP">Mode</field><value name="VALUE"><block type="dcMotor_typedEnum_runMode" id="roundtrip_0182"><field name="RUN_MODE">RUN_USING_ENCODER</field></block></value><next><block type="dcMotor_setProperty_RunMode" id="roundtrip_0185"><field name="IDENTIFIER">back_left_driveAsDcMotor</field><field name="PROP">Mode</field><value name="VALUE"><block type="dcMotor_typedEnum_runMode" id="roundtrip_0184"><field name="RUN_MODE">RUN_USING_ENCODER</field></block></value><next><block type="dcMotor_setProperty_RunMode" id="roundtrip_0187"><field name="IDENTIFIER">front_right_driveAsDcMotor</field><field name="PROP">Mode</field><value name="VALUE"><block type="dcMotor_typedEnum_runMode" id="roundtrip_0186"><field name="RUN_MODE">RUN_USING_ENCODER</field></block></value><next><block type="dcMotor_setProperty_RunMode" id="roundtrip_0189"><field name="IDENTIFIER">back_right_driveAsDcMotor</field><field name="PROP">Mode</field><value name="VALUE"><block type="dcMotor_typedEnum_runMode" id="roundtrip_0188"><field name="RUN_MODE">RUN_USING_ENCODER</field></block></value><next><block type="procedures_callnoreturn" id="roundtrip_0190"><mutation name="zeroDrive"/><next><block type="misc_callJava_noReturn" id="roundtrip_0191"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripBegin() void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripBegin</field><next><block type="comment" id="student_roundtrip_math"><field name="COMMENT">Put the target in the sensor's units
The default target is 36 inches. Multiplying by 25.4 converts it to 914.4 millimeters, the unit used for the Pinpoint endpoint comparison. The target is the one-way distance, not the sum of the out and return legs.
For example: A 12-inch target would convert to 304.8 mm. With supervisor review, editing targetInches to 6, 12, 24, or 36 uses one of the helper's accepted targets.
Think first: If the default target is 914.4 mm, should the outward threshold be twice that for an out-and-back trip?</field><next><block type="variables_set" id="roundtrip_0194"><field name="VAR" id="roundtrip_var_targetInches">targetInches</field><value name="VALUE"><block type="math_number" id="roundtrip_0193"><field name="NUM">36</field></block></value><next><block type="variables_set" id="roundtrip_0198"><field name="VAR" id="roundtrip_var_targetMm">targetMm</field><value name="VALUE"><block type="math_arithmetic" id="roundtrip_0197"><field name="OP">MULTIPLY</field><value name="A"><block type="variables_get" id="roundtrip_0195"><field name="VAR" id="roundtrip_var_targetInches">targetInches</field></block></value><value name="B"><block type="math_number" id="roundtrip_0196"><field name="NUM">25.4</field></block></value></block></value><next><block type="variables_set" id="roundtrip_0200"><field name="VAR" id="roundtrip_var_power">power</field><value name="VALUE"><block type="math_number" id="roundtrip_0199"><field name="NUM">0</field></block></value><next><block type="variables_set" id="roundtrip_0202"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0201"><field name="TEXT">WAIT</field></block></value><next><block type="variables_set" id="roundtrip_0204"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="text" id="roundtrip_0203"><field name="TEXT">WAIT</field></block></value><next><block type="variables_set" id="roundtrip_0206"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0205"><field name="TEXT">Waiting for baseline gates</field></block></value><next><block type="variables_set" id="roundtrip_0208"><field name="VAR" id="roundtrip_var_validFps">validFps</field><value name="VALUE"><block type="math_number" id="roundtrip_0207"><field name="NUM">0</field></block></value><next><block type="variables_set" id="roundtrip_0210"><field name="VAR" id="roundtrip_var_pinMm">pinMm</field><value name="VALUE"><block type="math_number" id="roundtrip_0209"><field name="NUM">0</field></block></value><next><block type="variables_set" id="roundtrip_0212"><field name="VAR" id="roundtrip_var_settleUntil">settleUntil</field><value name="VALUE"><block type="math_number" id="roundtrip_0211"><field name="NUM">0</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="roundtrip_0248" x="30" y="1622"><field name="NAME">roundTripTick</field><statement name="STACK"><block type="comment" id="student_roundtrip_gates"><field name="COMMENT">Require a driver and fresh observations
Motion requires LEFT BUMPER held AND at least five distinct valid cluster frames in the rolling last second. A frame is one camera observation, not one tag. Re-reading the same frame does not make it new. Releasing the bumper or losing the frame gate requests zero; travel resumes only when both gates pass again.
For example: One frame containing four tags, read four times, still counts as one frame. Valid frames A, B, C, D, and E within 0.9 seconds make five observations.
Think first: With five valid recent frames but LEFT BUMPER released, may the motors run?</field><next><block type="misc_callJava_noReturn" id="roundtrip_0003"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripObserve(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="initPhase" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripObserve</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0002"><field name="BOOL">FALSE</field></block></value><next><block type="variables_set" id="roundtrip_0005"><field name="VAR" id="roundtrip_var_validFps">validFps</field><value name="VALUE"><block type="misc_callJava_return" id="roundtrip_0004"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripValidFps() int" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="int" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripValidFps</field></block></value><next><block type="variables_set" id="roundtrip_0007"><field name="VAR" id="roundtrip_var_pinMm">pinMm</field><value name="VALUE"><block type="misc_callJava_return" id="roundtrip_0006"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripPinMm() double" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="double" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripPinMm</field></block></value><next><block type="variables_set" id="roundtrip_0009"><field name="VAR" id="roundtrip_var_power">power</field><value name="VALUE"><block type="math_number" id="roundtrip_0008"><field name="NUM">0</field></block></value><next><block type="variables_set" id="roundtrip_0011"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0010"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><next><block type="controls_if" id="roundtrip_0151"><mutation elseif="5" else="0"/><value name="IF0"><block type="logic_compare" id="roundtrip_0014"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0012"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0013"><field name="TEXT">WAIT</field></block></value></block></value><value name="IF1"><block type="logic_compare" id="roundtrip_0033"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0031"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0032"><field name="TEXT">FORWARD</field></block></value></block></value><value name="IF2"><block type="logic_compare" id="roundtrip_0068"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0066"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0067"><field name="TEXT">FORWARDSETTLE</field></block></value></block></value><value name="IF3"><block type="logic_compare" id="roundtrip_0084"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0082"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0083"><field name="TEXT">BACKWARD</field></block></value></block></value><value name="IF4"><block type="logic_compare" id="roundtrip_0119"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0117"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0118"><field name="TEXT">RETURNSETTLE</field></block></value></block></value><value name="IF5"><block type="logic_operation" id="roundtrip_0148"><field name="OP">OR</field><value name="A"><block type="logic_compare" id="roundtrip_0144"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0142"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0143"><field name="TEXT">COMPLETE</field></block></value></block></value><value name="B"><block type="logic_compare" id="roundtrip_0147"><field name="OP">EQ</field><value name="A"><block type="variables_get" id="roundtrip_0145"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><value name="B"><block type="text" id="roundtrip_0146"><field name="TEXT">CANCELLED</field></block></value></block></value></block></value><statement name="DO0"><block type="comment" id="student_roundtrip_origin"><field name="COMMENT">Remember one starting point
The first time the WAIT gates pass, the program captures the origin and changes to FORWARD. The origin is a software baseline: later readings subtract the starting values rather than resetting the hardware's raw position. It is captured once for this trip, so a pause does not move the origin.
For example: If starting raw X is 1000, a later raw X of 2000 represents a change of 1000 counts—not a trip of 2000 counts. Capturing the origin changes phase; forward power begins on a later loop.
Think first: If you pause halfway out and resume, does the remaining goal become a new 36-inch trip?</field><next><block type="controls_if" id="roundtrip_0030"><mutation elseif="0" else="1"/><value name="IF0"><block type="logic_operation" id="roundtrip_0020"><field name="OP">AND</field><value name="A"><block type="gamepad_getProperty_Boolean" id="roundtrip_0016"><field name="IDENTIFIER">gamepad1</field><field name="PROP">LeftBumper</field></block></value><value name="B"><block type="logic_compare" id="roundtrip_0019"><field name="OP">GTE</field><value name="A"><block type="variables_get" id="roundtrip_0017"><field name="VAR" id="roundtrip_var_validFps">validFps</field></block></value><value name="B"><block type="math_number" id="roundtrip_0018"><field name="NUM">5</field></block></value></block></value></block></value><statement name="DO0"><block type="misc_callJava_noReturn" id="roundtrip_0021"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripCaptureOrigin() void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripCaptureOrigin</field><next><block type="variables_set" id="roundtrip_0023"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0022"><field name="TEXT">FORWARD</field></block></value><next><block type="variables_set" id="roundtrip_0025"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0024"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><next><block type="variables_set" id="roundtrip_0027"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0026"><field name="TEXT">Baseline captured once</field></block></value></block></next></block></next></block></next></block></statement><statement name="ELSE"><block type="variables_set" id="roundtrip_0029"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0028"><field name="TEXT">WAIT: hold LB with &gt;=5 valid distinct frames/s</field></block></value></block></statement></block></next></block></statement><statement name="DO1"><block type="comment" id="student_roundtrip_forward"><field name="COMMENT">Use Pinpoint to choose the outward endpoint
During FORWARD, passing the bumper/frame gates requests +0.10 power. When Pinpoint X displacement reaches or exceeds targetMm, the program commands zero and enters FORWARDSETTLE. Wheels and camera provide comparisons, not the distance-stop decision.
For example: At the default target, Pinpoint reaching 914.4 mm selects the outward stop. A camera estimate of 914.4 mm by itself does not select that stop.
Think first: If the camera and Pinpoint disagree, which measurement chooses this distance endpoint?</field><next><block type="controls_if" id="roundtrip_0065"><mutation elseif="0" else="1"/><value name="IF0"><block type="logic_compare" id="roundtrip_0037"><field name="OP">GTE</field><value name="A"><block type="variables_get" id="roundtrip_0035"><field name="VAR" id="roundtrip_var_pinMm">pinMm</field></block></value><value name="B"><block type="variables_get" id="roundtrip_0036"><field name="VAR" id="roundtrip_var_targetMm">targetMm</field></block></value></block></value><statement name="DO0"><block type="procedures_callnoreturn" id="roundtrip_0038"><mutation name="zeroDrive"/><next><block type="misc_callJava_noReturn" id="roundtrip_0040"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripMarkStop(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="forward" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripMarkStop</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0039"><field name="BOOL">TRUE</field></block></value><next><block type="variables_set" id="roundtrip_0042"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0041"><field name="TEXT">FORWARDSETTLE</field></block></value><next><block type="variables_set" id="roundtrip_0044"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0043"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><next><block type="variables_set" id="roundtrip_0046"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0045"><field name="TEXT">Stopped; settle 0.8 seconds</field></block></value><next><block type="variables_set" id="roundtrip_0050"><field name="VAR" id="roundtrip_var_settleUntil">settleUntil</field><value name="VALUE"><block type="math_arithmetic" id="roundtrip_0049"><field name="OP">ADD</field><value name="A"><block type="misc_callJava_return" id="roundtrip_0047"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripSeconds() double" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="double" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripSeconds</field></block></value><value name="B"><block type="math_number" id="roundtrip_0048"><field name="NUM">0.8</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></statement><statement name="ELSE"><block type="controls_if" id="roundtrip_0064"><mutation elseif="0" else="1"/><value name="IF0"><block type="logic_operation" id="roundtrip_0055"><field name="OP">AND</field><value name="A"><block type="gamepad_getProperty_Boolean" id="roundtrip_0051"><field name="IDENTIFIER">gamepad1</field><field name="PROP">LeftBumper</field></block></value><value name="B"><block type="logic_compare" id="roundtrip_0054"><field name="OP">GTE</field><value name="A"><block type="variables_get" id="roundtrip_0052"><field name="VAR" id="roundtrip_var_validFps">validFps</field></block></value><value name="B"><block type="math_number" id="roundtrip_0053"><field name="NUM">5</field></block></value></block></value></block></value><statement name="DO0"><block type="variables_set" id="roundtrip_0057"><field name="VAR" id="roundtrip_var_power">power</field><value name="VALUE"><block type="math_number" id="roundtrip_0056"><field name="NUM">0.1</field></block></value><next><block type="variables_set" id="roundtrip_0059"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0058"><field name="TEXT">LB held; &gt;=5 distinct valid frames/s</field></block></value></block></next></block></statement><statement name="ELSE"><block type="variables_set" id="roundtrip_0061"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="text" id="roundtrip_0060"><field name="TEXT">PAUSED</field></block></value><next><block type="variables_set" id="roundtrip_0063"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0062"><field name="TEXT">Hold LB and restore &gt;=5 distinct valid frames/s; goal retained</field></block></value></block></next></block></statement></block></statement></block></next></block></statement><statement name="DO2"><block type="comment" id="student_roundtrip_settle"><field name="COMMENT">Measure after the stop has settled
The program waits 0.8 seconds after its endpoint stop command while requesting zero. The endpoint camera median uses frames after the first 0.25 seconds of that wait, reducing the influence of the initial stopping motion. A median is the middle of a sorted set of values; it is a summary, not a promise that every reading is exact.
For example: For camera values 908, 910, and 950 in the chosen measurement axis, the median is 910. Both the outward and return endpoints have a settling phase.
Think first: Does a zero command mean the final position must equal the position at the instant of the command?</field><next><block type="controls_if" id="roundtrip_0081"><mutation elseif="0" else="0"/><value name="IF0"><block type="logic_compare" id="roundtrip_0072"><field name="OP">GTE</field><value name="A"><block type="misc_callJava_return" id="roundtrip_0070"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripSeconds() double" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="double" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripSeconds</field></block></value><value name="B"><block type="variables_get" id="roundtrip_0071"><field name="VAR" id="roundtrip_var_settleUntil">settleUntil</field></block></value></block></value><statement name="DO0"><block type="misc_callJava_noReturn" id="roundtrip_0074"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripCaptureEndpoint(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="forward" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripCaptureEndpoint</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0073"><field name="BOOL">TRUE</field></block></value><next><block type="variables_set" id="roundtrip_0076"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0075"><field name="TEXT">BACKWARD</field></block></value><next><block type="variables_set" id="roundtrip_0078"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0077"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><next><block type="variables_set" id="roundtrip_0080"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0079"><field name="TEXT">Forward endpoint captured; return on next tick</field></block></value></block></next></block></next></block></next></block></statement></block></next></block></statement><statement name="DO3"><block type="comment" id="student_roundtrip_return"><field name="COMMENT">Return toward the same origin
After the outward endpoint is captured, BACKWARD requests −0.10 when both motion gates pass. The return endpoint is selected when Pinpoint displacement is at or below zero. The robot then commands zero and settles again. A pause retains this return goal instead of creating a new origin.
For example: At +300 mm, the return has not reached the software origin. At −2 mm, the ≤ 0 comparison selects the return stop, followed by settling.
Think first: If Pinpoint is already at or below zero, does the program need another camera distance threshold to stop?</field><next><block type="controls_if" id="roundtrip_0116"><mutation elseif="0" else="1"/><value name="IF0"><block type="logic_compare" id="roundtrip_0088"><field name="OP">LTE</field><value name="A"><block type="variables_get" id="roundtrip_0086"><field name="VAR" id="roundtrip_var_pinMm">pinMm</field></block></value><value name="B"><block type="math_number" id="roundtrip_0087"><field name="NUM">0</field></block></value></block></value><statement name="DO0"><block type="procedures_callnoreturn" id="roundtrip_0089"><mutation name="zeroDrive"/><next><block type="misc_callJava_noReturn" id="roundtrip_0091"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripMarkStop(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="forward" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripMarkStop</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0090"><field name="BOOL">FALSE</field></block></value><next><block type="variables_set" id="roundtrip_0093"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0092"><field name="TEXT">RETURNSETTLE</field></block></value><next><block type="variables_set" id="roundtrip_0095"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0094"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value><next><block type="variables_set" id="roundtrip_0097"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0096"><field name="TEXT">Stopped; settle 0.8 seconds</field></block></value><next><block type="variables_set" id="roundtrip_0101"><field name="VAR" id="roundtrip_var_settleUntil">settleUntil</field><value name="VALUE"><block type="math_arithmetic" id="roundtrip_0100"><field name="OP">ADD</field><value name="A"><block type="misc_callJava_return" id="roundtrip_0098"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripSeconds() double" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="double" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripSeconds</field></block></value><value name="B"><block type="math_number" id="roundtrip_0099"><field name="NUM">0.8</field></block></value></block></value></block></next></block></next></block></next></block></next></block></next></block></statement><statement name="ELSE"><block type="controls_if" id="roundtrip_0115"><mutation elseif="0" else="1"/><value name="IF0"><block type="logic_operation" id="roundtrip_0106"><field name="OP">AND</field><value name="A"><block type="gamepad_getProperty_Boolean" id="roundtrip_0102"><field name="IDENTIFIER">gamepad1</field><field name="PROP">LeftBumper</field></block></value><value name="B"><block type="logic_compare" id="roundtrip_0105"><field name="OP">GTE</field><value name="A"><block type="variables_get" id="roundtrip_0103"><field name="VAR" id="roundtrip_var_validFps">validFps</field></block></value><value name="B"><block type="math_number" id="roundtrip_0104"><field name="NUM">5</field></block></value></block></value></block></value><statement name="DO0"><block type="variables_set" id="roundtrip_0108"><field name="VAR" id="roundtrip_var_power">power</field><value name="VALUE"><block type="math_number" id="roundtrip_0107"><field name="NUM">-0.1</field></block></value><next><block type="variables_set" id="roundtrip_0110"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0109"><field name="TEXT">LB held; &gt;=5 distinct valid frames/s</field></block></value></block></next></block></statement><statement name="ELSE"><block type="variables_set" id="roundtrip_0112"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="text" id="roundtrip_0111"><field name="TEXT">PAUSED</field></block></value><next><block type="variables_set" id="roundtrip_0114"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0113"><field name="TEXT">Hold LB and restore &gt;=5 distinct valid frames/s; goal retained</field></block></value></block></next></block></statement></block></statement></block></next></block></statement><statement name="DO4"><block type="comment" id="student_roundtrip_record"><field name="COMMENT">Save a completed trip for comparison
After the return settling wait, an active program captures the endpoint and asks to record the completed trip. Successful recording selects COMPLETE and keeps power zero. Completed measurements are written to /sdcard/FIRST/calibration_results.jsonl for comparison with your tape notes. STOP before completion is not a completed record.
For example: An outward stop is only part of the trip. The return endpoint and its settling wait must also finish before the program records completion.
Think first: If STOP occurs 0.4 seconds into the 0.8-second return settling wait, should you label that trial completed?</field><next><block type="controls_if" id="roundtrip_0141"><mutation elseif="0" else="0"/><value name="IF0"><block type="logic_operation" id="roundtrip_0125"><field name="OP">AND</field><value name="A"><block type="logic_compare" id="roundtrip_0123"><field name="OP">GTE</field><value name="A"><block type="misc_callJava_return" id="roundtrip_0121"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripSeconds() double" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="0" returnType="double" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_String" convertReturnValue="Number" createDropdownFunctionName=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripSeconds</field></block></value><value name="B"><block type="variables_get" id="roundtrip_0122"><field name="VAR" id="roundtrip_var_settleUntil">settleUntil</field></block></value></block></value><value name="B"><block type="linearOpMode_opModeIsActive" id="roundtrip_0124"/></value></block></value><statement name="DO0"><block type="misc_callJava_noReturn" id="roundtrip_0127"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripCaptureEndpoint(boolean) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="boolean" argLabel0="forward" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripCaptureEndpoint</field><value name="ARG0"><block type="logic_boolean" id="roundtrip_0126"><field name="BOOL">FALSE</field></block></value><next><block type="controls_if" id="roundtrip_0138"><mutation elseif="0" else="1"/><value name="IF0"><block type="misc_callJava_return" id="roundtrip_0129"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripComplete(double) boolean" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="1" returnType="boolean" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava_boolean" convertReturnValue="" createDropdownFunctionName="" argType0="double" argLabel0="targetInches" argAuto0=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripComplete</field><value name="ARG0"><block type="variables_get" id="roundtrip_0128"><field name="VAR" id="roundtrip_var_targetInches">targetInches</field></block></value></block></value><statement name="DO0"><block type="variables_set" id="roundtrip_0131"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0130"><field name="TEXT">COMPLETE</field></block></value><next><block type="variables_set" id="roundtrip_0133"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0132"><field name="TEXT">Measurements saved; compare with your tape reference</field></block></value></block></next></block></statement><statement name="ELSE"><block type="variables_set" id="roundtrip_0135"><field name="VAR" id="roundtrip_var_phase">phase</field><value name="VALUE"><block type="text" id="roundtrip_0134"><field name="TEXT">CANCELLED</field></block></value><next><block type="variables_set" id="roundtrip_0137"><field name="VAR" id="roundtrip_var_reason">reason</field><value name="VALUE"><block type="text" id="roundtrip_0136"><field name="TEXT">Run stopped; no measurement report saved</field></block></value></block></next></block></statement><next><block type="variables_set" id="roundtrip_0140"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field><value name="VALUE"><block type="variables_get" id="roundtrip_0139"><field name="VAR" id="roundtrip_var_phase">phase</field></block></value></block></next></block></next></block></statement></block></next></block></statement><statement name="DO5"><block type="variables_set" id="roundtrip_0150"><field name="VAR" id="roundtrip_var_power">power</field><value name="VALUE"><block type="math_number" id="roundtrip_0149"><field name="NUM">0</field></block></value></block></statement><next><block type="dcMotor_setProperty_Number" id="roundtrip_0153"><field name="IDENTIFIER">front_left_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="variables_get" id="roundtrip_0152"><field name="VAR" id="roundtrip_var_power">power</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0155"><field name="IDENTIFIER">back_left_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="variables_get" id="roundtrip_0154"><field name="VAR" id="roundtrip_var_power">power</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0157"><field name="IDENTIFIER">front_right_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="variables_get" id="roundtrip_0156"><field name="VAR" id="roundtrip_var_power">power</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0159"><field name="IDENTIFIER">back_right_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="variables_get" id="roundtrip_0158"><field name="VAR" id="roundtrip_var_power">power</field></block></value><next><block type="misc_callJava_noReturn" id="roundtrip_0164"><mutation methodLookupString="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport roundTripReport(java.lang.String,java.lang.String,double,double) void" fullClassName="org.firstinspires.ftc.teamcode.CalibrationBlocksSupport" simpleName="CalibrationBlocksSupport" parameterCount="4" returnType="void" color="289" heading="Calibration lesson" comment="" tooltip="" accessMethod="callJava" convertReturnValue="" createDropdownFunctionName="" argType0="java.lang.String" argLabel0="phase" argAuto0="" argType1="java.lang.String" argLabel1="reason" argAuto1="" argType2="double" argLabel2="commandedPower" argAuto2="" argType3="double" argLabel3="targetInches" argAuto3=""/><field name="CLASS_NAME">CalibrationBlocksSupport</field><field name="METHOD_NAME">roundTripReport</field><value name="ARG0"><block type="variables_get" id="roundtrip_0160"><field name="VAR" id="roundtrip_var_displayPhase">displayPhase</field></block></value><value name="ARG1"><block type="variables_get" id="roundtrip_0161"><field name="VAR" id="roundtrip_var_reason">reason</field></block></value><value name="ARG2"><block type="variables_get" id="roundtrip_0162"><field name="VAR" id="roundtrip_var_power">power</field></block></value><value name="ARG3"><block type="variables_get" id="roundtrip_0163"><field name="VAR" id="roundtrip_var_targetInches">targetInches</field></block></value></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></next></block></statement></block><block type="procedures_defnoreturn" id="roundtrip_0249" x="30" y="4496"><field name="NAME">zeroDrive</field><statement name="STACK"><block type="comment" id="student_roundtrip_zero"><field name="COMMENT">Make zero a four-motor instruction
zeroDrive requests zero from each of the four drive motors. The control loop also begins its power choice at zero, leaving motion off during WAIT, pauses, settling, and finished phases unless a travel branch permits power. Zero removes the drive request; it does not remove inertia.
For example: Releasing LEFT BUMPER partway out gives all four motors a zero command while preserving the outward phase and target.
Think first: Is leaving one motor at its old +0.10 command equivalent to zeroDrive?</field><next><block type="dcMotor_setProperty_Number" id="roundtrip_0215"><field name="IDENTIFIER">front_left_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="math_number" id="roundtrip_0214"><field name="NUM">0</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0217"><field name="IDENTIFIER">back_left_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="math_number" id="roundtrip_0216"><field name="NUM">0</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0219"><field name="IDENTIFIER">front_right_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="math_number" id="roundtrip_0218"><field name="NUM">0</field></block></value><next><block type="dcMotor_setProperty_Number" id="roundtrip_0221"><field name="IDENTIFIER">back_right_driveAsDcMotor</field><field name="PROP">Power</field><value name="VALUE"><block type="math_number" id="roundtrip_0220"><field name="NUM">0</field></block></value></block></next></block></next></block></next></block></next></block></statement></block></xml>
<Extra>
<OpModeMeta flavor="AUTONOMOUS" group="90 Blocks" />
<Enabled value="false" />
</Extra>
