Class Module<M extends Module<M>>

java.lang.Object
com.crossbotics.ftchelper.robot.Module<M>
All Implemented Interfaces:
Subsystem
Direct Known Subclasses:
Camera, Indexer, Intake, Launcher, MotorPositions, ServoPositions, Turret

public abstract class Module<M extends Module<M>> extends Object implements Subsystem
One kind of mechanism in Robot.java: an Intake, a Lift, a Claw... Each module brings four things: its line in Robot.java, its section in Tunables.java, its suggested buttons (the standard button map) and its lines in the simulator robot file.

 lift = add(Lift.slide("lift").bottomSwitch("lift_bottom"));   // in Robot.java's define()
 

The module's numbers come from the Tunables.java section with the device's name in CamelCase: device "intake_deploy" reads Tunables.IntakeDeploy. Pick another section with tunables(String).

<M extends Module<M>> lets each setting below hand back the module's own type, so Lift.slide("lift").tunables("Slide") is still a Lift. Docs: docs/modules/robot.md

  • Method Details

    • tunables

      public M tunables(String sectionName)
      Reads this module's numbers from another Tunables.java section.
      Parameters:
      sectionName - the section's class name, e.g. "Slide"
      Returns:
      this module
    • part

      public M part(String catalogId)
      The main device's parts catalog id: a motor (Motors, e.g. "gobilda-5203-117") or a servo (Parts.servo(java.lang.String), e.g. "gobilda-2000-speed"). The simulator then moves a motor or servo like the real one. For a continuous-rotation (CR) servo the id is only a note in the robot file (the simulator turns every CR servo at one speed).
      Parameters:
      catalogId - the id; a typo stops with the list of known ids
      Returns:
      this module
    • looks

      public M looks(Shape... shapes)
      How the part looks and where it sits (Shape), for the simulator's 3D view and size checks. This part moves them: an intake spins its rollers, a positioner swings its arm.
      Parameters:
      shapes - one or more, e.g. Shape.roller("offset-tubing-90").atMm(200, 0, 50).lengthMm(240)
      Returns:
      this module
    • name

      public String name()
      The name shown on the Driver Station and the Tunables section: "Lift", "IntakeDeploy".
      Specified by:
      name in interface Subsystem
    • deviceName

      public String deviceName()
      The main device's configuration name, e.g. "lift".
    • addTelemetry

      public void addTelemetry(RobotTelemetry t)
      The part's telemetry line; each module adds its own.
      Specified by:
      addTelemetry in interface Subsystem