ILK-01: Interlock rule - two parts are never in their zones at once
- Your robot needs: Lift or arm with an encoder or Turret.
- Starter bots that fit: none (it needs parts the starter bots do not have).
- Library version: v0.17.0 or newer.
- The docs it tests: Two parts that must not collide (interlocks), Two parts that must not collide (interlocks), Two parts that must not collide (interlocks).
Why
An interlock rule (keepApart(...) in Robot.java) keeps two parts that share space from crashing, whoever moves them: a button, a stick, an action, a turret that follows the goal. If it lets both in once, two parts can break. We test it on our turret and wrist; your two parts are different.
Safety
- Simulator first. On the real robot, start with slow powers (
maxPower0.3 for both parts). - Measure the zones by moving the parts by hand, with the power off. Never let the test be the first time the two parts come near each other.
- A hand on STOP. Hard stops still on the robot: the rule does not replace them.
Setup
- Two parts with a position (a turret, lift, arm, wrist, claw, positioner or hood) that can hit each other.
- One line in
Robot.javaafter the parts, for examplekeepApart("TurretLift", turret.zone(), lift.zoneAbove());, and its section inTunables.javawith your measured zones (turretFrom,turretTo,liftAbove), as in the interlocks guide. - Simulator (no robot of your own yet): the V2 example robot. In the
ftc-helper-libfolder:./gradlew :sim:fromRobot -PteamCode=none -ProbotClass=com.crossbotics.ftchelper.examples.v2bot.Robot -Pout=build/v2bot.properties, then./gradlew :sim:run -PteamCode=none -Probot=build/v2bot.properties, open http://localhost:8780 and choose "V2 Bot TeleOp". Its rule isTurretClaw: turret 147 to 217 degrees, wrist 0 to 47 degrees.
Steps
- INIT. Read the
Interlock ...line: it names both parts and both zones, in each part's units (degrees, counts, servo position). - START. Put part A in its zone (V2: the wrist folded, as it starts).
- Move part B toward its zone with its stick or button (V2: gamepad 2 right stick X turns the turret toward the back). Part B stops before its zone, and the Driver Station shows one line, for example
TurretClaw : Turret held at ... deg: Wrist is between .... - Keep asking part B to go in for 5 s. It stays out.
- Move part A out of its zone (V2: gamepad 2 Y, score in a FLOWER: the wrist swings out). Part B now goes in: by itself if a button sent it to a target (the target is kept), or while you still push its stick.
- Now B is in its zone. Ask A to go back in (V2: gamepad 2 X, stow). A waits outside its zone until B leaves.
- Run an action or an autonomous step that moves both parts at once. Read which one waits.
- Put a wrong number in the rule's Tunables section (say
liftAbovelarger than the lift'smax). INIT must stop and say what is wrong. Put it back.
Pass rule
The two parts are never both in their zones (0 times in steps 3 to 7), the waiting part goes on by itself once the other leaves (2 of 2, steps 5 and 6), and step 8 stops INIT with a message that names the rule.
Record
Write these down while you test. The report form has them as a list to fill in.
- your two parts (kinds, motor or servo) and the zones you wrote, in their units
- how far outside its zone each waiting part stopped (degrees, counts or position)
- the Driver Station line while it held a part (copy it)
- the INIT message from step 8
- simulator or real robot
If your robot is different
Any two parts with a position work: an arm and an intake that folds out, a wrist and a low lift, a hood and a turret. A part with no position (an intake roller) needs Zone.when(...) with your own sensor: say if you used it. If your parts can only hit at some lift heights, a rule with a narrower zone may be enough: say what you chose and why.
Report your result
Pass, fail, or could not run: every result helps. The form opens on GitHub with this test filled in (a free GitHub account is needed). No student names, please.
Report resultNo reports for this test yet: yours would be the first. Every test's reports.
All tests · Next: PATH-02 PathAt - start things along a path while it drives
Something wrong on this page? Tell us with a short GitHub form.