Class MotorFinderOpMode

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

public abstract class MotorFinderOpMode extends FinderOpMode
Finds a motor mechanism's numbers (a lift, an arm, a turret): its limits in encoder counts, the positions you want, and its top speed. Move it slowly with the stick, mark the ends and positions, and copy the code lines it shows. No code to write: it lists every motor in the robot configuration.

It shows the code for PositionMotor and, for the robot in five files, the line for Tunables.java: Tunables.Lift: min = 0, max = 2580, P1 = 1200 (rename P1 to low...).

 Choose:  D-pad up/down = motor, A = use it (its count starts at 0 HERE: start at the bottom)
 Move:    right stick Y = move (at most "max power"), D-pad up/down = max power +/- 0.05 (0.1 to 0.6)
          X = mark the LOW end, B = mark the HIGH end. Once both are marked, the power goes off at
          them (it coasts a little past, more at a higher max power; hold LB to move past anyway, e.g.
          to mark again). A position saved outside the ends gets a warning.
          A = save this as a position (P1, P2, ...), Y = undo the last one
          hold RT = speed test: full power toward the HIGH end, stops before it (needs both ends)
          BACK = choose another motor
 Help: GUIDE (or hold START 1 s) = a help page with every button; everything pauses.
 
In your TeamCode: @TeleOp(name = "Motor Finder", group = "Finders") public class MotorFinder extends MotorFinderOpMode { } Docs: docs/modules/finders.md. Guide: docs/guides/finders.md
  • 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.
    static final double
    The speed test stops this share of the range before the HIGH end, so it never hits it.
    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[]
    The help page: every button and the steps, a line each (at most 13 lines, about 50 characters each, to fit on the Driver Station).
    final void
     
    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

    helpKeyDown, inputsReady, openHelp, pause, 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

    • SPEED_TEST_MARGIN

      public static final double SPEED_TEST_MARGIN
      The speed test stops this share of the range before the HIGH end, so it never hits it.
      See Also:
    • 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

    • MotorFinderOpMode

      public MotorFinderOpMode()
  • Method Details

    • 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()
      Description copied from class: FinderOpMode
      The help page: every button and the steps, a line each (at most 13 lines, about 50 characters each, to fit on the Driver Station). GUIDE (or START held 1 s) shows it, in INIT or while running. Default: a page that says there is no help yet.
      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()