Package com.crossbotics.ftchelper.robot
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
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 Summary
Modifier and TypeMethodDescriptionvoidThe part's telemetry line; each module adds its own.The main device's configuration name, e.g.How the part looks and where it sits (Shape), for the simulator's 3D view and size checks.name()The name shown on the Driver Station and the Tunables section: "Lift", "IntakeDeploy".The main device's parts catalog id: a motor (Motors, e.g.Reads this module's numbers from anotherTunables.javasection.
-
Method Details
-
tunables
Reads this module's numbers from anotherTunables.javasection.- Parameters:
sectionName- the section's class name, e.g. "Slide"- Returns:
- this module
-
part
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
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
The name shown on the Driver Station and the Tunables section: "Lift", "IntakeDeploy". -
deviceName
The main device's configuration name, e.g. "lift". -
addTelemetry
The part's telemetry line; each module adds its own.- Specified by:
addTelemetryin interfaceSubsystem
-