Package crackers.kobots.parts.movement
Class StepMapper
-
- All Implemented Interfaces:
public final class StepMapperCalculates a "physical" angle to steps mapping for a geared stepper motor. This is used to translate desired physical angles into the corresponding number of steps the stepper motor must take, considering the gear ratio. This is obviously an approximation since stepper motors move in discrete steps and do not have the concept of "state".
-
-
Constructor Summary
Constructors Constructor Description StepMapper(Integer stepsPerRotation, Float gearRatio)
-
Method Summary
Modifier and Type Method Description final IntegerdegreesToSteps(Integer degrees)Convert degrees to steps. final List<Integer>stepsToDegrees(Integer steps)Convert steps to degrees. -
-
Method Detail
-
degreesToSteps
final Integer degreesToSteps(Integer degrees)
Convert degrees to steps. Compensates for negative degrees and degrees over 360.
-
stepsToDegrees
final List<Integer> stepsToDegrees(Integer steps)
Convert steps to degrees. Returns the range of possible degrees for the given number of steps. Note that not all steps will have a corresponding degree (due to rounding), so this uses the "closest" minimum or last.
-
-
-
-