Class EncoderCheckOpMode

java.lang.Object
com.qualcomm.robotcore.eventloop.opmode.OpMode
com.qualcomm.robotcore.eventloop.opmode.LinearOpMode
com.crossbotics.ftchelper.finders.FinderOpMode
com.crossbotics.ftchelper.finders.EncoderCheckOpMode

public abstract class EncoderCheckOpMode extends FinderOpMode
Encoder Check: finds an encoder cable in the wrong port, or missing. It gives each motor in Robot.java a short, low push (30% for 0.3 s), one at a time, and reads EVERY motor port's encoder. Each motor gets a result:
  • OK: its own port counted, the way it was pushed.
  • NO COUNTS: no port counted (encoder cable missing, or the motor did not turn).
  • counts on "X" instead: another motor's port counted (encoder cables swapped).
  • counts BACKWARD: its port counted the other way (power wires swapped, or a reversed encoder).
Why it matters: a lift, an arm, a flywheel's speed and the drive's distances all trust the encoder. A cable in the wrong port makes them read ANOTHER motor, and they run away or never stop.

Each motor is set up as Robot.java sets it up (its direction) and pushed toward the side where its part has room (EncoderMotor.pushSign(): a lift up). It never pushes while another port still moves. The count turns with the direction setting, so a wrong reversed() cannot show in the counts: the screen tells the driver to watch the part. A lift's second motor (alsoMotor) is pushed with its first. A motor whose encoder nothing reads (an intake) may have no cable: "no counts" is fine there. CR servos and servos are not checked; nor is a motor whose port reads an odometry pod or a CR servo turret's encoder.

Robot on a block. Hold A: the check runs while A is held (let go = everything stops). Y = start again. It is in "Tune and check" for every robot in five files. On its own, in TeamCode:


 @TeleOp(name = "Encoder Check", group = "Finders")
 public class EncoderCheck extends EncoderCheckOpMode {
     @Override protected RobotDefinition robot() { return new Robot(); }
 }
 
Docs: docs/modules/finders.md. Guide: docs/tuning/02-wiring-checks.md, "Encoder Check"
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.Gamepad
     
    com.qualcomm.robotcore.hardware.HardwareMap
     
    static final int
     
    int
    Deprecated.
    org.firstinspires.ftc.robotcore.external.Telemetry
     

    Fields inherited from class com.crossbotics.ftchelper.finders.FinderOpMode

    results, t

    Fields inherited from class com.qualcomm.robotcore.eventloop.opmode.OpMode

    blackboard, msStuckDetectInit, msStuckDetectInitLoop, msStuckDetectLoop, msStuckDetectStart, time
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Binds gamepad 1 buttons.
    protected String
    The finder's name, e.g.
    protected String[]
     
    final void
     
    protected abstract RobotDefinition
    Your robot in five files (return new Robot();): its motors are checked.
    protected void
    Sets up the hardware, in INIT.
    protected void
    The finder's own screen lines, every loop.
    protected void
    What INIT shows (the controls, a safety note).
    protected void
    Runs once every loop after the buttons: moves things, measures.
    protected void
    Stops every motor and servo it moves.

    Methods inherited from class com.crossbotics.ftchelper.finders.FinderOpMode

    batteryMatters, helpKeyDown, inInit, inputsReady, openHelp, pause, runInside, running, runOpMode

    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • 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 public int msStuckDetectStop
      Deprecated.
  • Constructor Details

    • EncoderCheckOpMode

      public EncoderCheckOpMode()
  • Method Details

    • robot

      protected abstract RobotDefinition robot()
      Your robot in five files (return new Robot();): its motors are checked.
    • finderName

      protected String finderName()
      Description copied from class: FinderOpMode
      The finder's name, e.g. "Servo finder".
      Specified by:
      finderName in class FinderOpMode
    • setup

      protected void setup()
      Description copied from class: FinderOpMode
      Sets up the hardware, in INIT. Nothing may move here.
      Specified by:
      setup in class FinderOpMode
    • showInit

      protected void showInit(RobotTelemetry t)
      Description copied from class: FinderOpMode
      What INIT shows (the controls, a safety note).
      Overrides:
      showInit in class FinderOpMode
    • bind

      protected void bind(ControllerBindings c)
      Description copied from class: FinderOpMode
      Binds gamepad 1 buttons. Actions must be quick: never wait.
      Specified by:
      bind in class FinderOpMode
    • step

      protected void step()
      Description copied from class: FinderOpMode
      Runs once every loop after the buttons: moves things, measures. Never waits.
      Specified by:
      step in class FinderOpMode
    • show

      protected void show(RobotTelemetry t)
      Description copied from class: FinderOpMode
      The finder's own screen lines, every loop.
      Specified by:
      show in class FinderOpMode
    • helpLines

      protected String[] helpLines()
      Overrides:
      helpLines in class FinderOpMode
    • stopAll

      protected void stopAll()
      Description copied from class: FinderOpMode
      Stops every motor and servo it moves. Called at the end, always.
      Specified by:
      stopAll in class FinderOpMode
    • requestOpModeStop

      public final void requestOpModeStop()