Package com.crossbotics.ftchelper.robot
Class ServoPositions<M extends ServoPositions<M>>
java.lang.Object
com.crossbotics.ftchelper.robot.Module<M>
com.crossbotics.ftchelper.robot.ServoPositions<M>
- All Implemented Interfaces:
Subsystem
- Direct Known Subclasses:
Claw,Positioner,Wrist
What
Claw, Wrist and Positioner share: a servo with named positions
(a PositionServo inside). You use one of those three; this class only holds their common
commands.
In Tunables.java every number is a named position (raw servo position, 0 to 1), except
travelSec: about how long the servo takes to get there (used by "has it arrived?").
A servo does not move until the program first tells it where to go, after START.
-
Method Summary
Modifier and TypeMethodDescriptionvoidThe part's telemetry line; each module adds its own.Uses the servo's whole turn.voidGoes to a named position fromTunables.java.booleanTrue if its last command was this position (whether or not it has arrived).booleanisDone()True if it should have arrived at its last position (a guess fromtravelSec).part()The PositionServo inside, for anything this module does not offer.The named positions, in the order it cycles through them.reversed()The servo turns the other way (0 and 1 swap).voidstop()Stops all motion.voidupdate()Called once every loop.
-
Method Details
-
reversed
The servo turns the other way (0 and 1 swap). -
fullRange
Uses the servo's whole turn. The FTC SDK normally sends 600 to 2400 microseconds for positions 0 to 1, which is only part of what most servos take (500 to 2500): a goBILDA 2000 servo turns 270 degrees, not its full 300. With this, positions 0 to 1 send the servo's whole pulse range (the catalog part's frompart(...), else 500-2500 us), so it turns all 300. Measure the positions after turning this on (Servo Finder: Y = full range): the same number points somewhere else once the range changes. A servo that is not on a REV hub keeps its normal range (INIT says so).wrist = add(Wrist.servo("wrist").part("gobilda-2000-speed").fullRange()); // 0..1 = 300 degrees- Returns:
- this part
-
goTo
Goes to a named position fromTunables.java. Capitals do not matter. An unknown name does nothing and shows a warning.- Parameters:
position- e.g. "open"
-
isDone
public boolean isDone()True if it should have arrived at its last position (a guess fromtravelSec). Always true for a part that is not on the robot (Module.optional()): there is nothing to wait for. -
isAt
True if its last command was this position (whether or not it has arrived). -
positions
The named positions, in the order it cycles through them. -
part
The PositionServo inside, for anything this module does not offer. -
update
public void update()Description copied from interface:SubsystemCalled once every loop. Do the hardware work here. Must be quick: no sleep, no waiting. While update() waits, the whole robot is frozen (no driving, no limits, no STOP). -
stop
public void stop()Description copied from interface:SubsystemStops all motion. Called at the end of every OpMode. -
addTelemetry
Description copied from class:ModuleThe part's telemetry line; each module adds its own.- Specified by:
addTelemetryin interfaceSubsystem- Overrides:
addTelemetryin classModule<M extends ServoPositions<M>>
-