stella.omc
Class RelativeWheel

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by io.AbstractDriver
                  extended by io.AbstractSerialDriver
                      extended by stella.omc.MotorController
                          extended by stella.omc.RelativeWheel
All Implemented Interfaces:
Driver, Cloneable, MultiAxes, Positioning, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class RelativeWheel
extends MotorController
implements Positioning

Extension of the MotorController class. Its aim is to provide a simple interface for the STELLA WIFSIP wheel operation. The two important method can set the wheel in its zero position and (then) in arbitrary position specified by the holes in the wheel. The class has syslog capabilities through the protomatter syslog classes. last modified: JB, 25.04.2007.


Nested Class Summary
static class RelativeWheel.Test
           
 
Nested classes/interfaces inherited from class stella.omc.MotorController
MotorController.AxesReset, MotorController.Dump, MotorController.Reset, MotorController.Set, MotorController.Status, MotorController.Step
 
Nested classes/interfaces inherited from class io.AbstractSerialDriver
AbstractSerialDriver.Available
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private static String DEFAXIS
          The axis name.
static String DEFDRIVERNAME
          Default driver name.
private static boolean DEFINITZERO
          Default zero-positioning on init.
private static double DEFOFFSETDEG
          The default positionoffset in the filter wheel, degrees.
private static String DEFPARAMETERS
          The default initializing parameters.
private static String DEFPOSITIONS
          The default position in the filter wheel.
private static boolean DEFPOWEROFF
          Default power-off after movement.
private static int DEFRATIO
           
private static boolean DEFRESETONCLOSE
          Default power-off after movement.
private static int DEFSTEPS
           
private static String DEFZEROEND
           
private  List<Double> holes
          List of positions available from KEY_POSITIONS.
static String KEY_OFFSETDEG
          The offsets to the positions in the filter wheel, degrees.
static String KEY_PARAMETERS
          The parameters to send on init as a map.
static String KEY_POSITIONS
          The positions in the filter wheel.
static String KEY_POWEROFF
          If true, we power-off after moving.
static String KEY_RATIO
           
static String KEY_RESETONCLOSE
          If true, we return to zero-point on clsoe.
static String KEY_STEPS
           
static String KEY_ZEROEND
          + or - end of the linear unit corresponds to the zero position.
private  int lastposition
          Last position successfully obtained.
private  boolean motorZeroPositioned
           
private  int totalSteps
           
 
Fields inherited from class stella.omc.MotorController
axis, FAILED, HOME, KEY_ADDRESS, KEY_AXES, KEY_CONTROLLERTYPE, KEY_DELAY, KEY_EEPROMSTORE, KEY_FAILAXISMOVE, KEY_PROTOCOL, KEY_RETRYPOS, KEY_SERIALRETRY, KEY_SLEEPAXISMOVE, KEY_STEPTOLERANCE, KEY_TELEGRAM, KEY_WORKAROUND, MCC, OK, OMC, UNDEFINEDPOSITION
 
Fields inherited from class io.AbstractSerialDriver
inport, KEY_BAUDRATE, KEY_CLOSETIMEOUT, KEY_DATABIT, KEY_FLOWCONTROL, KEY_INBUFFER, KEY_NOTIFYCOOLDOWN, KEY_OUTBUFFER, KEY_PARITYBIT, KEY_PORTNAME, KEY_RECEIVEFRAMING, KEY_RECEIVETHRESHOLD, KEY_RECEIVETIMEOUT, KEY_STOPBIT, KEY_TIMEOUT, outport, staticlock
 
Fields inherited from class io.AbstractDriver
KEY_DRIVERNAME
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface stella.omc.MultiAxes
KEY_INITZERO
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
RelativeWheel(Map<String,String> config)
          Constructor.
 
Method Summary
 boolean close()
          If desired, we move the wheel close to the zero point on close to shorten the next init.
protected  double getControllerParameter(String param)
           
 int getMaxPosition()
          Returns the maximumk number of allowed positions.
 int getMaxPosition(String axis)
          Compatibility mode.
 int getMaxStep(String axis)
          Returns the maximal steps this axis can travel.
protected  Map<String,String> getParametersFor(String ax)
          We have only a single axis, thus, always return a single map.
 int getPosition()
          Returns the last position attained or MotorController.UNDEFINEDPOSITION.
 int getPosition(String axis)
          Compatibility mode.
 void init()
          Initializes position look-up table.
 boolean offset(int diff)
          Rotates the desired number of steps from the current position, no nulling.
 boolean offset(String axis, int pos)
          Compatibility mode.
 boolean open()
          Sets the filter wheel into zero position after opening.
 short readAnalog(int nr)
          Read an A/D port.
 boolean setPosition(int pos)
          Sets the wheel in one of the 24 position.
 boolean setPosition(String axis, int pos)
          Compatibility mode.
 boolean setZeroPosition()
          Sets the filter wheel to its mechanical zero position (M0P).
 boolean setZeroPosition(String axis)
          Compatibility mode.
 
Methods inherited from class stella.omc.MotorController
axisStop, encapsulate, ensureCommand, errorPower, errorStep, errorStop, getAxesNames, getControllerParameter, getControllerParameterArray, getControllerType, getStatus, getStatus, getStep, getStepResolution, isContinuous, powerOff, powerOn, readString, readString, remote, reset, resetAxis, setControllerParameter, waitWhileAxisMoving, waitWhileAxisMoving, writeCommand, writeCommand, writeString, writeString
 
Methods inherited from class io.AbstractSerialDriver
createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameters
 
Methods inherited from class io.AbstractDriver
createDriver, equals, hashCode
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface stella.omc.MultiAxes
getAxesNames, getStep, isContinuous
 
Methods inherited from interface io.Driver
getDriverName, isOpen
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

KEY_RATIO

public static final String KEY_RATIO
See Also:
Constant Field Values

DEFRATIO

private static final int DEFRATIO
See Also:
Constant Field Values

KEY_STEPS

public static final String KEY_STEPS
See Also:
Constant Field Values

DEFSTEPS

private static final int DEFSTEPS
See Also:
Constant Field Values

KEY_POSITIONS

public static final String KEY_POSITIONS
The positions in the filter wheel.

See Also:
Constant Field Values

KEY_OFFSETDEG

public static final String KEY_OFFSETDEG
The offsets to the positions in the filter wheel, degrees.

See Also:
Constant Field Values

DEFDRIVERNAME

public static final String DEFDRIVERNAME
Default driver name.

See Also:
Constant Field Values

KEY_PARAMETERS

public static final String KEY_PARAMETERS
The parameters to send on init as a map.

See Also:
Constant Field Values

KEY_POWEROFF

public static final String KEY_POWEROFF
If true, we power-off after moving.

See Also:
Constant Field Values

KEY_RESETONCLOSE

public static final String KEY_RESETONCLOSE
If true, we return to zero-point on clsoe.

See Also:
Constant Field Values

KEY_ZEROEND

public static final String KEY_ZEROEND
+ or - end of the linear unit corresponds to the zero position.

See Also:
Constant Field Values

DEFZEROEND

private static final String DEFZEROEND
See Also:
Constant Field Values

DEFAXIS

private static final String DEFAXIS
The axis name.

See Also:
Constant Field Values

DEFPOSITIONS

private static final String DEFPOSITIONS
The default position in the filter wheel.

See Also:
Constant Field Values

DEFOFFSETDEG

private static final double DEFOFFSETDEG
The default positionoffset in the filter wheel, degrees.

See Also:
Constant Field Values

DEFPARAMETERS

private static final String DEFPARAMETERS
The default initializing parameters.

See Also:
Constant Field Values

DEFINITZERO

private static final boolean DEFINITZERO
Default zero-positioning on init.

See Also:
Constant Field Values

DEFPOWEROFF

private static final boolean DEFPOWEROFF
Default power-off after movement.

See Also:
Constant Field Values

DEFRESETONCLOSE

private static final boolean DEFRESETONCLOSE
Default power-off after movement.

See Also:
Constant Field Values

motorZeroPositioned

private boolean motorZeroPositioned

totalSteps

private int totalSteps

holes

private List<Double> holes
List of positions available from KEY_POSITIONS.


lastposition

private int lastposition
Last position successfully obtained.

Constructor Detail

RelativeWheel

public RelativeWheel(Map<String,String> config)
Constructor.

Method Detail

init

public void init()
Initializes position look-up table. Additionall move to zero position if init of super class succeeds.

Specified by:
init in interface Initializable
Overrides:
init in class MotorController

open

public boolean open()
             throws IOException
Sets the filter wheel into zero position after opening.

Specified by:
open in interface Driver
Overrides:
open in class MotorController
Returns:
True if initialization was successful.
Throws:
IOException

getParametersFor

protected Map<String,String> getParametersFor(String ax)
We have only a single axis, thus, always return a single map.

Specified by:
getParametersFor in class MotorController

close

public boolean close()
              throws IOException
If desired, we move the wheel close to the zero point on close to shorten the next init.

Specified by:
close in interface Driver
Overrides:
close in class AbstractSerialDriver
Returns:
True if clean-up was successful.
Throws:
IOException

getControllerParameter

protected double getControllerParameter(String param)
                                 throws IOException,
                                        NullPointerException
Throws:
IOException
NullPointerException

setPosition

public boolean setPosition(String axis,
                           int pos)
                    throws IOException
Compatibility mode.

Specified by:
setPosition in interface MultiAxes
Parameters:
axis - The name of the axis to be zero-setted.
pos - The numbered position to be attained.
Returns:
True on success
Throws:
IOException - If driver communication failed.

offset

public boolean offset(String axis,
                      int pos)
               throws IOException
Compatibility mode.

Specified by:
offset in interface MultiAxes
Parameters:
axis - The name of the axis to be zero-setted.
pos - The number of step, positiv or negative in driver-specific coordinates.
Returns:
True on success
Throws:
IOException - If driver communication failed.

setZeroPosition

public boolean setZeroPosition(String axis)
                        throws IOException
Compatibility mode.

Specified by:
setZeroPosition in interface MultiAxes
Parameters:
axis - The name of the axis to be zero-setted.
Returns:
True on success
Throws:
IOException - If driver communication failed.

getPosition

public int getPosition(String axis)
                throws IOException
Compatibility mode.

Specified by:
getPosition in interface MultiAxes
Parameters:
axis - The name of the axis to be zero-setted.
Returns:
A integer denoting one of the attainable positions.
Throws:
IOException - If driver communication failed.

getMaxPosition

public int getMaxPosition(String axis)
                   throws IOException
Compatibility mode.

Specified by:
getMaxPosition in interface MultiAxes
Parameters:
axis - String representing the selected axis.
Throws:
IOException

getMaxStep

public int getMaxStep(String axis)
Description copied from interface: MultiAxes
Returns the maximal steps this axis can travel. Used together with MultiAxes.getMaxPosition(java.lang.String) to estimate the number of steps per position.

Specified by:
getMaxStep in interface MultiAxes

setPosition

public boolean setPosition(int pos)
                    throws IOException
Sets the wheel in one of the 24 position.

Specified by:
setPosition in interface Positioning
Parameters:
pos - Integer (0 - 23) specifying the wheel position.
Returns:
True on success
Throws:
IOException - If driver communication failed.

getPosition

public int getPosition()
Returns the last position attained or MotorController.UNDEFINEDPOSITION.

Specified by:
getPosition in interface Positioning
Returns:
A integer denoting one of the attainable positions.

getMaxPosition

public int getMaxPosition()
Returns the maximumk number of allowed positions.

Specified by:
getMaxPosition in interface Positioning

offset

public boolean offset(int diff)
               throws IOException
Rotates the desired number of steps from the current position, no nulling.

Specified by:
offset in interface Positioning
Throws:
IOException

readAnalog

public short readAnalog(int nr)
Read an A/D port. State address. Return value is a 10-bit integer, with 1023 for 5V. Negative values indicate invalid reading.


setZeroPosition

public boolean setZeroPosition()
                        throws IOException
Sets the filter wheel to its mechanical zero position (M0P).

Specified by:
setZeroPosition in interface Positioning
Returns:
True on success
Throws:
IOException - If driver communication failed.