|
||||||||
| 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.motorControl.MotorControl
public class MotorControl
MotorControl implements a PID loop for the FOCE thruster motors, using a set of AllMotion EZServo EZSV23 Motor Servo Boards, with communication via an RS-485 serial port.
| Field Summary | |
|---|---|
protected Velocity |
_adcpVelocity
|
protected byte[] |
_commBuf
|
protected boolean |
_debug
|
protected int[] |
_errors
|
protected PrintfFormat |
_format
|
protected int[] |
_good
|
protected Velocity |
_instantaneousVelocity
|
protected int[] |
_lastPosition
|
protected int[] |
_lastVelocityCmd
|
protected static org.apache.log4j.Logger |
_log4j
Log4j logger |
protected byte[] |
_nullBytes
|
protected byte[] |
_sampleTerm
|
protected boolean[] |
_stalled
|
protected int[] |
_totErrors
|
protected Velocity |
_waterVelocity
|
protected Velocity |
_waterVelocityAccum
|
protected int |
_waterVelocitySamples
|
protected static java.lang.String |
CANCEL_CMD
|
protected static int |
ERR_CLEAR
|
protected static java.lang.String |
EXEC_INIT_CMD
|
protected static java.lang.String |
FIRMWARE_CMD
|
protected static java.lang.String |
GET_POSITION_CMD
|
protected static java.lang.String |
INIT_STRING
|
protected static int |
MAX_MOTOR_RPM
|
protected static int |
MAX_SERVOS
|
protected static java.lang.String |
NEG_DIRECTION_CMD
|
protected static java.lang.String |
POS_DIRECTION_CMD
|
protected static java.lang.String |
RESET_CMD
|
protected static java.lang.String |
STATUS_CMD
|
protected static java.lang.String |
VELOCITY_CMD
|
| 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 | |
|---|---|
MotorControl()
|
|
| Method Summary | |
|---|---|
protected void |
clearErrors()
|
protected ScheduleSpecifier |
createDefaultSampleSchedule()
Return specifier for default sampling schedule. |
void |
dataCallback(DevicePacket sensorData,
PacketParser.Field[] fields)
dataCallback from the ADV device |
protected int |
findResponse(int nbytes)
Look for "/0" in _commBuf. |
protected byte[] |
getInstrumentStateMetadata()
Return metadata. |
protected int |
getMotorPosition(int servo)
Get Motor position for one servo |
SerialPortParameters |
getSerialPortParameters()
Return parameters to use on serial port. |
protected PowerPolicy |
initCommunicationPowerPolicy()
Return initial value of communication power policy. |
protected int |
initCurrentLimit()
Specify current limit. |
protected void |
initializeInstrument()
Initialize the servos |
protected PowerPolicy |
initInstrumentPowerPolicy()
Return initial value of instrument power policy. |
protected int |
initInstrumentStartDelay()
Specify device startup delay (millisec) |
protected int |
initMaxSampleBytes()
Specify maximum bytes in raw sample. |
protected byte[] |
initPromptString()
Specify prompt string. |
protected byte[] |
initSampleTerminator()
Specify sample terminator. |
protected void |
pidLoop()
Run once through PID loop |
protected void |
printBuffer(byte[] buf,
int nbytes)
|
protected int |
readSample(byte[] sample)
Run the loop, log the results |
protected void |
requestSample()
Request a data sample |
void |
serviceRegisteredCallback(RegistryEntry entry)
Callback for InstrumentDataListener interface, called when the ADV service is registered with the InstrumentRegistry |
void |
setClock()
No internal clock. |
protected void |
setMotorDirection(int servo,
boolean dir)
Set Motor direction for one servo |
protected void |
setMotorVelocity(int servo,
int velocity)
Set motor velocity for one servo |
protected void |
setVelocity(Velocity velocity,
PacketParser.Field[] fields)
|
java.lang.String |
shutdownInstrument()
Perform any instrument-specific shutdown actions and optionally return a human-readable message (e.g. |
protected int |
status(int servo)
Get motor status |
int |
test()
Self-test not implemented. |
protected int |
transact(int servo,
java.lang.String cmd,
boolean logIt)
Perform one I/O transaction to a servo. |
protected boolean |
transactAll(java.lang.String cmd)
Send a command to all servos |
| 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, 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
protected static final int MAX_SERVOS
protected static final int MAX_MOTOR_RPM
protected static final java.lang.String INIT_STRING
protected static final java.lang.String EXEC_INIT_CMD
protected static final java.lang.String RESET_CMD
protected static final java.lang.String CANCEL_CMD
protected static final java.lang.String STATUS_CMD
protected static final java.lang.String VELOCITY_CMD
protected static final java.lang.String GET_POSITION_CMD
protected static final java.lang.String POS_DIRECTION_CMD
protected static final java.lang.String NEG_DIRECTION_CMD
protected static final java.lang.String FIRMWARE_CMD
protected static final int ERR_CLEAR
protected int[] _lastVelocityCmd
protected int[] _lastPosition
protected int[] _errors
protected int[] _totErrors
protected int[] _good
protected boolean[] _stalled
protected Velocity _instantaneousVelocity
protected Velocity _waterVelocity
protected Velocity _waterVelocityAccum
protected Velocity _adcpVelocity
protected int _waterVelocitySamples
protected PrintfFormat _format
protected byte[] _nullBytes
protected boolean _debug
protected byte[] _sampleTerm
protected byte[] _commBuf
| Constructor Detail |
|---|
public MotorControl()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
protected int initInstrumentStartDelay()
initInstrumentStartDelay in class BaseInstrumentServiceprotected byte[] initPromptString()
initPromptString in class BaseInstrumentServiceprotected byte[] initSampleTerminator()
initSampleTerminator in class BaseInstrumentServiceprotected int initMaxSampleBytes()
initMaxSampleBytes in class BaseInstrumentServiceprotected int initCurrentLimit()
initCurrentLimit in class BaseInstrumentServiceprotected PowerPolicy initInstrumentPowerPolicy()
initInstrumentPowerPolicy in class BaseInstrumentServiceprotected PowerPolicy initCommunicationPowerPolicy()
initCommunicationPowerPolicy in class BaseInstrumentService
protected void requestSample()
throws java.lang.Exception
requestSample in class PolledInstrumentServicejava.lang.Exception
protected void initializeInstrument()
throws InitializeException,
java.lang.Exception
initializeInstrument in class BaseInstrumentServiceInitializeException
java.lang.Exceptionpublic void serviceRegisteredCallback(RegistryEntry entry)
serviceRegisteredCallback in interface InstrumentDataListener
protected void setVelocity(Velocity velocity,
PacketParser.Field[] fields)
throws NoDataException
NoDataException
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.protected int findResponse(int nbytes)
protected int transact(int servo,
java.lang.String cmd,
boolean logIt)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentExceptionprotected boolean transactAll(java.lang.String cmd)
protected int status(int servo)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
protected void setMotorDirection(int servo,
boolean dir)
throws java.io.IOException,
java.lang.IllegalArgumentException
servo - - servo number (1-4)dir - - direction, true for positive direction
java.io.IOException
java.lang.IllegalArgumentException
protected void setMotorVelocity(int servo,
int velocity)
throws java.io.IOException,
java.lang.IllegalArgumentException
java.io.IOException
java.lang.IllegalArgumentException
protected int getMotorPosition(int servo)
throws java.io.IOException,
java.lang.IllegalArgumentException,
java.lang.NumberFormatException
servo - - servo number (1-4)
java.io.IOException
java.lang.IllegalArgumentException
java.lang.NumberFormatExceptionprotected void pidLoop()
protected int readSample(byte[] sample)
readSample in class BaseInstrumentServicesample - output bufferprotected void clearErrors()
protected byte[] getInstrumentStateMetadata()
getInstrumentStateMetadata in class BaseInstrumentServicepublic java.lang.String shutdownInstrument()
BaseInstrumentService
shutdownInstrument in class BaseInstrumentService
protected void printBuffer(byte[] buf,
int nbytes)
public void setClock()
throws NotSupportedException
setClock in interface InstrumentsetClock in class BaseInstrumentServiceNotSupportedExceptionpublic int test()
test in interface Device
protected ScheduleSpecifier createDefaultSampleSchedule()
throws ScheduleParseException
createDefaultSampleSchedule in class PolledInstrumentServiceScheduleParseException
public SerialPortParameters getSerialPortParameters()
throws gnu.io.UnsupportedCommOperationException
getSerialPortParameters in class DeviceServicegnu.io.UnsupportedCommOperationException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||