public abstract class MotorController extends AbstractSerialDriver implements Initializable
| Modifier and Type | Class and Description |
|---|---|
static class |
MotorController.AxesReset
Resets the controller.
|
static class |
MotorController.Dump
Dumps all parameters to system out.
|
static class |
MotorController.Reset
Resets the controller.
|
static class |
MotorController.Set
Reads the filter wheel configuration from a file and positions to the
specified slot.
|
static class |
MotorController.Status
Dumps the full status message to system out.
|
static class |
MotorController.Step
Steps the filter wheel from the current position to the desired offset.
|
AbstractSerialDriver.Available| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
axis
The names of the axis the controller supports.
|
private static int |
DEFADDRESS
Set the default address.
|
private static String |
DEFCONTROLLERTYPE
Default controller type.
|
private static boolean |
DEFEEPROMSTORE
Storing in EEPROM is not possible per default.
|
private static int |
DEFFAILAXISMOVE
The default axis movement failure maximum.
|
private static String |
DEFPROTOCOL
Default protocol type.
|
private static int |
DEFRESPONSECHOP
The default reading delay in ms.
|
private static long |
DEFRESPONSEDELAY
The default reading delay in ms.
|
private static int |
DEFRETRYPOS |
private static int |
DEFSERIALRETRY
The default reading delay in ms.
|
private static long |
DEFSLEEPAXISMOVE
The default axis movement sleep time .
|
private static int |
DEFSTEPTOLERANCE |
private static int |
DEFTELEGRAM
Set the minimum reply length.
|
private static boolean |
DEFWORKAROUND
Firmware error work-around.
|
static int |
FAILED
Return code for failed.
|
private List<Integer> |
fails
The maximum failures allowed per axis.
|
static int |
HOME
The HOME position.
|
static String |
KEY_ADDRESS
Device address on the serial port.
|
static String |
KEY_AXES
The names of the axis, upper case.
|
static String |
KEY_CONTROLLERTYPE
Controller type .
|
static String |
KEY_EEPROMSTORE
If true, we can store the parameters in the EEPROM
|
static String |
KEY_FAILAXISMOVE
The maximum number of failures allowed during axis movement.
|
static String |
KEY_PROTOCOL
The telegram protocol to use as a string.
|
static String |
KEY_RESPONSECHOP
Availability is chopped to this number of queries.
|
static String |
KEY_RESPONSEDELAY
The key to the maximum reading delay in milliseconds.
|
static String |
KEY_RETRYPOS
Maximum number of repositioning tries at go to step.
|
static String |
KEY_SERIALRETRY
The key to the maximum number of retries for critical reads.
|
static String |
KEY_SLEEPAXISMOVE
Sleep until requery axis movement.
|
static String |
KEY_STEPTOLERANCE
Maximum allowed difference between requested and achieved position.
|
static String |
KEY_TELEGRAM
The minimum length of a telegram (a valid reply).
|
static String |
KEY_WORKAROUND
Firmware error work-around.
|
static String |
MCC
Protocoll type for MMC
|
static int |
OK
Return code for o.k.
|
static String |
OMC
Protocoll type for OMC
|
private List<Long> |
sleeps
The sleep interval per axis.
|
static int |
UNDEFINEDPOSITION
The HOME position.
|
private gnu.io.SerialPortEventListener |
wakeup
This object notifies me on data available.
|
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, LOCK, outport, STATICLOCKKEY_DRIVERNAMEKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORCONFIG, KEY_CLASS| Constructor and Description |
|---|
MotorController(Map<String,String> config)
Constructs a new motor controller.
|
| Modifier and Type | Method and Description |
|---|---|
private char |
axisIsMoving(String ax)
Returns the moving state of the axis.
|
protected boolean |
axisStop(String ax)
Axis stop
|
protected String |
encapsulate(String comm)
Encapsulates a minilig command into a transmission telegram.
|
protected String |
ensureCommand(String comm)
Ensures command write by repeating for maximum
KEY_SERIALRETRY
times. |
protected boolean |
errorPower(String ax)
Error in last stage.
|
protected boolean |
errorStep(String ax)
Error in last stage.
|
protected boolean |
errorStop(String ax)
Error in last stage.
|
Collection<String> |
getAxesNames()
Gets the names of the available axes.
|
protected double |
getControllerParameter(String ax,
String param)
Returns a controller parameter.
|
protected double[] |
getControllerParameterArray(String ax,
int[] ipar)
Returns the values of all parameters indicated in the list.
|
protected String |
getControllerType()
Returns the controller type string.
|
protected abstract Map<String,?> |
getParametersFor(String axisname)
Returns the appropriate parameters for the axis in question.
|
String |
getStatus()
Returns various status information about the controller.
|
protected String |
getStatus(String ax,
boolean all)
Returns staus information.
|
int |
getStep(String axis)
Returns the currently attained step position via a direct query to the
underlying driver.
|
protected int |
getStepResolution(String ax)
Returns the controller's step resolution compiled from the P45 controller
parameter.
|
void |
init()
Initialies the parameter maps, the axis names and their timeouts.
|
boolean |
isContinuous(String axis)
Returns true, if this axis can be continuousely offset, which is likely
the case for rotary stagets, and never the case for linear stages.
|
boolean |
open()
Initializes the driver.
|
protected void |
powerOff(String axis)
Deactivates the power stage of the given axis.
|
protected void |
powerOn(String axis)
Activates the power stage of the given axis.
|
String |
readString()
Reads and interprets the serial response.
|
String |
readString(boolean nolog)
Reads and interprets the serial response.
|
protected void |
remote()
Set the controller to remote
|
protected void |
reset()
Resets the controller.
|
protected boolean |
resetAxis(String ax)
Resets the axis.
|
protected void |
setControllerParameter(String ax,
String param,
int value)
Method to set a controller parameter.
|
protected int |
waitWhileAxisMoving(int axnr)
Waits until the given axis is moving.
|
protected int |
waitWhileAxisMoving(String x) |
String |
writeCommand(String comm)
Sends a MINILOG command to the controller.
|
String |
writeCommand(String comm,
boolean nolog)
Sends a MINILOG command to the controller.
|
String |
writeString(String cmd)
Writes a string to the serial port.
|
String |
writeString(String cmd,
boolean nolog)
Writes a string to the serial port.
|
close, createPortEventListener, createPortEventListener, deregisterSoleEventListener, disableEvent, enableEvent, getDriverName, isOpen, registerSoleEventListener, resetOriginalParameterscreateDriver, equals, hashCodeaugment, augment, augment, augment, augment, clone, 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, initProperties, isNew, parseObject, parseObject, reload, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringpublic static final int OK
public static final int FAILED
public static final int HOME
public static final int UNDEFINEDPOSITION
public static final String OMC
public static final String MCC
public static final String KEY_PROTOCOL
public static final String KEY_RESPONSEDELAY
public static final String KEY_RESPONSECHOP
public static final String KEY_SERIALRETRY
public static final String KEY_TELEGRAM
public static final String KEY_AXES
public static final String KEY_FAILAXISMOVE
public static final String KEY_RETRYPOS
public static final String KEY_STEPTOLERANCE
public static final String KEY_SLEEPAXISMOVE
public static final String KEY_ADDRESS
public static final String KEY_WORKAROUND
public static final String KEY_EEPROMSTORE
public static final String KEY_CONTROLLERTYPE
private static final int DEFFAILAXISMOVE
private static final long DEFSLEEPAXISMOVE
private static final long DEFRESPONSEDELAY
private static final int DEFRESPONSECHOP
private static final int DEFSERIALRETRY
private static final int DEFTELEGRAM
private static final int DEFADDRESS
private static final boolean DEFWORKAROUND
private static final boolean DEFEEPROMSTORE
private static final String DEFCONTROLLERTYPE
private static final String DEFPROTOCOL
private static final int DEFRETRYPOS
private static final int DEFSTEPTOLERANCE
private gnu.io.SerialPortEventListener wakeup
public Collection<String> getAxesNames()
public void init()
throws InitException
init in interface Initializableinit in class AbstractSerialDriverInitExceptionpublic boolean isContinuous(String axis) throws IOException
IOExceptionpublic int getStep(String axis) throws IOException
IOExceptionpublic boolean open()
throws IOException
open in interface Driveropen in class AbstractSerialDriverIOExceptionprotected abstract Map<String,?> getParametersFor(String axisname)
public String writeCommand(String comm) throws IOException
writeCommand in class AbstractSerialDrivercomm - String representing the MINILOG command (like "X+200").IOExceptionpublic String writeCommand(String comm, boolean nolog) throws IOException
comm - String representing the MINILOG command (like "X+200").IOExceptionprotected String encapsulate(String comm)
protected String ensureCommand(String comm) throws IOException
KEY_SERIALRETRY
times. If it fails permanently, an IOException is thrown.IOExceptionpublic String writeString(String cmd) throws IOException
writeString in class AbstractSerialDriverIOExceptionpublic String writeString(String cmd, boolean nolog) throws IOException
IOExceptionpublic String readString() throws IOException
readString in class AbstractSerialDriverIOExceptionpublic String readString(boolean nolog) throws IOException
IOExceptionprotected int waitWhileAxisMoving(String x)
protected int waitWhileAxisMoving(int axnr)
axnr - Number of axis to moveprotected void powerOff(String axis) throws IOException
IOExceptionprotected void powerOn(String axis) throws IOException
IOExceptionprivate char axisIsMoving(String ax) throws IOException
IOExceptionprotected void reset()
throws IOException
IOExceptionprotected void remote()
throws IOException
IOExceptionprotected boolean resetAxis(String ax) throws IOException
IOExceptionprotected boolean errorPower(String ax) throws IOException
IOExceptionprotected boolean errorStep(String ax) throws IOException
IOExceptionprotected boolean errorStop(String ax) throws IOException
IOExceptionprotected boolean axisStop(String ax) throws IOException
IOExceptionprotected double getControllerParameter(String ax, String param) throws IOException, NullPointerException
KEY_SERIALRETRY times.param - String specifying the requested parameter (like "P14");IOExceptionNullPointerExceptionprotected double[] getControllerParameterArray(String ax, int[] ipar) throws IOException, NullPointerException
IOExceptionNullPointerExceptionprotected String getControllerType() throws IOException
IOExceptionprotected int getStepResolution(String ax) throws IOException, NullPointerException
IOExceptionNullPointerExceptionprotected void setControllerParameter(String ax, String param, int value) throws IOException, NullPointerException
param - String specifying the requested parameter (like "P14").value - Integer value of the given parameter to set.IOExceptionNullPointerExceptionpublic String getStatus()