|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.phidgets.Phidget
com.phidgets.MotorControlPhidget
This class represents a Phidget Motor Controller. All Methods to to control a motor controller and read back motor data are implemented in this class.
The Motor Control Phidget is able to control 1 or more DC motors. Both speed and acceleration are controllable. Speed is controlled via PWM. The size of the motors that can be driven depends on the motor controller. See your hardware documentation for more information.
The motor Controller boards also has 0 or more digital inputs.
Field Summary |
Constructor Summary | |
MotorControlPhidget()
|
Method Summary | |
void |
addBackEMFUpdateListener(BackEMFUpdateListener l)
Adds a Back EMF update listener. |
void |
addCurrentChangeListener(CurrentChangeListener l)
Adds a current change listener. |
void |
addCurrentUpdateListener(CurrentUpdateListener l)
Adds a current update listener. |
void |
addEncoderPositionChangeListener(EncoderPositionChangeListener l)
Adds a position change listener. |
void |
addEncoderPositionUpdateListener(EncoderPositionUpdateListener l)
Adds a position update listener. |
void |
addInputChangeListener(InputChangeListener l)
Adds an input change listener. |
void |
addMotorVelocityChangeListener(MotorVelocityChangeListener l)
Adds a velocity change listener. |
void |
addSensorUpdateListener(SensorUpdateListener l)
Adds a sensor update 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 |
getBackEMF(int index)
Sets the Back EMF voltage for a specific motor. |
boolean |
getBackEMFSensingState(int index)
Returns the Back EMF sensing state for a specific motor. |
double |
getBraking(int index)
Returns the braking value for a specific motor. |
double |
getCurrent(int index)
Returns a motor's current usage. |
int |
getEncoderCount()
Returns the number of encoders. |
int |
getEncoderPosition(int index)
Returns the position of an encoder. |
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 motors supported by this Phidget. |
boolean |
getRatiometric()
Returns the ratiometric state of a sensor. |
int |
getSensorCount()
Returns the number of analog inputs. |
int |
getSensorRawValue(int index)
Returns the raw value of a sensor(12-bit). |
int |
getSensorValue(int index)
Returns the value of a sensor. |
double |
getSpeed(int index)
Deprecated. Replaced by getVelocity(int) |
double |
getSupplyVoltage()
Sets the supply voltage for the motors. |
double |
getVelocity(int index)
Returns a motor's velocity. |
void |
removeBackEMFUpdateListener(BackEMFUpdateListener l)
|
void |
removeCurrentChangeListener(CurrentChangeListener l)
|
void |
removeCurrentUpdateListener(CurrentUpdateListener l)
|
void |
removeEncoderPositionChangeListener(EncoderPositionChangeListener l)
|
void |
removeEncoderPositionUpdateListener(EncoderPositionUpdateListener l)
|
void |
removeInputChangeListener(InputChangeListener l)
|
void |
removeMotorVelocityChangeListener(MotorVelocityChangeListener l)
|
void |
removeSensorUpdateListener(SensorUpdateListener l)
|
void |
setAcceleration(int index,
double acceleration)
Sets a motor's acceleration. |
void |
setBackEMFSensingState(int index,
boolean bEMFState)
Sets the Back EMF sensing state for a specific motor. |
void |
setBraking(int index,
double braking)
Sets the braking value for a specific motor. |
void |
setEncoderPosition(int index,
int position)
Sets the position of a specific encoder. |
void |
setRatiometric(boolean ratiometric)
Sets the ratiometric state. |
void |
setSpeed(int index,
double speed)
Deprecated. Replaced by setVelocity(int, double) |
void |
setVelocity(int index,
double velocity)
Sets a motor's velocity. |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MotorControlPhidget() 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 int getEncoderCount() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public int getSensorCount() 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 int getEncoderPosition(int index) throws PhidgetException
setEncoderPosition
. Not all Motor Controllers have encoders.
index
- index of the encoder
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 setEncoderPosition(int index, int position) throws PhidgetException
getEncoderPosition(int)
. Not all Motor Controllers have encoders.
index
- index of the encoderposition
- new position for a encoder.
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 getSensorValue(int index) throws PhidgetException
index
- index of the sensor
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 getSensorRawValue(int index) throws PhidgetException
index
- index of the sensor
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 getRatiometric() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public void setRatiometric(boolean ratiometric) throws PhidgetException
ratiometric
- new ratiometric state of the sensors
PhidgetException
- If this Phidget is not opened and attached.
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 Motor Controller
will change the speed of a motor.
index
- Index of 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.
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 value are invalid.
See open
for information on determining if a device is attached.public double getAccelerationMax(int index) throws PhidgetException
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public double getAccelerationMin(int index) throws PhidgetException
index
- Index of the motor
PhidgetException
- If this Phidget is not opened and attached.
See open
for information on determining if a device is attached.public double getVelocity(int index) throws PhidgetException
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 getSpeed(int index) throws PhidgetException
getVelocity(int)
PhidgetException
public void setVelocity(int index, double velocity) throws PhidgetException
index
- index of the motorvelocity
- requested velocity for the motor
PhidgetException
- If this Phidget is not opened and attached, or if the index or speed value are invalid.
See open
for information on determining if a device is attached.public void setSpeed(int index, double speed) throws PhidgetException
setVelocity(int, double)
PhidgetException
public double getCurrent(int index) throws PhidgetException
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 boolean getBackEMFSensingState(int index) throws PhidgetException
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 setBackEMFSensingState(int index, boolean bEMFState) throws PhidgetException
index
- Index of the motorbEMFState
- new Back EMF Sensing State
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 getBackEMF(int index) throws PhidgetException
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 getSupplyVoltage() throws PhidgetException
PhidgetException
- If this Phidget is not opened and attached, the index is invalid, or if setBackEMFSensingState
is not set.
See open
for information on determining if a device is attached.public double getBraking(int index) throws PhidgetException
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 setBraking(int index, double braking) throws PhidgetException
index
- index of the motorbraking
- new braking value for a specific motor
PhidgetException
- If this Phidget is not opened and attached, the index is invalid, or the brake value is invalid
See open
for information on determining if a device is attached.public final void addMotorVelocityChangeListener(MotorVelocityChangeListener 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 MotorVelocityChangeListener
interfacepublic final void removeMotorVelocityChangeListener(MotorVelocityChangeListener 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.
l
- An implemetation of the CurrentChangeListener
interfacepublic final void removeCurrentChangeListener(CurrentChangeListener l)
public final void addCurrentUpdateListener(CurrentUpdateListener l)
There is no limit on the number of current update handlers that can be registered for a particular Phidget.
l
- An implemetation of the CurrentUpdateListener
interfacepublic final void removeCurrentUpdateListener(CurrentUpdateListener 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)
public final void addEncoderPositionChangeListener(EncoderPositionChangeListener l)
getEncoderPosition(int)
.
There is no limit on the number of encoder position change handlers that can be registered for a particular Phidget.
l
- An implemetation of the EncoderPositionChangeListener
interfacepublic final void removeEncoderPositionChangeListener(EncoderPositionChangeListener l)
public final void addEncoderPositionUpdateListener(EncoderPositionUpdateListener l)
getEncoderPosition(int)
.
There is no limit on the number of encoder position update handlers that can be registered for a particular Phidget.
l
- An implemetation of the EncoderPositionUpdateListener
interfacepublic final void removeEncoderPositionUpdateListener(EncoderPositionUpdateListener l)
public final void addBackEMFUpdateListener(BackEMFUpdateListener l)
There is no limit on the number of Back EMF update handlers that can be registered for a particular Phidget.
l
- An implemetation of the BackEMFUpdateListener
interfacepublic final void removeBackEMFUpdateListener(BackEMFUpdateListener l)
public final void addSensorUpdateListener(SensorUpdateListener l)
There is no limit on the number of sensor update handlers that can be registered for a particular Phidget.
l
- An implemetation of the SensorUpdateListener
interfacepublic final void removeSensorUpdateListener(SensorUpdateListener l)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |