|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.mbari.siam.core.DeviceService
org.mbari.siam.core.BaseInstrumentService
org.mbari.siam.core.PolledInstrumentService
org.mbari.siam.foce.devices.elmo.base.ElmoService
public class ElmoService
| Nested Class Summary | |
|---|---|
class |
ElmoService.Attributes
|
| Field Summary | |
|---|---|
ElmoService.Attributes |
_attributes
Service attributes |
protected ElmoImpl |
_elmo
Elmo implementation |
protected static org.apache.log4j.Logger |
_log4j
Log4j logger |
protected int |
_precision
|
static java.lang.String |
CLOSED_LOOP
|
static int |
DEFAULT_COUNTS_PER_REVOLUTION
|
protected static int |
DEFAULT_PRECISION
|
protected java.text.DecimalFormat |
df
DecimalFormat for number output formatting |
protected int |
DFL_CURRENT_LIMIT_MILLIAMPS
|
protected int |
DFL_MAX_SAMPLE_BYTES
|
protected static int |
MAX_PRECISION
|
protected static int |
MIN_PRECISION
|
static java.lang.String |
OPEN_LOOP
|
static long |
serialVersionUID
serial version, for Serializable interface |
| Fields inherited from class org.mbari.siam.core.BaseInstrumentService |
|---|
_defaultSamplerTask, _defaultSampleScheduleName, _errorCache, _instrumentAttributes, _lastPacket, _lastSensorDataPacket, _maxSampleBytes, _messagePacket, _nPowerRequests, _nWakeRequests, _packetLog, _recordType, _running, _samplerWakeupTime, _scheduleKey, _schedules, _sensorDataPacket, _turbinator, MAX_BASE_RECORDTYPE, RECORDTYPE_DEFAULT, RECORDTYPE_METADATA, RECORDTYPE_UNDEFINED |
| Fields inherited from class org.mbari.siam.core.DeviceService |
|---|
_fromDevice, _instrumentPort, _nodeProperties, _parentNode, _regEntry, _sandBox, _serviceCachePath, _serviceName, _servicePropertiesPath, _serviceXMLPath, _toDevice, CACHED_PROPERTIES_FILENAME, PROPERTIES_FILENAME, XML_FILENAME |
| Fields inherited from class java.rmi.server.RemoteObject |
|---|
ref |
| Fields inherited from interface org.mbari.siam.distributed.Device |
|---|
ERROR, INITIAL, INSTRUMENT_STATE, MDATA_ALL, OK, SAFE, SAMPLING, SERVICE_ATTRIBUTES, SERVICE_CACHE, SERVICE_PROPERTIES, SERVICE_XML, SHUTDOWN, SLEEPING, SUSPEND, UNKNOWN |
| Constructor Summary | |
|---|---|
ElmoService()
|
|
| Method Summary | |
|---|---|
void |
beginMotion()
start motion using current settings n |
double |
counts2orpm(int counts)
Convert output shaft speed (counts/sec) to (rpm) (at output after gear train) (using gear ratio and counts per revolution) |
double |
counts2rpm(int counts)
Convert motor speed (counts/sec) to (rpm) (before gear train) (using countsPerRevolution) |
protected ScheduleSpecifier |
createDefaultSampleSchedule()
required by PolledInstrumentService |
void |
dataCallback(DevicePacket sensorData,
PacketParser.Field[] fields)
dataCallback from the sensors. |
void |
delay(long delayMsec)
delay for specified number of milliseconds |
int |
getCountsPerRevolution()
Get commutation counts per motor revolution. |
int |
getEncoderVelocity()
get motor feedback velocity in counts/sec. |
int |
getEncoderVelocity(int nSamples)
get (average of nSamples) motor feedback velocity in counts/sec. |
int |
getFaultRegister()
return detailed motor fault information. |
double |
getGearRatio()
Get the gear ratio between the motor and the output shaft. |
protected byte[] |
getInstrumentStateMetadata()
Get device-specific metadata (e.g. |
int |
getJoggingVelocity()
get motor jogging (commanded) velocity in counts/sec. |
long |
getPositionCounter()
Get motor position counter for position modes |
long |
getPositionError()
Get difference (counts) between commanded and actual position if available |
SerialPortParameters |
getSerialPortParameters()
required by DeviceService |
int |
getStatusRegister()
return motor status. |
protected PowerPolicy |
initCommunicationPowerPolicy()
Return initial value of communication power policy. |
protected int |
initCurrentLimit()
required by BaseInstrumentService |
void |
initializeController()
Initialize motor controller |
void |
initializeController(int serialMode,
int countsPerRevolution,
double gearRatio,
int mode,
int acceleration,
int deceleration,
int stopDeceleration)
|
protected void |
initializeInstrument()
Override default initializeInstrument. |
protected PowerPolicy |
initInstrumentPowerPolicy()
Return initial value of instrument power policy. |
protected int |
initInstrumentStartDelay()
required by BaseInstrumentService |
protected int |
initMaxSampleBytes()
required by BaseInstrumentService |
protected byte[] |
initPromptString()
required by BaseInstrumentService |
protected byte[] |
initSampleTerminator()
required by BaseInstrumentService |
boolean |
isEnabled()
return motor enabled (MO) status. |
void |
jog(int counts)
command motor velocity in counts/sec |
int |
orpm2counts(double rpm)
Convert output shaft speed (rpm) to (counts/sec) (at output after gear train) (using gear ratio and counts per revolution) |
void |
ptpAbsolute(long position,
boolean wait)
Move motor to absolute position Motion may be subject to modulo position counting modes in effect. |
void |
ptpRelative(long distanceCounts,
boolean wait)
Move motor relative to current position |
java.lang.String |
readRegister(java.lang.String register)
read an Elmo register value |
protected int |
readSample(byte[] sample)
Override base class readSample (defined in BaseInstrumentService) |
protected void |
requestSample()
required by BaseInstrumentService |
int |
rpm2counts(double rpm)
Convert motor speed (rpm) to (counts/sec) (before gear train) (using countsPerRevolution) |
void |
serviceRegisteredCallback(RegistryEntry entry)
Callback for InstrumentDataListener interface, called when service is registered with the InstrumentRegistry Fulfills InstrumentDataListener interface |
void |
setCountsPerRevolution(int value)
Set commutation counts per motor revolution. |
void |
setEnable(boolean value,
long timeoutMsec)
start motion using current settings n |
void |
setGearRatio(double value)
Set the gear ratio between the motor and the output shaft. |
void |
setJoggingVelocity(int counts)
set motor velocity in counts Do not initiate motion |
void |
setPositionCounter(long positionCounts)
Set motor position counter for position modes |
void |
setPTPSpeed(int counts)
set motor PTP velocity (used for Absolute motion) in rpm Do not initiate motion |
void |
setSerialMode(int mode)
Set serial port mode (MODE_SERIAL_LOCAL, MODE_SERIAL_RFC2217) |
java.lang.String |
showConfiguration()
show current configuration information |
protected java.lang.String |
shutdownInstrument()
Perform any instrument-specific shutdown actions and optionally return a human-readable message (e.g. |
int |
test()
Self-test not implemented. |
void |
validateSpeed(int counts)
Validate velocity value. |
| Methods inherited from class org.mbari.siam.core.PolledInstrumentService |
|---|
acquire, doScheduledTask, setAttributes |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|---|
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
|---|
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
|---|
equals, getRef, hashCode, toString, toStub |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.mbari.siam.distributed.Instrument |
|---|
acquireSample, addDefaultPacketFilters, annotate, cacheProperties, clearDefaultPacketFilters, clearPropertiesCache, disableSummary, enableSummary, getDefaultPacketFilters, getLastSample, getPackets, getPackets, getParser, getPortDiagnostics, getPortDiagnosticsSummary, getProperties, getProperty, getSampleSchedule, getSchedules, resetPortDiagnostics, setClock, setClock, setProperty, summaryEnabled |
| Methods inherited from interface org.mbari.siam.distributed.Device |
|---|
getChildren, getCommPortName, getFrameworkVersion, getId, getLocation, getMetadata, getName, getParent, getSamplingCount, getSamplingErrorCount, getSamplingRetryCount, getStatus, host, powerOff, powerOn, prepareToRun, resume, shutdown, suspend |
| Methods inherited from interface org.mbari.siam.distributed.DeviceServiceIF |
|---|
getName |
| Methods inherited from interface org.mbari.siam.core.ScheduleOwner |
|---|
addSchedule, getAllSchedules, getScheduleKey, removeAllSchedules, removeSchedule, resumeSchedule, sleepingUntil, suspendSchedule, syncSchedule |
| Field Detail |
|---|
protected static org.apache.log4j.Logger _log4j
public ElmoService.Attributes _attributes
public static final long serialVersionUID
protected int DFL_MAX_SAMPLE_BYTES
protected int DFL_CURRENT_LIMIT_MILLIAMPS
public static final java.lang.String OPEN_LOOP
public static final java.lang.String CLOSED_LOOP
public static final int DEFAULT_COUNTS_PER_REVOLUTION
protected ElmoImpl _elmo
protected static int DEFAULT_PRECISION
protected static int MIN_PRECISION
protected static int MAX_PRECISION
protected int _precision
protected java.text.DecimalFormat df
| Constructor Detail |
|---|
public ElmoService()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
protected ScheduleSpecifier createDefaultSampleSchedule()
throws ScheduleParseException
createDefaultSampleSchedule in class PolledInstrumentServiceScheduleParseExceptionprotected int initMaxSampleBytes()
initMaxSampleBytes in class BaseInstrumentServiceprotected byte[] initPromptString()
initPromptString in class BaseInstrumentServiceprotected byte[] initSampleTerminator()
initSampleTerminator in class BaseInstrumentServiceprotected int initCurrentLimit()
initCurrentLimit in class BaseInstrumentServiceprotected PowerPolicy initInstrumentPowerPolicy()
initInstrumentPowerPolicy in class BaseInstrumentServiceprotected PowerPolicy initCommunicationPowerPolicy()
initCommunicationPowerPolicy in class BaseInstrumentServiceprotected int initInstrumentStartDelay()
initInstrumentStartDelay in class BaseInstrumentService
public SerialPortParameters getSerialPortParameters()
throws gnu.io.UnsupportedCommOperationException
getSerialPortParameters in class DeviceServicegnu.io.UnsupportedCommOperationExceptionpublic int test()
test in interface Device
protected void initializeInstrument()
throws InitializeException,
java.lang.Exception
initializeInstrument in class BaseInstrumentServiceInitializeException
java.lang.Exception
protected void requestSample()
throws TimeoutException,
java.lang.Exception
requestSample in class PolledInstrumentServiceTimeoutException
java.lang.Exception
protected java.lang.String shutdownInstrument()
throws java.lang.Exception
shutdownInstrument in class BaseInstrumentServicejava.lang.Exceptionprotected byte[] getInstrumentStateMetadata()
getInstrumentStateMetadata in class BaseInstrumentService
public void dataCallback(DevicePacket sensorData,
PacketParser.Field[] fields)
dataCallback in interface InstrumentDataListenersensorData - - SensorDataPacket that instrument loggedfields - - Result of passing sensorData to PacketParser.parseFields()
if registered DeviceService is an instanceof BaseInstrumentService. Else null.public void serviceRegisteredCallback(RegistryEntry entry)
serviceRegisteredCallback in interface InstrumentDataListener
public void validateSpeed(int counts)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void initializeController()
throws TimeoutException,
java.io.IOException,
java.lang.Exception
initializeController in interface ElmoIFTimeoutException
java.io.IOException
java.lang.Exception
public void initializeController(int serialMode,
int countsPerRevolution,
double gearRatio,
int mode,
int acceleration,
int deceleration,
int stopDeceleration)
throws TimeoutException,
java.io.IOException,
java.lang.Exception
initializeController in interface ElmoIFTimeoutException
java.io.IOException
java.lang.Exception
public int rpm2counts(double rpm)
throws java.lang.Exception
rpm2counts in interface ElmoIFjava.lang.Exception
public double counts2rpm(int counts)
throws java.lang.Exception
counts2rpm in interface ElmoIFjava.lang.Exception
public int orpm2counts(double rpm)
throws java.lang.Exception
orpm2counts in interface ElmoIFjava.lang.Exception
public double counts2orpm(int counts)
throws java.lang.Exception
counts2orpm in interface ElmoIFjava.lang.Exception
public void setSerialMode(int mode)
throws java.lang.IllegalArgumentException
ElmoIF
setSerialMode in interface ElmoIFjava.lang.IllegalArgumentException
public void setCountsPerRevolution(int value)
throws java.lang.IllegalArgumentException
ElmoIF
setCountsPerRevolution in interface ElmoIFjava.lang.IllegalArgumentExceptionpublic int getCountsPerRevolution()
ElmoIF
getCountsPerRevolution in interface ElmoIF
public void setEnable(boolean value,
long timeoutMsec)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
setEnable in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void setGearRatio(double value)
throws java.lang.IllegalArgumentException
setGearRatio in interface ElmoIFjava.lang.IllegalArgumentExceptionpublic double getGearRatio()
getGearRatio in interface ElmoIF
public void setPositionCounter(long positionCounts)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
setPositionCounter in interface ElmoIFpositionCounts - new value of position counter (counts)
fulfills ElmoIF interface
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public long getPositionCounter()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.Exception
getPositionCounter in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception
public int getJoggingVelocity()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
getJoggingVelocity in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public int getEncoderVelocity()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
getEncoderVelocity in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public int getEncoderVelocity(int nSamples)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
getEncoderVelocity in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public boolean isEnabled()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
isEnabled in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public int getStatusRegister()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
getStatusRegister in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public int getFaultRegister()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
getFaultRegister in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public long getPositionError()
throws TimeoutException,
java.io.IOException,
java.lang.Exception
getPositionError in interface ElmoIFTimeoutException
java.io.IOException
java.lang.Exception
public void setJoggingVelocity(int counts)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
setJoggingVelocity in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void setPTPSpeed(int counts)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
setPTPSpeed in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public java.lang.String showConfiguration()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
showConfiguration in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public java.lang.String readRegister(java.lang.String register)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
readRegister in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void beginMotion()
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
beginMotion in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void jog(int counts)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
jog in interface ElmoIFTimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void ptpRelative(long distanceCounts,
boolean wait)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
ptpRelative in interface ElmoIFdistanceCounts - distance to move (counts)
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
public void ptpAbsolute(long position,
boolean wait)
throws TimeoutException,
java.io.IOException,
java.lang.NullPointerException,
java.lang.IllegalArgumentException,
java.lang.Exception
ptpAbsolute in interface ElmoIFposition - to move to (counts)
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exceptionpublic void delay(long delayMsec)
delay in interface ElmoIFdelayMsec - delay duration in milliseconds
protected int readSample(byte[] sample)
throws TimeoutException,
java.io.IOException,
java.lang.Exception
readSample in class BaseInstrumentServicesample - output buffer
TimeoutException
java.io.IOException
java.lang.Exception
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||