Class NudgeStep
java.lang.Object
com.crossbotics.ftchelper.finders.NudgeStep
The step size for nudging a servo in a finder: D-pad up/down moves the servo by the step, D-pad
left/right makes the step smaller/bigger. Big steps get close fast; the smallest (0.001) finds an exact
spot, such as the gap two wheels squeeze a game piece through.
The Servo Finder, Feed Stop Finder and Hood Finder all use it, so the buttons are the same in each.
NudgeStep step = new NudgeStep(); // starts at 0.05
step.smaller(); // 0.01
double p = step.move(0.500, +1); // 0.510
Docs: docs/modules/finders.md. Guide: docs/tuning/03-servo-finder.md-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbigger()D-pad right: the next bigger step (stays at the biggest).label()doublemove(double position, int direction) The position one step away.voidreset()Back to the first step (0.05), for example when another servo is chosen.doublesize()voidsmaller()D-pad left: the next smaller step (stays at the smallest).
-
Field Details
-
SIZES
public static final double[] SIZESThe step sizes, biggest first. 0.001 is about a quarter of a degree on a 270 degree servo.
-
-
Constructor Details
-
NudgeStep
public NudgeStep()
-
-
Method Details
-
size
public double size()- Returns:
- the step now, servo position units (0..1 is the whole range)
-
smaller
public void smaller()D-pad left: the next smaller step (stays at the smallest). -
bigger
public void bigger()D-pad right: the next bigger step (stays at the biggest). -
reset
public void reset()Back to the first step (0.05), for example when another servo is chosen. -
move
public double move(double position, int direction) The position one step away.- Parameters:
position- the servo position now, 0..1direction- +1 = up (bigger number), -1 = down- Returns:
- the new position, rounded to 0.001 (so 0.1 + 0.05 shows as 0.150) and kept inside 0..1
-
label
- Returns:
- the step for the screen, e.g. "0.005"
-