Package lejos.robotics
Interface Servo
-
- All Known Implementing Classes:
TetrixServo
public interface ServoAbstraction for a range-limited servo motor.- Author:
- Kirk P. Thompson
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description floatgetAngle()Gets the rotational position (angle) of a ranged servo.intgetpulseWidth()Get the current PWM pulse width for the servo.voidsetAngle(float angle)Sets the rotational position (angle) of a ranged servo.voidsetpulseWidth(int microSeconds)Set the PWM pulse width for the servo.voidsetRange(int microsecLOW, int microsecHIGH, int travelRange)Set the allowable pulse width operating range of this servo in microseconds and the total travel range to allow the use of angle-based parameters to control the servo.
-
-
-
Method Detail
-
setAngle
void setAngle(float angle)
Sets the rotational position (angle) of a ranged servo.- Parameters:
angle- the target angle in degrees- See Also:
getAngle(),setRange(int, int, int)
-
getAngle
float getAngle()
Gets the rotational position (angle) of a ranged servo.- Returns:
- the angle in degrees
- See Also:
setAngle(float)
-
setpulseWidth
void setpulseWidth(int microSeconds)
Set the PWM pulse width for the servo. This must be in the range defined for the servo. This method allows manipulation of the servo position based on absolute pulse widths in microseconds.A servo pulse of 1500 microseconds (1.5 ms) width will typically set the servo to its "neutral" position. This is the "standard pulse servo mode" used by all hobby analog servos.
- Parameters:
microSeconds- The pulse width time in microseconds
-
getpulseWidth
int getpulseWidth()
Get the current PWM pulse width for the servo.- Returns:
- The pulse width time in microseconds
-
setRange
void setRange(int microsecLOW, int microsecHIGH, int travelRange)Set the allowable pulse width operating range of this servo in microseconds and the total travel range to allow the use of angle-based parameters to control the servo.This information is used to calculate ansolute angles used by the
setAngle()andgetAngle()methods. The midpoint of the pulse width operating range should normally be 1500 microseconds so the range extents should reflect this.This information must reflect the appropriate specifications and/or empirical characterization data of the specific servo used for the
setAngle()method to be able to position the servo accurately.- Parameters:
microsecLOW- The low end of the servos response/operating range in microsecondsmicrosecHIGH- The high end of the servos response/operating range in microsecondstravelRange- The total mechanical travel range of the servo in degrees- See Also:
setAngle(float)
-
-