|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.ServoPhidget
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.
Field Summary | |
static int |
PHIDGET_SERVO_DEFAULT
Default - This is what the servo API been historically used, originally based on the Futaba FP-S148. |
static int |
PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R
Firgelli L12 Linear Actuator 100mm 100:1. |
static int |
PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R
Firgelli L12 Linear Actuator 100mm 50:1. |
static int |
PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R
Firgelli L12 Linear Actuator 30mm 50:1. |
static int |
PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R
Firgelli L12 Linear Actuator 50mm 100:1. |
static int |
PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R
Firgelli L12 Linear Actuator 50mm 210:1. |
static int |
PHIDGET_SERVO_HITEC_805BB
HiTec HS-805BB Mega Quarter Scale Servo. |
static int |
PHIDGET_SERVO_HITEC_815BB
HiTec HS-815BB Mega Sail Servo. |
static int |
PHIDGET_SERVO_HITEC_HS322HD
HiTec HS-322HD Standard Servo. |
static int |
PHIDGET_SERVO_HITEC_HS422
HiTec HS-422 Standard Servo. |
static int |
PHIDGET_SERVO_HITEC_HS485HB
HiTec HS-485HB Deluxe Servo. |
static int |
PHIDGET_SERVO_HITEC_HS5245MG
HiTec HS-5245MG Digital Mini Servo. |
static int |
PHIDGET_SERVO_HITEC_HS645MG
HiTec HS-645MG Ultra Torque Servo. |
static int |
PHIDGET_SERVO_HITEC_HS785HB
HiTec HS-785HB Sail Winch Servo. |
static int |
PHIDGET_SERVO_HITEC_HSR1425CR
HiTec HSR-1425CR Continuous Rotation Servo. |
static int |
PHIDGET_SERVO_RAW_us_MODE
Raw us mode - all position, velocity, acceleration functions are specified in microseconds rather then degrees. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S2313M
SpringRC SM-S2313M Micro Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S3317M
SpringRC SM-S3317M Small Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S3317SR
SpringRC SM-S3317SR Small Continuous Rotation Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S4303R
SpringRC SM-S4303R Standard Continuous Rotation Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S4315M
SpringRC SM-S4315M High Torque Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S4315R
SpringRC SM-S4315R High Torque Continuous Rotation Servo. |
static int |
PHIDGET_SERVO_SPRINGRC_SM_S4505B
SpringRC SM-S4505B Standard Servo. |
static int |
PHIDGET_SERVO_TOWERPRO_MG90
Tower Pro MG90 Micro Servo. |
static int |
PHIDGET_SERVO_USER_DEFINED
User Defined servo parameters. |
Constructor Summary | |
ServoPhidget()
|
Method Summary | |
void |
addServoPositionChangeListener(ServoPositionChangeListener l)
Adds a servo position change listener. |
boolean |
getEngaged(int index)
Returns the engaged state or a servo. |
int |
getMotorCount()
Returns the number of motors this Phidget can support. |
boolean |
getMotorOn(int index)
Deprecated. Replaced by getEngaged(int) |
double |
getPosition(int index)
Returns the position of a servo motor. |
double |
getPositionMax(int index)
Returns the maximum position that a servo will accept, or return. |
double |
getPositionMin(int index)
Returns the minimum position that a servo will accept, or return. |
int |
getServoType(int index)
Returns the servo type for an index. |
void |
removeServoPositionChangeListener(ServoPositionChangeListener l)
|
void |
setEngaged(int index,
boolean state)
Engage or disengage a servo motor. |
void |
setMotorOn(int index,
boolean state)
Deprecated. Replaced by setEngaged(int, boolean) |
void |
setPosition(int index,
double position)
Sets the position of a servo motor. |
void |
setServoParameters(int index,
double minUs,
double maxUs,
double degrees)
Sets the servo parameters for a custom servo definition. |
void |
setServoType(int index,
int type)
Sets the servo type for an index. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int PHIDGET_SERVO_DEFAULT
getServoType
and setServoType
public static final int PHIDGET_SERVO_RAW_us_MODE
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS322HD
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS5245MG
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_805BB
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS422
getServoType
and setServoType
public static final int PHIDGET_SERVO_TOWERPRO_MG90
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HSR1425CR
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS785HB
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS485HB
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_HS645MG
getServoType
and setServoType
public static final int PHIDGET_SERVO_HITEC_815BB
getServoType
and setServoType
public static final int PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R
getServoType
and setServoType
public static final int PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R
getServoType
and setServoType
public static final int PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R
getServoType
and setServoType
public static final int PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R
getServoType
and setServoType
public static final int PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S2313M
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317M
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317SR
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S4303R
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315M
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315R
getServoType
and setServoType
public static final int PHIDGET_SERVO_SPRINGRC_SM_S4505B
getServoType
and setServoType
public static final int PHIDGET_SERVO_USER_DEFINED
getServoType
Constructor Detail |
public ServoPhidget() throws PhidgetException
Method Detail |
public int getMotorCount() throws PhidgetException
PhidgetException
public double getPosition(int index) throws PhidgetException
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.public double getPositionMax(int index) throws PhidgetException
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.public double getPositionMin(int index) throws PhidgetException
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.public void setPosition(int index, double position) throws PhidgetException
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 motorposition
- 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.public void setEngaged(int index, boolean state) throws PhidgetException
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.public void setMotorOn(int index, boolean state) throws PhidgetException
setEngaged(int, boolean)
PhidgetException
public boolean getEngaged(int index) throws PhidgetException
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.public boolean getMotorOn(int index) throws PhidgetException
getEngaged(int)
PhidgetException
public int getServoType(int index) throws PhidgetException
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.public void setServoType(int index, int type) throws PhidgetException
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
- Inputtype
- 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.public void setServoParameters(int index, double minUs, double maxUs, double degrees) throws PhidgetException
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 IndexminUs
- Minimum PCM supported in microsecondsmaxUs
- Maximum PCM supported in microsecondsdegrees
- 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.public final void addServoPositionChangeListener(ServoPositionChangeListener l)
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
interfacepublic final void removeServoPositionChangeListener(ServoPositionChangeListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |