|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.AdvancedServoPhidget
This class represents a Phidget Advanced Servo Controller. All methods to to control a motor controller and read back motor data are implemented in this class.
The Phidget Advanced Servo Controller is able to control 1 or more servo motors. Motos acceleration and Velocity are controllable. The number of servos that can be controlled depends on the version of the controller.
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 | |
AdvancedServoPhidget()
|
Method Summary | |
void |
addCurrentChangeListener(CurrentChangeListener l)
Adds a current change listener. |
void |
addServoPositionChangeListener(ServoPositionChangeListener l)
Adds a position change listener. |
void |
addServoVelocityChangeListener(ServoVelocityChangeListener l)
Adds a velocity change listener. |
double |
getAcceleration(int index)
Returns a motor's acceleration. |
double |
getAccelerationMax(int index)
Returns the maximum acceleration that a motor will accept, or return. |
double |
getAccelerationMin(int index)
Returns the minimum acceleration that a motor will accept, or return. |
double |
getCurrent(int index)
Returns a motor's current usage. |
boolean |
getEngaged(int index)
Returns the engaged state of a motor. |
int |
getMotorCount()
Returns the number of servo motors supported by this Phidget. |
double |
getPosition(int index)
Returns a motor's current position. |
double |
getPositionMax(int index)
Returns the maximum position that a servo motor will accept, or return. |
double |
getPositionMin(int index)
Returns the minimum position that a servo motor will accept, or return. |
int |
getServoType(int index)
Returns the servo type for an index. |
boolean |
getSpeedRampingOn(int index)
Returns the speed ramping state of a motor. |
boolean |
getStopped(int index)
Returns the stopped state of a motor. |
double |
getVelocity(int index)
Returns a motor's current velocity. |
double |
getVelocityLimit(int index)
Returns a motor's velocity limit. |
double |
getVelocityMax(int index)
Returns the maximum velocity that a servo motor will accept, or return. |
double |
getVelocityMin(int index)
Returns the minimum velocity that a servo motor will accept, or return. |
void |
removeCurrentChangeListener(CurrentChangeListener l)
|
void |
removeServoPositionChangeListener(ServoPositionChangeListener l)
|
void |
removeServoVelocityChangeListener(ServoVelocityChangeListener l)
|
void |
setAcceleration(int index,
double acceleration)
Sets a motor's acceleration. |
void |
setEngaged(int index,
boolean state)
Engage or disengage a motor. |
void |
setPosition(int index,
double position)
Sets a motor's target position. |
void |
setPositionMax(int index,
double position)
Sets the maximum position that a servo motor will accept, or return. |
void |
setPositionMin(int index,
double position)
Sets the minimum position that a servo motor will accept, or return. |
void |
setServoParameters(int index,
double minUs,
double maxUs,
double degrees,
double velocityMax)
Sets the servo parameters for a custom servo definition. |
void |
setServoType(int index,
int type)
Sets the servo type for an index. |
void |
setSpeedRampingOn(int index,
boolean state)
Sets the speed ramping state. |
void |
setVelocityLimit(int index,
double velocity)
Sets a motor's velocity limit. |
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 AdvancedServoPhidget() throws PhidgetException
Method Detail |
public int getMotorCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public double getAccelerationMax(int index) throws PhidgetException
This value is in degrees per second squared.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getAccelerationMin(int index) throws PhidgetException
This value is in degrees per second squared.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getVelocityMax(int index) throws PhidgetException
This value is in degrees per second.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getVelocityMin(int index) throws PhidgetException
This value is in degrees per second.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getPositionMax(int index) throws PhidgetException
This value is in degrees.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public void setPositionMax(int index, double position) throws PhidgetException
This value is in degrees.
index
- Index of the motorposition
- Maximum position
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getPositionMin(int index) throws PhidgetException
This value uses the same units as
This value is in degrees.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public void setPositionMin(int index, double position) throws PhidgetException
This value is in degrees.
index
- Index of the motorposition
- Minimum position
PhidgetException
- If this Phidget is not opened and attached, or if the index is invalid.
See open
for information on determining if a device is attached.public double getAcceleration(int index) throws PhidgetException
getAccelerationMin
and getAccelerationMax
, and refers to how fast the Servo Controller will change the speed of a motor.
This value is in degrees per second squared.
index
- index of motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if the acceleration is unknown.
See open
for information on determining if a device is attached.public void setAcceleration(int index, double acceleration) throws PhidgetException
getAccelerationMin
and getAccelerationMax
.
This controls how fast the motor changes speed.
This value is in degrees per second squared.
index
- index of the motoracceleration
- requested acceleration for that motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or acceleration are invalid.
See open
for information on determining if a device is attached.public double getVelocityLimit(int index) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in degrees per second.
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if the velocity in unknown.
See open
for information on determining if a device is attached.public void setVelocityLimit(int index, double velocity) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in degrees per second.
index
- index of the motorvelocity
- requested velocity for the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or velocity are invalid.
See open
for information on determining if a device is attached.public double getVelocity(int index) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in degrees per second.
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if the velocity in unknown.
See open
for information on determining if a device is attached.public double getPosition(int index) throws PhidgetException
getPositionMin
and getPositionMax
.
This value is in degrees.
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if the position in unknown.
See open
for information on determining if a device is attached.public void setPosition(int index, double position) throws PhidgetException
engaged
it will start moving towards this target position.
The valid range is between getPositionMin
and getPositionMax
.
This value is in degrees.
index
- index of the motorposition
- target position of the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or position are invalid.
See open
for information on determining if a device is attached.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 void setEngaged(int index, boolean state) throws PhidgetException
This engages or disengages the servo motor. The motors are by default disengaged when the servo controller is plugged in. When the servo is disengaged, position, velocity, etc. can all be set, but the motor will not start moving until it is engaged. If position is read when a motor is disengaged, it will throw an exception.
This corresponds to a PCM of 0 being sent to the 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.public boolean getSpeedRampingOn(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 void setSpeedRampingOn(int index, boolean state) throws PhidgetException
Disable speed ramping to disable velocity and acceleration control. With speed ramping disabled, the servo will be sent to the desired position immediately upon receiving the command. This is how the regular Phidget Servo Controller works.
This is turned on by default.
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 getCurrent(int index) throws PhidgetException
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if the value is unknown.
See open
for information on determining if a device is attached.public boolean getStopped(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 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. Velocity is also constrained to the maximum speed attainable by the servo.
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, double velocityMax) 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. Velocity is also constrained to the maximum speed attainable by the servo.
index
- Servo IndexminUs
- Minimum PCM supported in microsecondsmaxUs
- Maximum PCM supported in microsecondsdegrees
- Degrees of rotation represented by the given PCM rangevelocityMax
- Maximum supported velocity of the servo in degrees/second
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)
There is no limit on the number of position change handlers that can be registered for a particular Phidget.
l
- An implemetation of the ServoPositionChangeListener
interfacepublic final void removeServoPositionChangeListener(ServoPositionChangeListener l)
public final void addServoVelocityChangeListener(ServoVelocityChangeListener l)
There is no limit on the number of velocity change handlers that can be registered for a particular Phidget.
l
- An implemetation of the ServoVelocityChangeListener
interfacepublic final void removeServoVelocityChangeListener(ServoVelocityChangeListener l)
public final void addCurrentChangeListener(CurrentChangeListener l)
There is no limit on the number of current change handlers that can be registered for a particular Phidget.
Note that not all stepper controllers support current sensing.
l
- An implemetation of the CurrentChangeListener
interfacepublic final void removeCurrentChangeListener(CurrentChangeListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |