Autonomous · FTC Blocks // Vision lesson

Blue Nectar: Center & Approach

Follow the front Limelight's fresh blue-ball contour. Center first, then adjust left and right motor power every loop while driving forward. This disabled study excerpt omits the deployed robot's wall guard and must not be run as an autonomous mode.

Before running: Ask your mentor first. Keep Driver Station STOP ready.

Read · predict · explain

Build the idea, one block at a time

Read these steps before exploring the full program. The numbered blue comments in the diagram link back to the matching step.

01MOTORS ARE ONLY THE OUTPUT

The four drive motors use encoder mode and start at zero power. The Limelight decides HOW to steer, but these motor blocks do the actual driving. This study copy is disabled because it does not include the real wall guard.

02TURN ON THE FRONT LIMELIGHT

Use blue color pipeline 0 and request fresh results. This camera faces FORWARD. The rear Logitech camera is separate and is not part of this lesson.

03INIT: LOOK BEFORE MOVING

During INIT, read blue contours and show the angle and estimated distance on the Driver Station. The robot must not drive toward a ball it cannot see.

04FIRST: CENTER THE CAMERA

Check several fresh frames. Turn left or right until the ball's horizontal angle is within 2 degrees for five checks. If the ball disappears or is far off-screen, stop the motors instead of guessing.

05THEN: DRIVE WHILE RE-CENTERING

Only enter the approach after a stable center and a blue ball farther than the estimated 4.4-inch lens-to-center target. This is about a 3-inch gap to the surface of a 2.8-inch ball, not a tape-verified stopping distance.

06LOOK AGAIN EVERY LOOP

Every 25 milliseconds, take a NEW Limelight reading. Do not steer using the ball's old position: the robot and ball can both move between frames.

07DRIVE AND FIX THE ANGLE TOGETHER

When the blue ball is visible and no more than 25 degrees off center, the left command is 0.18 plus a clipped correction of 0.02 times tx. The right command subtracts the same correction. Recalculate EVERY loop so the ball stays centered as the robot drives forward.

08LOST BALL? POWER ZERO NOW

If the Limelight cannot confirm this ball, set BOTH power commands to zero immediately. A ball past the camera edge aborts. After 0.35 seconds without the ball, abandon the approach. Never keep driving blindly.

09SAFETY LIMIT IS NOT SUCCESS

The wheel-encoder cap and a 16-second time limit can stop the robot BEFORE the camera thinks the ball is close. A stuck encoder also triggers a stop. Only a fresh target inside the estimated 4.4-inch lens-to-center range counts as reaching the goal.

10CHECK THE CAMERA FEED FIRST

A result must be valid, from the blue pipeline 0, and under 250 milliseconds old. A stale frame is like an old photograph: it cannot safely guide a moving robot.

11PICK A BALL-SIZED BLUE CONTOUR

Look through blue color results. Choose a contour within the camera's ball-height band (Y pixels 215 to 260) and allowed area range, not the entire blue floor. tx is the angle left or right; area estimates distance using 2.84 divided by the square root of area fraction. This estimate needs more real-world calibration.

12STAY WITH THE SAME BALL

Once following a ball, reject a sudden jump in angle or contour size. A different blue patch should not steal the steering lock. If the match fails, seen becomes false and the drive stops immediately.

13LEFT AND RIGHT COMMANDS REACH THE WHEELS

These four blocks send leftPower to both left motors and rightPower to both right motors. That is how a difference in power steers while moving forward. The FULL deployed mode also checks the three wall sensors here; this disabled lesson is not a substitute for the guarded robot code.

Put the steps together

Explore the full Blocks program

Zoom in to follow the connections. Click a blue comment or focus its label and press Enter to revisit that lesson step.

Ask your mentor before importing or running these Blocks. A download does not set up or start the robot.

For mentors: robot setup & safety

Review before running

Study-only: do not run this excerpt on the robot. The four motor-output blocks are real, but this excerpt omits the side/rear wall guard to focus on the Limelight and steering loop. Its estimated 3-inch lens-to-ball gap is calibrated at only one longer distance, not verified close up. The robot's front may extend beyond the lens.