com.phidgets
Class AdvancedServoPhidget

java.lang.Object
  extended bycom.phidgets.Phidget
      extended bycom.phidgets.AdvancedServoPhidget

public final class AdvancedServoPhidget
extends Phidget

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.

Author:
Phidgets Inc.

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.
 
Fields inherited from class com.phidgets.Phidget
PHIDCLASS_ACCELEROMETER, PHIDCLASS_ADVANCEDSERVO, PHIDCLASS_ANALOG, PHIDCLASS_BRIDGE, PHIDCLASS_ENCODER, PHIDCLASS_FREQUENCYCOUNTER, PHIDCLASS_GPS, PHIDCLASS_INTERFACEKIT, PHIDCLASS_LED, PHIDCLASS_MOTORCONTROL, PHIDCLASS_NOTHING, PHIDCLASS_PHSENSOR, PHIDCLASS_RFID, PHIDCLASS_SERVO, PHIDCLASS_STEPPER, PHIDCLASS_TEMPERATURESENSOR, PHIDCLASS_TEXTLCD, PHIDCLASS_TEXTLED, PHIDCLASS_WEIGHTSENSOR, PHIDGET_LOG_CRITICAL, PHIDGET_LOG_DEBUG, PHIDGET_LOG_ERROR, PHIDGET_LOG_INFO, PHIDGET_LOG_VERBOSE, PHIDGET_LOG_WARNING, PHIDID_ACCELEROMETER_2AXIS, PHIDID_ACCELEROMETER_3AXIS, PHIDID_ADVANCEDSERVO_1MOTOR, PHIDID_ADVANCEDSERVO_8MOTOR, PHIDID_ANALOG_4OUTPUT, PHIDID_BIPOLAR_STEPPER_1MOTOR, PHIDID_BRIDGE_4INPUT, PHIDID_ENCODER_1ENCODER_1INPUT, PHIDID_ENCODER_HS_1ENCODER, PHIDID_ENCODER_HS_4ENCODER_4INPUT, PHIDID_FREQUENCYCOUNTER_2INPUT, PHIDID_GPS, PHIDID_INTERFACEKIT_0_0_4, PHIDID_INTERFACEKIT_0_0_8, PHIDID_INTERFACEKIT_0_16_16, PHIDID_INTERFACEKIT_0_8_8_w_LCD, PHIDID_INTERFACEKIT_2_2_2, PHIDID_INTERFACEKIT_4_8_8, PHIDID_INTERFACEKIT_8_8_8, PHIDID_INTERFACEKIT_8_8_8_w_LCD, PHIDID_IR, PHIDID_LED_64, PHIDID_LED_64_ADV, PHIDID_LINEAR_TOUCH, PHIDID_MOTORCONTROL_1MOTOR, PHIDID_MOTORCONTROL_HC_2MOTOR, PHIDID_MOTORCONTROL_LV_2MOTOR_4INPUT, PHIDID_NOTHING, PHIDID_PHSENSOR, PHIDID_RFID, PHIDID_RFID_2OUTPUT, PHIDID_RFID_2OUTPUT_READ_WRITE, PHIDID_ROTARY_TOUCH, PHIDID_SERVO_1MOTOR, PHIDID_SERVO_1MOTOR_OLD, PHIDID_SERVO_4MOTOR, PHIDID_SERVO_4MOTOR_OLD, PHIDID_SPATIAL_ACCEL_3AXIS, PHIDID_SPATIAL_ACCEL_GYRO_COMPASS, PHIDID_TEMPERATURESENSOR, PHIDID_TEMPERATURESENSOR_4, PHIDID_TEMPERATURESENSOR_IR, PHIDID_TEXTLCD_2x20, PHIDID_TEXTLCD_2x20_w_0_8_8, PHIDID_TEXTLCD_2x20_w_8_8_8, PHIDID_TEXTLCD_ADAPTER, PHIDID_TEXTLED_1x8, PHIDID_TEXTLED_4x8, PHIDID_UNIPOLAR_STEPPER_4MOTOR, PHIDID_WEIGHTSENSOR
 
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 com.phidgets.Phidget
addAttachListener, addDetachListener, addErrorListener, addServerConnectListener, addServerDisconnectListener, close, disableLogging, enableLogging, equals, getDeviceClass, getDeviceID, getDeviceLabel, getDeviceName, getDeviceType, getDeviceVersion, getLibraryVersion, getSerialNumber, getServerAddress, getServerID, getServerPort, isAttached, isAttachedToServer, log, open, open, open, open, open, openAny, openAny, openAny, openAny, openAny, openLabel, openLabel, openLabel, openLabel, openLabel, removeAttachListener, removeDetachListener, removeErrorListener, removeServerConnectListener, removeServerDisconnectListener, setDeviceLabel, toString, waitForAttachment, waitForAttachment
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PHIDGET_SERVO_DEFAULT

public static final int PHIDGET_SERVO_DEFAULT
Default - This is what the servo API been historically used, originally based on the Futaba FP-S148. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_RAW_us_MODE

public static final int PHIDGET_SERVO_RAW_us_MODE
Raw us mode - all position, velocity, acceleration functions are specified in microseconds rather then degrees. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS322HD

public static final int PHIDGET_SERVO_HITEC_HS322HD
HiTec HS-322HD Standard Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS5245MG

public static final int PHIDGET_SERVO_HITEC_HS5245MG
HiTec HS-5245MG Digital Mini Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_805BB

public static final int PHIDGET_SERVO_HITEC_805BB
HiTec HS-805BB Mega Quarter Scale Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS422

public static final int PHIDGET_SERVO_HITEC_HS422
HiTec HS-422 Standard Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_TOWERPRO_MG90

public static final int PHIDGET_SERVO_TOWERPRO_MG90
Tower Pro MG90 Micro Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HSR1425CR

public static final int PHIDGET_SERVO_HITEC_HSR1425CR
HiTec HSR-1425CR Continuous Rotation Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS785HB

public static final int PHIDGET_SERVO_HITEC_HS785HB
HiTec HS-785HB Sail Winch Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS485HB

public static final int PHIDGET_SERVO_HITEC_HS485HB
HiTec HS-485HB Deluxe Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_HS645MG

public static final int PHIDGET_SERVO_HITEC_HS645MG
HiTec HS-645MG Ultra Torque Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_HITEC_815BB

public static final int PHIDGET_SERVO_HITEC_815BB
HiTec HS-815BB Mega Sail Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R

public static final int PHIDGET_SERVO_FIRGELLI_L12_30_50_06_R
Firgelli L12 Linear Actuator 30mm 50:1. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R

public static final int PHIDGET_SERVO_FIRGELLI_L12_50_100_06_R
Firgelli L12 Linear Actuator 50mm 100:1. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R

public static final int PHIDGET_SERVO_FIRGELLI_L12_50_210_06_R
Firgelli L12 Linear Actuator 50mm 210:1. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R

public static final int PHIDGET_SERVO_FIRGELLI_L12_100_50_06_R
Firgelli L12 Linear Actuator 100mm 50:1. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R

public static final int PHIDGET_SERVO_FIRGELLI_L12_100_100_06_R
Firgelli L12 Linear Actuator 100mm 100:1. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S2313M

public static final int PHIDGET_SERVO_SPRINGRC_SM_S2313M
SpringRC SM-S2313M Micro Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S3317M

public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317M
SpringRC SM-S3317M Small Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S3317SR

public static final int PHIDGET_SERVO_SPRINGRC_SM_S3317SR
SpringRC SM-S3317SR Small Continuous Rotation Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S4303R

public static final int PHIDGET_SERVO_SPRINGRC_SM_S4303R
SpringRC SM-S4303R Standard Continuous Rotation Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S4315M

public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315M
SpringRC SM-S4315M High Torque Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S4315R

public static final int PHIDGET_SERVO_SPRINGRC_SM_S4315R
SpringRC SM-S4315R High Torque Continuous Rotation Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_SPRINGRC_SM_S4505B

public static final int PHIDGET_SERVO_SPRINGRC_SM_S4505B
SpringRC SM-S4505B Standard Servo. This is used with getServoType and setServoType

See Also:
Constant Field Values

PHIDGET_SERVO_USER_DEFINED

public static final int PHIDGET_SERVO_USER_DEFINED
User Defined servo parameters. This is used with getServoType

See Also:
Constant Field Values
Constructor Detail

AdvancedServoPhidget

public AdvancedServoPhidget()
                     throws PhidgetException
Method Detail

getMotorCount

public int getMotorCount()
                  throws PhidgetException
Returns the number of servo motors supported by this Phidget. This does not neccesarily correspond to the number of motors actually attached to the board.

Returns:
number of supported motors
Throws:
PhidgetException - If this Phidget is not opened and attached. See open for information on determining if a device is attached.

getAccelerationMax

public double getAccelerationMax(int index)
                          throws PhidgetException
Returns the maximum acceleration that a motor will accept, or return.

This value is in degrees per second squared.

Parameters:
index - Index of the motor
Returns:
Maximum acceleration
Throws:
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.

getAccelerationMin

public double getAccelerationMin(int index)
                          throws PhidgetException
Returns the minimum acceleration that a motor will accept, or return.

This value is in degrees per second squared.

Parameters:
index - Index of the motor
Returns:
Minimum acceleration
Throws:
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.

getVelocityMax

public double getVelocityMax(int index)
                      throws PhidgetException
Returns the maximum velocity that a servo motor will accept, or return.

This value is in degrees per second.

Parameters:
index - Index of the motor
Returns:
Maximum velocity
Throws:
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.

getVelocityMin

public double getVelocityMin(int index)
                      throws PhidgetException
Returns the minimum velocity that a servo motor will accept, or return.

This value is in degrees per second.

Parameters:
index - Index of the motor
Returns:
Minimum velocity
Throws:
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.

getPositionMax

public double getPositionMax(int index)
                      throws PhidgetException
Returns the maximum position that a servo motor will accept, or return.

This value is in degrees.

Parameters:
index - Index of the motor
Returns:
Maximum position
Throws:
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.

setPositionMax

public void setPositionMax(int index,
                           double position)
                    throws PhidgetException
Sets the maximum position that a servo motor will accept, or return. This is for limiting the range of motion of the servo controller. The Maximum cannot be extended beyond it's original value.

This value is in degrees.

Parameters:
index - Index of the motor
position - Maximum position
Throws:
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.

getPositionMin

public double getPositionMin(int index)
                      throws PhidgetException
Returns the minimum position that a servo motor will accept, or return.

This value uses the same units as

This value is in degrees.

Parameters:
index - Index of the motor
Returns:
Minimum position
Throws:
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.

setPositionMin

public void setPositionMin(int index,
                           double position)
                    throws PhidgetException
Sets the minimum position that a servo motor will accept, or return. This is for limiting the range of motion of the servo controller. The Minimum cannot be extended beyond it's original value.

This value is in degrees.

Parameters:
index - Index of the motor
position - Minimum position
Throws:
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.

getAcceleration

public double getAcceleration(int index)
                       throws PhidgetException
Returns a motor's acceleration. The valid range is between 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.

Parameters:
index - index of motor
Returns:
acceleration of motor
Throws:
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.

setAcceleration

public void setAcceleration(int index,
                            double acceleration)
                     throws PhidgetException
Sets a motor's acceleration. The valid range is between getAccelerationMin and getAccelerationMax. This controls how fast the motor changes speed.

This value is in degrees per second squared.

Parameters:
index - index of the motor
acceleration - requested acceleration for that motor
Throws:
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.

getVelocityLimit

public double getVelocityLimit(int index)
                        throws PhidgetException
Returns a motor's velocity limit. This is the maximum velocity that the motor will turn at. The valid range is between getVelocityMin and getVelocityMax, with 0 being stopped.

This value is in degrees per second.

Parameters:
index - index of the motor
Returns:
current speed of the motor
Throws:
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.

setVelocityLimit

public void setVelocityLimit(int index,
                             double velocity)
                      throws PhidgetException
Sets a motor's velocity limit. This is the maximum velocity that the motor will turn at. The valid range is between getVelocityMin and getVelocityMax, with 0 being stopped.

This value is in degrees per second.

Parameters:
index - index of the motor
velocity - requested velocity for the motor
Throws:
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.

getVelocity

public double getVelocity(int index)
                   throws PhidgetException
Returns a motor's current velocity. The valid range is between getVelocityMin and getVelocityMax, with 0 being stopped.

This value is in degrees per second.

Parameters:
index - index of the motor
Returns:
current speed of the motor
Throws:
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.

getPosition

public double getPosition(int index)
                   throws PhidgetException
Returns a motor's current position. This is the actual position that the motor is at right now. The valid range is between getPositionMin and getPositionMax.

This value is in degrees.

Parameters:
index - index of the motor
Returns:
current position of the motor
Throws:
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.

setPosition

public void setPosition(int index,
                        double position)
                 throws PhidgetException
Sets a motor's target position. Use this is set the target position for the servo. If the servo is engaged it will start moving towards this target position. The valid range is between getPositionMin and getPositionMax.

This value is in degrees.

Parameters:
index - index of the motor
position - target position of the motor
Throws:
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.

getEngaged

public boolean getEngaged(int index)
                   throws PhidgetException
Returns the engaged state of a motor.

Throws:
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.

setEngaged

public void setEngaged(int index,
                       boolean state)
                throws PhidgetException
Engage or disengage a motor.

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.

Throws:
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.

getSpeedRampingOn

public boolean getSpeedRampingOn(int index)
                          throws PhidgetException
Returns the speed ramping state of a motor.

Throws:
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.

setSpeedRampingOn

public void setSpeedRampingOn(int index,
                              boolean state)
                       throws PhidgetException
Sets the speed ramping state.

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.

Throws:
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.

getCurrent

public double getCurrent(int index)
                  throws PhidgetException
Returns a motor's current usage. The valid range depends on the servo controller. This value is in Amps.

Parameters:
index - index of the motor
Returns:
current usage of the motor
Throws:
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.

getStopped

public boolean getStopped(int index)
                   throws PhidgetException
Returns the stopped state of a motor. Use this to determine if the motor is moving and/or up to date with the latest commands you have sent. If this is true, the motor is guaranteed to be stopped and to have processed every command issued. Generally, this would be polled after a target position is set to wait until that position is reached.

Throws:
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.

getServoType

public int 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.

Parameters:
index - Input
Returns:
Servo Type
Throws:
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.

setServoType

public void 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. 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.

Parameters:
index - Input
type - Servo Type
Throws:
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.

setServoParameters

public void setServoParameters(int index,
                               double minUs,
                               double maxUs,
                               double degrees,
                               double velocityMax)
                        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. Velocity is also constrained to the maximum speed attainable by the servo.

Parameters:
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
velocityMax - Maximum supported velocity of the servo in degrees/second
Throws:
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.

addServoPositionChangeListener

public final void addServoPositionChangeListener(ServoPositionChangeListener l)
Adds a position change listener. The position change handler is a method that will be called when the servo position has changed.

There is no limit on the number of position change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the ServoPositionChangeListener interface

removeServoPositionChangeListener

public final void removeServoPositionChangeListener(ServoPositionChangeListener l)

addServoVelocityChangeListener

public final void addServoVelocityChangeListener(ServoVelocityChangeListener l)
Adds a velocity change listener. The velocity change handler is a method that will be called when the servo velocity has changed.

There is no limit on the number of velocity change handlers that can be registered for a particular Phidget.

Parameters:
l - An implemetation of the ServoVelocityChangeListener interface

removeServoVelocityChangeListener

public final void removeServoVelocityChangeListener(ServoVelocityChangeListener l)

addCurrentChangeListener

public final void addCurrentChangeListener(CurrentChangeListener l)
Adds a current change listener. The current change handler is a method that will be called when the servo current has changed.

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.

Parameters:
l - An implemetation of the CurrentChangeListener interface

removeCurrentChangeListener

public final void removeCurrentChangeListener(CurrentChangeListener l)