devs.motorpackage.asc16
Class Servo

java.lang.Object
  extended by java.lang.Thread
      extended by devs.motorpackage.asc16.Motor
          extended by 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 Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
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
 
Fields inherited from interface biocell.BioDevice
BLOCKED, BUSY, CYCLING, DONE, END, PAUSED, RESUMED, START, WAIT
 
Fields inherited from interface devs.motorpackage.asc16.ASC16Listener
HIGH_POSITION, HIGH_SPEED, LOW_POSITION, LOW_SPEED, MIDDLE_SPEED, MIDLE_POSITION
 
Constructor Summary
Servo(ASC16 motorController, int low, int high, int low_speed, int high_speed, int servoNumber)
           
Servo(int servoNumber)
           
 
Method Summary
 void addListener(BioDeviceListener listener)
           
 void flushQueue()
           
 int getAcceleration()
           
 int getCenterPosition()
           
 java.lang.String getControls()
           
 int getCurrentPosition()
           
 int getCurrentSpeed()
           
 int getCurrentState()
           
 int getHighPosition()
           
 int getHighSpeed()
           
 int getLowPosition()
           
 int getLowSpeed()
           
 ASC16 getMotorController()
           
 int getMotorNumber()
           
 java.lang.String getname()
           
 int getNormHighPosition()
           
 int getNormLowPosition()
           
 void initialize()
          Sets Servo to center Independent of thread
 void load(MNSEvent cnE)
          simple interface to control all Devices
 void loadCNTR(MNSEvent mnE)
           
 void process(MNSEvent cnv)
          loads a CNSEvent into a listener
 void setAcceleration(int acceleration)
           
 void setNormHighPosition(int highPosition)
           
 void setNormHighSpeed(int highSpeed)
           
 void setNormLowPosition(int lowPosition)
           
 void setNormLowSpeed(int lowSpeed)
           
 void setSpeed(int newSpeed)
           
 void stateChanged()
           
 
Methods inherited from class devs.motorpackage.asc16.Motor
fireMotorEvent, removeMotorListener
 
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
 

Constructor Detail

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 - - ASC16
low - - min position
high - - max position
low_speed - - min speed
high_speed - - max speed
servoNumber - - iD
Method Detail

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