Package xbot.common.controls.actuators
Class TimedAndBoundedServo
java.lang.Object
xbot.common.controls.actuators.TimedAndBoundedServo
A wrapper around XServo where Servo positions are bounded and get() returns
the Servo's position dynamically based on the given minToMaxSeconds.
NOTE: Clients will need to register the servo for DataFrameRefreshable beforehand.
-
Constructor Summary
ConstructorsConstructorDescriptionTimedAndBoundedServo(XServo servo, double minPosition, double maxPosition, double minToMaxSeconds) -
Method Summary
Modifier and TypeMethodDescriptiondoubledoublevoidsetAbsoluteTargetPosition(double target) voidsetNormalizedTargetPosition(double target)
-
Constructor Details
-
TimedAndBoundedServo
public TimedAndBoundedServo(XServo servo, double minPosition, double maxPosition, double minToMaxSeconds)
-
-
Method Details
-
setAbsoluteTargetPosition
public void setAbsoluteTargetPosition(double target) - Parameters:
target- to set the Servo to, targetPosition should be within bounds
-
setNormalizedTargetPosition
public void setNormalizedTargetPosition(double target) - Parameters:
target- to set the Servo to, in % of completion, where 0 is the minPositon and 1 is the maxPosition.
-
getAbsoluteCurrentPosition
public double getAbsoluteCurrentPosition()- Returns:
- a dynamic position calculated based on delta time
-
getNormalizedCurrentPosition
public double getNormalizedCurrentPosition()- Returns:
- the current absolute servo position normalized to [0, 1]
-