Class AsyncServoRotator
-
- All Implemented Interfaces:
-
crackers.kobots.parts.movement.Actuator
public class AsyncServoRotator extends LimitedRotator
An asynchronous servo rotator that smoothly rotates a servo to a specified angle using easing functions. Do not use this class if you need to interrupt the rotation once started.
-
-
Field Summary
Fields Modifier and Type Field Description private final Integer
current
private final IntRange
physicalRange
-
Constructor Summary
Constructors Constructor Description AsyncServoRotator(ServoDevice theServo, IntRange servoRange)
Secondary constructor that assumes the servo's physical range matches its servo range and uses a delta of 1. AsyncServoRotator(ServoDevice theServo, IntRange physicalRange, IntRange servoRange, Integer delta)
-
Method Summary
Modifier and Type Method Description Integer
getCurrent()
IntRange
getPhysicalRange()
final Unit
init()
Boolean
rotateTo(Integer angle)
Rotate to the specified angle synchronously. final Unit
rotateAsync(Integer angle, Duration time, Function1<Float, Float> easing)
Rotate to the specified angle asynchronously with given time and easing. -
-
Constructor Detail
-
AsyncServoRotator
AsyncServoRotator(ServoDevice theServo, IntRange servoRange)
Secondary constructor that assumes the servo's physical range matches its servo range and uses a delta of 1.
-
AsyncServoRotator
AsyncServoRotator(ServoDevice theServo, IntRange physicalRange, IntRange servoRange, Integer delta)
- Parameters:
theServo
- The servo device to be controlled.physicalRange
- The physical range of motion for the servo in degrees.servoRange
- The actual range of angles the servo can achieve.delta
- The increment step for rotation.
-
-
Method Detail
-
getCurrent
Integer getCurrent()
-
getPhysicalRange
IntRange getPhysicalRange()
-
rotateTo
Boolean rotateTo(Integer angle)
Rotate to the specified angle synchronously. This function is disabled for this class of rotator.
-
-
-
-