devs.motorpackage.asc16
Class Servo
java.lang.Object
java.lang.Thread
devs.motorpackage.asc16.Motor
devs.motorpackage.asc16.Servo
- All Implemented Interfaces:
- BioDevice, ASC16Listener, java.lang.Runnable, java.util.EventListener, MNSListener
public class Servo
- extends Motor
- implements BioDevice, ASC16Listener
- Author:
- martin lukac
Controls servo motors, must point to a comunication class (ASC16)
Servo contains all information regarding servos. This
includes the left right and center frequencies.
| Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Fields inherited from class devs.motorpackage.asc16.Motor |
acceleration, currentPosition, currentSpeed, highPosition, highSpeed, lowPosition, lowSpeed, midlePosition, motorController, motorListeners, motorNumber, newPosition, newSpeed |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
|
Constructor Summary |
Servo(ASC16 motorController,
int low,
int high,
int low_speed,
int high_speed,
int servoNumber)
|
Servo(int servoNumber)
|
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Servo
public Servo(int servoNumber)
- Parameters:
servoNumber -
Servo
public Servo(ASC16 motorController,
int low,
int high,
int low_speed,
int high_speed,
int servoNumber)
- Parameters:
motorController - -
ASC16low - -
min positionhigh - -
max positionlow_speed - -
min speedhigh_speed - -
max speedservoNumber - -
iD
getname
public java.lang.String getname()
- Specified by:
getname in interface BioDevice
- Returns:
getMotorController
public ASC16 getMotorController()
throws java.lang.NullPointerException
- Returns:
- Returns the pointer to the servo controller communication class.
- Throws:
java.lang.NullPointerException
getControls
public java.lang.String getControls()
- Specified by:
getControls in interface BioDevice
- Returns:
process
public void process(MNSEvent cnv)
- Description copied from interface:
MNSListener
- loads a CNSEvent into a listener
- Specified by:
process in interface MNSListener
addListener
public void addListener(BioDeviceListener listener)
- Specified by:
addListener in interface BioDevice
stateChanged
public void stateChanged()
- Specified by:
stateChanged in interface ASC16Listener
initialize
public void initialize()
- Sets Servo to center Independent of thread
getCurrentPosition
public int getCurrentPosition()
- Specified by:
getCurrentPosition in interface BioDevice- Specified by:
getCurrentPosition in class Motor
- Returns:
load
public void load(MNSEvent cnE)
- Description copied from interface:
BioDevice
- simple interface to control all Devices
- Specified by:
load in interface BioDevice
loadCNTR
public void loadCNTR(MNSEvent mnE)
- Specified by:
loadCNTR in interface BioDevice
flushQueue
public void flushQueue()
getCurrentState
public int getCurrentState()
- Specified by:
getCurrentState in interface BioDevice
- Returns:
getMotorNumber
public int getMotorNumber()
- Specified by:
getMotorNumber in class Motor
- Returns:
getCenterPosition
public int getCenterPosition()
getHighPosition
public int getHighPosition()
getLowPosition
public int getLowPosition()
getLowSpeed
public int getLowSpeed()
getHighSpeed
public int getHighSpeed()
getCurrentSpeed
public int getCurrentSpeed()
- Specified by:
getCurrentSpeed in class Motor
- Returns:
setAcceleration
public void setAcceleration(int acceleration)
- Specified by:
setAcceleration in class Motor
getAcceleration
public int getAcceleration()
setSpeed
public void setSpeed(int newSpeed)
- Specified by:
setSpeed in class Motor
setNormHighPosition
public void setNormHighPosition(int highPosition)
- Parameters:
highPosition - The highPosition to set. - using the current servo SCALED values
setNormLowPosition
public void setNormLowPosition(int lowPosition)
- Parameters:
lowPosition - The lowPosition to set. - using the current servo SCALED values
getNormHighPosition
public int getNormHighPosition()
getNormLowPosition
public int getNormLowPosition()
- Parameters:
lowPosition - returned. - using the current servo SCALED values
setNormHighSpeed
public void setNormHighSpeed(int highSpeed)
- Parameters:
highSpeed - The highSpeed to set. - using the current servo SCALED values
setNormLowSpeed
public void setNormLowSpeed(int lowSpeed)
- Parameters:
lowSpeed - The lowSpeed to set. - using the current servo SCALED values