Safety · FTC Blocks // Start here

2m Sensors & Safety Stop

Explore the real right, left, and rear REV 2m sensor Blocks from Start: 24-inch toward-wall speed limit and 12-inch directional stop. This read-only study sample reports guarded joystick commands but cannot drive or protect the robot by itself.

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.

01READ-ONLY WALL GUARD STUDY

This is a small copy of the sensor and safety decisions in Start. It does not drive the robot or protect another program. To see the actual motor commands, open the full Start sample next.

02ONE LOOP, NEW DISTANCES

The loop repeats while START is active. First read each sensor again. Then read the joysticks and apply the guard before showing the result. This study program never sends power to a motor.

03THREE WAYS TO MOVE

Forward is positive; backing up is negative. Strafe means sliding sideways: right is positive and left is negative. Turning uses the other joystick. We only reduce a command when it points toward the wall that sensor sees.

04GUARD THE RIGHT SIDE

When the joystick asks for a positive (rightward) strafe, use the RIGHT sensor. At 24 inches or closer, cap it at 0.25. At 12 inches or closer, rightScale is 0, so the rightward command becomes 0.

05GUARD THE LEFT SIDE

A leftward strafe is a NEGATIVE number. Near the left wall the cap is -0.25, not +0.25. At 12 inches or closer, leftScale is 0, so leftward movement stops while rightward escape is still possible.

06GUARD THE BACK

Backing up is negative forward power. If the REAR sensor sees a wall within 24 inches, limit the backward command to -0.25. At 12 inches or closer, rearScale makes backing up 0.

07ESCAPE IS STILL ALLOWED

The right sensor only changes right strafe, the left sensor only changes left strafe, and the rear sensor only changes reversing. The robot can still move away. There is no sensor at the front.

08THREE REV 2m SENSORS

Right is named right_distance on I2C 0. Left is left_distance on I2C 1. Rear is rear_distance on I2C 2. Each reading is requested in INCHES. These sensors cannot see a wall in front.

0912 INCHES MEANS STOP TOWARD A WALL

The test says greater than 12. At exactly 12 inches it is false. Each direction gets a 1 if clear or 0 if blocked. Multiplying by 0 removes movement TOWARD that wall, not every movement.

10STOP TURNING AT 12 INCHES TOO

The smallest of the three direction scales becomes turnScale. If any sensor is at or below 12 inches, that scale is 0 and turning is blocked. Above 12, rotation is still allowed.

1124 INCHES MEANS SLOW DOWN

The guard limits only a command headed TOWARD the matching wall to at most 0.25 of full power. A smaller command stays small. Turning is not slowed just because a wall is 24 inches away.

12TELL THE DRIVER WHAT HAPPENED

Show right, left, and rear inches plus a CLEAR, SLOW, or BLOCKED message. The BLOCKED message wins when a wall is within 12 inches. A sensor measures from itself, not the bumper; always test with the wheels raised and a person ready to press STOP.

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: This importable excerpt reports guarded commands but never powers a motor. It cannot protect another OpMode by itself. See the complete Start driving program for where the guard is applied to the wheels. Test with wheels raised and STOP ready.