Public Member Functions | |
final void | addServoPositionChangeListener (ServoPositionChangeListener l) |
native boolean | getEngaged (int index) throws PhidgetException |
native int | getMotorCount () throws PhidgetException |
native boolean | getMotorOn (int index) throws PhidgetException |
native double | getPosition (int index) throws PhidgetException |
native double | getPositionMax (int index) throws PhidgetException |
native double | getPositionMin (int index) throws PhidgetException |
native int | getServoType (int index) throws PhidgetException |
final void | removeServoPositionChangeListener (ServoPositionChangeListener l) |
ServoPhidget () throws PhidgetException | |
native void | setEngaged (int index, boolean state) throws PhidgetException |
native void | setMotorOn (int index, boolean state) throws PhidgetException |
native void | setPosition (int index, double position) throws PhidgetException |
native void | setServoParameters (int index, double minUs, double maxUs, double degrees) throws PhidgetException |
native void | setServoType (int index, int type) throws PhidgetException |
Static Public Attributes | |
static final int | PHIDGET_SERVO_DEFAULT = 1 |
static final int | PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R = 17 |
static final int | PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R = 16 |
static final int | PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R = 13 |
static final int | PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R = 14 |
static final int | PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R = 15 |
static final int | PHIDGET_SERVO_HITEC_805BB = 5 |
static final int | PHIDGET_SERVO_HITEC_815BB = 12 |
static final int | PHIDGET_SERVO_HITEC_HS322HD = 3 |
static final int | PHIDGET_SERVO_HITEC_HS422 = 6 |
static final int | PHIDGET_SERVO_HITEC_HS485HB = 10 |
static final int | PHIDGET_SERVO_HITEC_HS5245MG = 4 |
static final int | PHIDGET_SERVO_HITEC_HS645MG = 11 |
static final int | PHIDGET_SERVO_HITEC_HS785HB = 9 |
static final int | PHIDGET_SERVO_HITEC_HSR1425CR = 8 |
static final int | PHIDGET_SERVO_RAW_us_MODE = 2 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S2313M = 18 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S3317M = 19 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S3317SR = 20 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S4303R = 21 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S4315M = 22 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S4315R = 23 |
static final int | PHIDGET_SERVO_SPRINGRC_SM_S4505B = 24 |
static final int | PHIDGET_SERVO_TOWERPRO_MG90 = 7 |
static final int | PHIDGET_SERVO_USER_DEFINED = 25 |
Private Member Functions | |
final void | enableDeviceSpecificEvents (boolean b) |
native void | enableServoPositionChangeEvents (boolean b) |
void | fireServoPositionChange (ServoPositionChangeEvent e) |
Static Private Member Functions | |
static native long | create () throws PhidgetException |
Private Attributes | |
long | nativeServoPositionChangeHandler = 0 |
LinkedList | servoPositionChangeListeners = new LinkedList () |
This class represents a Phidget servo Controller. All methods to control a Servo Controller are implemented in this class.
The Phidget Sevo controller simply outputs varying widths of PWM, which is what most servo motors take as an input driving signal.
Definition at line 19 of file ServoPhidget.java.
com.phidgets.ServoPhidget.ServoPhidget | ( | ) | throws PhidgetException [inline] |
Definition at line 21 of file ServoPhidget.java.
final void com.phidgets.ServoPhidget.addServoPositionChangeListener | ( | ServoPositionChangeListener | l | ) | [inline] |
Adds a servo position change listener. The servo position change handler is a method that will be called when the servo position has changed. The event will get fired after every call to setPosition.
There is no limit on the number of servo position change handlers that can be registered for a particular Phidget.
l | An implemetation of the ServoPositionChangeListener interface |
Definition at line 263 of file ServoPhidget.java.
static native long com.phidgets.ServoPhidget.create | ( | ) | throws PhidgetException [static, private] |
final void com.phidgets.ServoPhidget.enableDeviceSpecificEvents | ( | boolean | b | ) | [inline, private] |
Reimplemented from com.phidgets.Phidget.
Definition at line 251 of file ServoPhidget.java.
native void com.phidgets.ServoPhidget.enableServoPositionChangeEvents | ( | boolean | b | ) | [private] |
void com.phidgets.ServoPhidget.fireServoPositionChange | ( | ServoPositionChangeEvent | e | ) | [inline, private] |
Definition at line 277 of file ServoPhidget.java.
native boolean com.phidgets.ServoPhidget.getEngaged | ( | int | index | ) | throws PhidgetException |
Returns the engaged state or a servo.
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native int com.phidgets.ServoPhidget.getMotorCount | ( | ) | throws PhidgetException |
Returns the number of motors this Phidget can support. Note that there is no way of programatically determining how many motors are actaully attached to the board.
native boolean com.phidgets.ServoPhidget.getMotorOn | ( | int | index | ) | throws PhidgetException |
native double com.phidgets.ServoPhidget.getPosition | ( | int | index | ) | throws PhidgetException |
Returns the position of a servo motor. Note that since servo motors do not offer any feedback in their interface, this value is simply whatever the servo was last set to. There is no way of determining the position of a servo that has been plugged in, until it's position has been set. Therefore, if an initial position is important, it should be set as part of initialization.
If the servo is not engaged, the position is unknown and calling this function will throw an exception.
The range here is between getPositionMin and getPositionMax, and corresponds aproximately to an angle in degrees. Note that most servos will not be able to operate accross this entire range.
index | index of the motor |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native double com.phidgets.ServoPhidget.getPositionMax | ( | int | index | ) | throws PhidgetException |
Returns the maximum position that a servo will accept, or return.
index | Index of the servo |
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native double com.phidgets.ServoPhidget.getPositionMin | ( | int | index | ) | throws PhidgetException |
Returns the minimum position that a servo will accept, or return.
index | Index of the servo |
PhidgetException | If this Phidget is not opened and attached. See open for information on determining if a device is attached. |
native int com.phidgets.ServoPhidget.getServoType | ( | int | index | ) | throws PhidgetException |
Returns the servo type for an index. The possible values for type are PHIDGET_SERVO_DEFAULT, PHIDGET_SERVO_RAW_us_MODE, PHIDGET_SERVO_HITEC_HS322HD, PHIDGET_SERVO_HITEC_HS5245MG, PHIDGET_SERVO_HITEC_805BB, PHIDGET_SERVO_HITEC_HS422, etc.
index | Input |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
final void com.phidgets.ServoPhidget.removeServoPositionChangeListener | ( | ServoPositionChangeListener | l | ) | [inline] |
Definition at line 271 of file ServoPhidget.java.
native void com.phidgets.ServoPhidget.setEngaged | ( | int | index, |
boolean | state | ||
) | throws PhidgetException |
Engage or disengage a servo motor.
This engages or disengages the servo. The motor is engaged whenever you set a position, use this function to disengage, and reengage without setting a position.
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native void com.phidgets.ServoPhidget.setMotorOn | ( | int | index, |
boolean | state | ||
) | throws PhidgetException |
native void com.phidgets.ServoPhidget.setPosition | ( | int | index, |
double | position | ||
) | throws PhidgetException |
Sets the position of a servo motor.
The range here is between getPositionMin and getPositionMax, and corresponds aproximately to an angle in degrees. Note that most servos will not be able to operate accross this entire range. Typically, the range might be 25 - 180 degrees, but this depends on the servo
index | index of the motor |
position | desired position |
PhidgetException | If this Phidget is not opened and attached, or if the index or position is out of range. See open for information on determining if a device is attached. |
native void com.phidgets.ServoPhidget.setServoParameters | ( | int | index, |
double | minUs, | ||
double | maxUs, | ||
double | degrees | ||
) | throws PhidgetException |
Sets the servo parameters for a custom servo definition.
This constrains the PCM to the valid range of the servo, and sets the degrees-to-PCM ratio to match the actual servo rotation.
index | Servo Index |
minUs | Minimum PCM supported in microseconds |
maxUs | Maximum PCM supported in microseconds |
degrees | Degrees of rotation represented by the given PCM range |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
native void com.phidgets.ServoPhidget.setServoType | ( | int | index, |
int | type | ||
) | throws PhidgetException |
Sets the servo type for an index.
This constrains the PCM to the valid range of the servo, and sets the degrees-to-PCM ratio to match the actual servo rotation.
The possible values for type are PHIDGET_SERVO_DEFAULT, PHIDGET_SERVO_RAW_us_MODE, PHIDGET_SERVO_HITEC_HS322HD, PHIDGET_SERVO_HITEC_HS5245MG, PHIDGET_SERVO_HITEC_805BB, PHIDGET_SERVO_HITEC_HS422, etc.
Support for other servo types can be achieved by using setServoParameters.
The default setting is PHIDGET_SERVO_DEFAULT, which is used for historical (backwards compatibility) reasons.
index | Input |
type | Servo Type |
PhidgetException | If this Phidget is not opened and attached, or if the index is out of range. See open for information on determining if a device is attached. |
long com.phidgets.ServoPhidget.nativeServoPositionChangeHandler = 0 [private] |
Definition at line 270 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_DEFAULT = 1 [static] |
Default - This is what the servo API been historically used, originally based on the Futaba FP-S148. This is used with getServoType and setServoType
Definition at line 30 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R = 17 [static] |
Firgelli L12 Linear Actuator 100mm 100:1. This is used with getServoType and setServoType
Definition at line 94 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R = 16 [static] |
Firgelli L12 Linear Actuator 100mm 50:1. This is used with getServoType and setServoType
Definition at line 90 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R = 13 [static] |
Firgelli L12 Linear Actuator 30mm 50:1. This is used with getServoType and setServoType
Definition at line 78 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R = 14 [static] |
Firgelli L12 Linear Actuator 50mm 100:1. This is used with getServoType and setServoType
Definition at line 82 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R = 15 [static] |
Firgelli L12 Linear Actuator 50mm 210:1. This is used with getServoType and setServoType
Definition at line 86 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_805BB = 5 [static] |
HiTec HS-805BB Mega Quarter Scale Servo. This is used with getServoType and setServoType
Definition at line 46 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_815BB = 12 [static] |
HiTec HS-815BB Mega Sail Servo. This is used with getServoType and setServoType
Definition at line 74 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS322HD = 3 [static] |
HiTec HS-322HD Standard Servo. This is used with getServoType and setServoType
Definition at line 38 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS422 = 6 [static] |
HiTec HS-422 Standard Servo. This is used with getServoType and setServoType
Definition at line 50 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS485HB = 10 [static] |
HiTec HS-485HB Deluxe Servo. This is used with getServoType and setServoType
Definition at line 66 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS5245MG = 4 [static] |
HiTec HS-5245MG Digital Mini Servo. This is used with getServoType and setServoType
Definition at line 42 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS645MG = 11 [static] |
HiTec HS-645MG Ultra Torque Servo. This is used with getServoType and setServoType
Definition at line 70 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HS785HB = 9 [static] |
HiTec HS-785HB Sail Winch Servo. This is used with getServoType and setServoType
Definition at line 62 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_HITEC_HSR1425CR = 8 [static] |
HiTec HSR-1425CR Continuous Rotation Servo. This is used with getServoType and setServoType
Definition at line 58 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_RAW_us_MODE = 2 [static] |
Raw us mode - all position, velocity, acceleration functions are specified in microseconds rather then degrees. This is used with getServoType and setServoType
Definition at line 34 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S2313M = 18 [static] |
SpringRC SM-S2313M Micro Servo. This is used with getServoType and setServoType
Definition at line 98 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S3317M = 19 [static] |
SpringRC SM-S3317M Small Servo. This is used with getServoType and setServoType
Definition at line 102 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S3317SR = 20 [static] |
SpringRC SM-S3317SR Small Continuous Rotation Servo. This is used with getServoType and setServoType
Definition at line 106 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S4303R = 21 [static] |
SpringRC SM-S4303R Standard Continuous Rotation Servo. This is used with getServoType and setServoType
Definition at line 110 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S4315M = 22 [static] |
SpringRC SM-S4315M High Torque Servo. This is used with getServoType and setServoType
Definition at line 114 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S4315R = 23 [static] |
SpringRC SM-S4315R High Torque Continuous Rotation Servo. This is used with getServoType and setServoType
Definition at line 118 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_SPRINGRC_SM_S4505B = 24 [static] |
SpringRC SM-S4505B Standard Servo. This is used with getServoType and setServoType
Definition at line 122 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_TOWERPRO_MG90 = 7 [static] |
Tower Pro MG90 Micro Servo. This is used with getServoType and setServoType
Definition at line 54 of file ServoPhidget.java.
final int com.phidgets.ServoPhidget.PHIDGET_SERVO_USER_DEFINED = 25 [static] |
User Defined servo parameters. This is used with getServoType
Definition at line 126 of file ServoPhidget.java.
LinkedList com.phidgets.ServoPhidget.servoPositionChangeListeners = new LinkedList () [private] |
Definition at line 269 of file ServoPhidget.java.