|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.StepperPhidget
This class represents a Phidget Stepper Controller. All methods to to control a stepper controller and read back stepper data are implemented in this class.
The Phidget Stepper is able to control 1 or more Stepper motors. Motor Acceleration and Velocity are controllable, and micro-stepping is used. The type and number of motors that can be controlled depend on the Stepper Controller. Digital inputs are available on select Phidget Stepper Controllers.
Field Summary |
Constructor Summary | |
StepperPhidget()
|
Method Summary | |
void |
addCurrentChangeListener(CurrentChangeListener l)
Adds a current change listener. |
void |
addInputChangeListener(InputChangeListener l)
Adds an input change listener. |
void |
addStepperPositionChangeListener(StepperPositionChangeListener l)
Adds a position change listener. |
void |
addStepperVelocityChangeListener(StepperVelocityChangeListener 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. |
double |
getCurrentLimit(int index)
Returns the current limit. |
double |
getCurrentMax(int index)
Returns the maximum current that a stepper motor will accept, or return. |
double |
getCurrentMin(int index)
Returns the minimum current that a stepper motor will accept, or return. |
long |
getCurrentPosition(int index)
Returns a motor's current position. |
boolean |
getEngaged(int index)
Returns the engaged state of a motor. |
int |
getInputCount()
Returns the number of digital inputs. |
boolean |
getInputState(int index)
Returns the state of a digital input. |
int |
getMotorCount()
Returns the number of stepper motors supported by this Phidget. |
long |
getPositionMax(int index)
Returns the maximum position that a stepper motor will accept, or return. |
long |
getPositionMin(int index)
Returns the minimum position that a stepper motor will accept, or return. |
boolean |
getStopped(int index)
Returns the stopped state of a motor. |
long |
getTargetPosition(int index)
Returns a motor's target position. |
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 stepper motor will accept, or return. |
double |
getVelocityMin(int index)
Returns the minimum velocity that a stepper motor will accept, or return. |
void |
removeCurrentChangeListener(CurrentChangeListener l)
|
void |
removeInputChangeListener(InputChangeListener l)
|
void |
removeStepperPositionChangeListener(StepperPositionChangeListener l)
|
void |
removeStepperVelocityChangeListener(StepperVelocityChangeListener l)
|
void |
setAcceleration(int index,
double acceleration)
Sets a motor's acceleration. |
void |
setCurrentLimit(int index,
double current)
Sets a motor's current usage limit. |
void |
setCurrentPosition(int index,
long position)
Sets a motor's current position. |
void |
setEngaged(int index,
boolean state)
Engage or disengage a motor. |
void |
setTargetPosition(int index,
long position)
Sets a motor's target position. |
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 |
Constructor Detail |
public StepperPhidget() 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 int getInputCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public boolean getInputState(int index) throws PhidgetException
index
- index of the input
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 Stepper Controller will change the speed of a motor.
This value is in (micro)steps per second squared. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps 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 double getAccelerationMax(int index) throws PhidgetException
This value uses the same units as setAcceleration
/getAcceleration
.
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 uses the same units as setAcceleration
/getAcceleration
.
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 setAcceleration(int index, double acceleration) throws PhidgetException
getAccelerationMin
and getAccelerationMax
.
This controls how fast the motor changes speed.
This value is in (micro)steps per second squared. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps 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 getVelocity(int index) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in (micro)steps per second. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps 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 getVelocityMax(int index) throws PhidgetException
This value uses the same units as setVelocityLimit
/getVelocityLimit
and getVelocity
.
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 uses the same units as setVelocityLimit
/getVelocityLimit
and getVelocity
.
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 setVelocityLimit(int index, double velocity) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in (micro)steps per second. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps 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 getVelocityLimit(int index) throws PhidgetException
getVelocityMin
and getVelocityMax
,
with 0 being stopped.
This value is in (micro)steps per second. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps 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 long getPositionMax(int index) throws PhidgetException
This value uses the same units as
setTargetPosition
/getTargetPosition
and setCurrentPosition
/getCurrentPosition
.
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 long getPositionMin(int index) throws PhidgetException
This value uses the same units as
setTargetPosition
/getTargetPosition
and setCurrentPosition
/getCurrentPosition
.
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 setCurrentPosition(int index, long position) throws PhidgetException
setTargetPosition
to move the motor to a position.
The valid range is between getPositionMin
and getPositionMax
.
This value is in (micro)steps. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps.
index
- index of the motorposition
- current 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 long getCurrentPosition(int index) throws PhidgetException
getPositionMin
and getPositionMax
.
This value is in (micro)steps. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps.
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 setTargetPosition(int index, long position) throws PhidgetException
engaged
it will start moving towards
this target position.
The valid range is between getPositionMin
and getPositionMax
.
This value is in (micro)steps. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps.
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 long getTargetPosition(int index) throws PhidgetException
current position
.
The valid range is between getPositionMin
and getPositionMax
.
This value is in (micro)steps. The step unit will depend on the Stepper Controller. For example, the Bipolar Stepper controller has an accuracy of 16th steps, so this value would be in 16th steps.
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 double getCurrent(int index) throws PhidgetException
getCurrentMin
and getCurrentMax
.
This value is in Amps.
Note that this is not supported on all stepper controllers.
index
- index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, if the value is unknown, or if this is not supported.
See open
for information on determining if a device is attached.public double getCurrentLimit(int index) throws PhidgetException
This value is in Amps.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, if the value is unknown, or if this is not supported.
See open
for information on determining if a device is attached.public void setCurrentLimit(int index, double current) throws PhidgetException
getCurrentMin
and getCurrentMax
.
This sets the maximum current that a motor will be allowed to draw. Use this with the Bipolar stepper controller to get smooth micro stepping -
see the product manual for more details. This value is in Amps.
Note that this is not supported on all stepper controllers.
index
- index of the motorcurrent
- current limit for the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, if the value is unknown, or if this is not supported.
See open
for information on determining if a device is attached.public double getCurrentMax(int index) throws PhidgetException
This value is in Amps.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if this is not supported.
See open
for information on determining if a device is attached.public double getCurrentMin(int index) throws PhidgetException
This value is in Amps.
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached, if the index is invalid, or if this is not supported.
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 stepper motor. The motors are by default disengaged when the stepper controller is plugged in. When the stepper 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.
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 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 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 final void addStepperPositionChangeListener(StepperPositionChangeListener 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 StepperPositionChangeListener
interfacepublic final void removeStepperPositionChangeListener(StepperPositionChangeListener l)
public final void addStepperVelocityChangeListener(StepperVelocityChangeListener 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 StepperVelocityChangeListener
interfacepublic final void removeStepperVelocityChangeListener(StepperVelocityChangeListener 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)
public final void addInputChangeListener(InputChangeListener l)
There is no limit on the number of input change handlers that can be registered for a particular Phidget.
l
- An implemetation of the InputChangeListener
interfacepublic final void removeInputChangeListener(InputChangeListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |