org.mbari.siam.foce.devices.elmo.base
Class ElmoImpl

java.lang.Object
  extended by org.mbari.siam.foce.devices.elmo.base.ElmoImpl
All Implemented Interfaces:
java.rmi.Remote, ElmoIF, ElmoLouverIF, ElmoThrusterIF
Direct Known Subclasses:
ElmoLocal

public class ElmoImpl
extends java.lang.Object
implements ElmoIF, ElmoLouverIF, ElmoThrusterIF


Field Summary
protected  int _countsPerRevolution
          Motor counts per motor revolution (before gear rection)
protected  Elmo _elmo
          Elmo implementation (ElmoSolo, etc.; Elmo is abstract)
protected  double _gearRatio
          default gear reduction ratio
protected static org.apache.log4j.Logger _log4j
          Log4j logger
protected  int _maxMotorCounts
           
protected  int _minMotorCounts
           
protected  gnu.io.SerialPort _motorSerialPort
          forward controller serial port
protected  long _tsElapsedMS
           
protected  long _tsStartTimeMS
           
protected  int _tsState
           
protected  long _tsTriggerCount
           
protected  boolean _turnSensorEnabled
           
protected  boolean _turnSensorReset
           
static boolean ABOVE
          constant indicates next highest (logical) hall sensor boundary
static boolean BELOW
          constant indicates next lowest (logical) hall sensor boundary
static double DOUBLE_LIMIT_ZERO
           
static int HALL_ACTIVE_MASK
          mask for bits indicating digitial input logical pin state
static int HALL_DISTANCE_COUNTS
          Distance (in motor counts) between louver feedback hall sensors
static int HALL_PINSTATE_MASK
          mask for bits indicating digital input physical pin state
static int HALL_PINSTATE_START_BIT
          first bit of pin state in digital input port (used for bit shifting)
static int INT_LIMIT_ZERO
           
static long LONG_LIMIT_ZERO
           
static long LOUVER_COUNTS_LIMIT_MAX
           
static long LOUVER_COUNTS_LIMIT_MIN
           
static double LOUVER_DEGREES_LIMIT_MAX
           
static double LOUVER_DEGREES_LIMIT_MIN
           
static int LOUVER_HALL_LIMIT_MAX
           
static int LOUVER_HALL_LIMIT_MIN
           
static double LOUVER_PERCENT_LIMIT_MAX
           
static double LOUVER_PERCENT_LIMIT_MIN
           
static int MAX_DIGITAL_INPUT_BIT
           
static long serialVersionUID
          serial version, for Serializable interface
static int TS_DISABLED
           
static int TS_ERROR
           
static int TS_PENDING
           
static int TS_READ_ERROR
           
static int TS_RESET
           
static int TS_TIMEOUT
           
static int TS_TRIGGERED
           
static int TS_UNKNOWN
           
 
Constructor Summary
ElmoImpl()
          No-arg Constructor
ElmoImpl(Elmo elmo)
          Constructor
 
Method Summary
 boolean armTurnsSensorTrigger()
           
 void beginMotion()
          Start motion according to currently set parameters.
 long center(int speedCounts)
          Find the center of the current Hall effect feedback position.
 gnu.io.SerialPort configurePort(java.lang.String serialPortName)
          Configure the serial ports used to communicate with the motor controllers.
 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)
 double countsPerUnitTravel()
          Get number of motor counts per unit of travel (varies with lead screw gear ratio, counts per revolution and displacement revolution per units)
 double degrees2percent(double degreesValue)
          Convert louver position value (engineering units) to percent value This routine does not validate, so may return values that are not physically valid for invalid input
 void delay(long delayMsec)
          delay for specified number of milliseconds
 boolean disarmTurnsSensorTrigger()
          Disarm the turn sensor homing function
 long findBoundary(boolean positive, int speedCounts)
          Find and stop at the nearest Hall sensor feedback transition location.
 int getCountsPerRevolution()
          Get commutation counts per motor revolution.
 int getDIHall_Bit(int bit)
           
 long getDisplacementCounts(double louverPositionDegrees)
          compute displacement (motor counts) for given louver position (degrees).
 double getDisplacementRPU()
           
 int getEncoderVelocity()
          Get motor velocity (in counts/sec, from motor feedback sensors, i.e., before gear train) The encoder velocity is very noisy and typically reads 0 at very low speeds (<15 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.
 int getHomingSpeedCounts()
           
 boolean getInvertHallPosition()
          If invertHallPosition is true, the order of the feedback readings is reversed, ranging from 15-0 instead of 0-15.
 int getJoggingVelocity()
          get motor jogging (commanded) velocity in counts/sec.
 long getLouverCountsMax()
           
 long getLouverCountsMin()
           
 double getLouverDegreesMax()
           
 double getLouverDegreesMin()
           
 int getLouverHallMax()
           
 int getLouverHallMin()
           
 int getLouverHallPhyMax()
           
 int getLouverHallPhyMin()
           
 double getLouverLinkageLength()
           
 double getLouverPercentMax()
           
 double getLouverPercentMin()
           
 double getLouverPositionDegrees()
          Get louver position (in engineering units) This derives from the kinematic position equations for the louvers (an offset crank-slider mechanism).
 double getLouverPositionDegrees(long positionCounts)
           
 double getLouverPositionPercent()
          Get louver position (as a percent of full travel)
 double getLouverPositionPercent(long positionCounts)
          Get louver position (as a percent of full travel)
 java.lang.String getLouverSampleMessage()
          return a (terse) message indicating the state of several motor registers
 java.lang.String getLouverStatusMessage()
          return a message indicating the state of several motor registers
 double getMaxDisplacementTravel()
           
 int getMaxMotorCounts()
           
 double getMinDisplacementTravel()
           
 int getMinMotorCounts()
           
 double getModelMaxDisplacement()
           
 long getMotionDistanceOffsetMsec()
           
 double getMotionDistanceScale()
           
 long getMotionTimeoutOffsetMsec()
           
 double getMotionTimeoutScale()
           
 Elmo getMotor()
          get (Elmo) motor controller
 int getMotorAcceleration()
           
 int getMotorDeceleration()
           
 int getMotorStopDeceleration()
           
 long getPositionCounter()
          Get motor position counter for position modes fulfills ElmoIF interface
 long getPositionError()
          Get difference (counts) between commanded and actual position if available
 double getSliderLinkageLength()
           
 double getSliderOffset()
           
 double getSliderPivotOffset()
           
 int getStatusRegister()
          Get motor status code.
 java.lang.String getThrusterSampleMessage()
          return thruster sample string
 long getTSElapsedMsec()
          Return the elapsed time since last turns sensor trigger (msec)
 int getTSState()
          Return the turns sensor state
static java.lang.String getTSStateMnemonic(int stateValue)
           
 java.lang.String getTSStateName()
          return a mnemonic for turns sensor state
 long getTSTriggerCount()
          Return number of times the turns sensor has been triggered since the last reset
 int getTurnSensorInputBit()
           
 int getTurnSensorOutputBit()
           
 long getTurnSensorTimeoutMillis(double velocityRPM, double gearRatio)
          Compute the time for one rotation at the current speed
 long getTurnSensorTimeoutMSec()
           
 void home(int position)
          Home to one of the louver's 16 Hall effect position feedback switches.
 void home(int position, boolean setCounter, long counterValue, int vLo, int vHi)
          Home to one of the louver's 16 Hall effect position feedback switches.
 void home(int position, int velocityCounts)
          Home to one of the louver's 16 Hall effect position feedback switches.
 void initializeController()
          Initialize motor controller satisfies ElmoIF
 void initializeController(int serialMode, int countsPerRevolution, double gearRatio, int unitMode, int acceleration, int deceleration, int stopDeceleration)
           
 void initializeTurnSensor()
           
 boolean isEnabled()
          return motor enabled (MO) status.
 void jog(int counts)
          Command motor velocity (in counts/sec) fulfills ElmoIF interface
 int orpm2counts(double rpm)
          Convert output shaft speed (rpm) to (counts/sec) (at output after gear train) (using gear ratio and counts per revolution)
 double percent2degrees(double percentValue)
          Convert louver position value (percent) to (engineering) units value This routine does not validate, so may return values that are not physically valid for invalid input
 void ptpAbsolute(long position, boolean wait)
          Move motor to absolute position Motion may be subject to modulo position counting modes in effect.
 void ptpAbsolute(long position, int velocityCounts, boolean wait)
          Move motor to absolute position at specified velocity Motion may be subject to modulo position counting modes in effect.
 void ptpRelative(long distanceCounts, boolean wait)
          Move motor relative to current position
 void ptpRelative(long distanceCounts, int velocityCounts, boolean wait)
          Move motor relative to current position at specified velocity
protected  int readLogicalLouverPosition(boolean invertScale)
           
protected  int readPhysicalLouverPosition()
          read and return louver position, expressed as one of the Hall sensor feedback values
 java.lang.String readRegister(java.lang.String register)
          read an Elmo register value
 int readTurnSensor()
          return DISABLED, TRIGGERED, PENDING, READ_ERROR, RESET
 int rpm2counts(double rpm)
          Convert motor speed (rpm) to (counts/sec) (before gear train) (using countsPerRevolution)
 void setCountsPerRevolution(int value)
          Set commutation counts per motor revolution.
 void setDigitalInputFunction(int pin, int function)
           
 void setDIHallBit(int bit, int value)
           
 void setDisplacementRPU(double value)
           
 void setEnable(boolean value, long timeoutMsec)
          Enable or disable the motor fulfills ElmoIF interface
 void setGearRatio(double value)
          Set the gear ratio between the motor and the output shaft.
 void setHomingSpeedCounts(int value)
           
 void setInvertHallPosition(boolean value)
          If invertHallPosition is true, the order of the feedback readings is reversed, ranging from 15-0 instead of 0-15.
 void setJoggingVelocity(int counts)
          Set motor velocity (in counts) Do not initiate motion fulfills ElmoIF interface
 void setJoggingVelocityRPM(double rpm)
          Set motor velocity (in rpm) Do not initiate motion fulfills ElmoIF interface
 void setLouverCountsMax(long value)
           
 void setLouverCountsMin(long value)
           
 void setLouverDegrees(double positionDegrees)
          Set an interpolated louver position between _louverDegreesMin and _louverDegreesMax.
 void setLouverDegreesMax(double value)
           
 void setLouverDegreesMin(double value)
           
 void setLouverHallMax(int value)
           
 void setLouverHallMin(int value)
           
 void setLouverHallPhyMax(int value)
           
 void setLouverHallPhyMin(int value)
           
 void setLouverLinkageLength(double value)
           
 void setLouverPercent(double positionPercent)
          Set an interpolated louver position between _louverDegreesMin and _louverDegreesMax.
 void setLouverPercentMax(double value)
           
 void setLouverPercentMin(double value)
           
 void setMaxDisplacementTravel(double value)
           
 void setMaxMotorCounts(int value)
           
 void setMinDisplacementTravel(double value)
           
 void setMinMotorCounts(int value)
           
 void setModelMaxDisplacement(double value)
           
 void setMotionDistanceOffsetMsec(long value)
           
 void setMotionDistanceScale(double value)
           
 void setMotionTimeoutOffsetMsec(long value)
           
 void setMotionTimeoutScale(double value)
           
 void setMotor(Elmo elmo)
          get (Elmo) motor controller
 void setMotorAcceleration(int value)
           
 void setMotorDeceleration(int value)
           
 void setMotorStopDeceleration(int value)
           
 void setPositionCounter(long positionCounts)
          Set motor position counter for position modes
 void setPTPSpeed(int counts)
          Set motor velocity (in counts) Do not initiate motion fulfills ElmoIF interface
 void setPTPSpeedRPM(double rpm)
          Set motor velocity (in rpm) Do not initiate motion fulfills ElmoIF interface
 void setReferenceLimit(int ll, int hl)
           
 void setReferenceSpeed(int vl, int vh)
           
 void setSerialMode(int mode)
          Set serial port mode (MODE_SERIAL_LOCAL, MODE_SERIAL_RFC2217)
 void setSliderLinkageLength(double value)
           
 void setSliderOffset(double value)
           
 void setSliderPivotOffset(double value)
           
 void setTurnSensorInputBit(int value)
           
 void setTurnSensorOutputBit(int value)
           
protected  void setTurnSensorState(int state, long triggerCount, long elapsedTime)
           
 void setTurnSensorTimeoutMSec(long value)
           
 void setTurnsSensorEnable(boolean value)
          Enable or disable the turns sensor
 java.lang.String showConfiguration()
          show current configuration information [ a configuration class may be worth doing at some point - klh]
protected  int updateTurnSensorState()
          Read turn sensor and update sensor state.
 void validateAbsolute(long position)
           
 boolean validateCounts(long value)
          validate a louver position expressed in motor counts
 boolean validateDegrees(double value)
          Validate an louver position value expressed in engineering units
 boolean validatePercent(double value)
          Validate an louver position value expressed as a percentage of fully open
 boolean validatePosition(int value)
          validate a louver position expressed as one of the Hall sensor feedback values
 void validateRelative(long distanceCounts)
           
 void validateSpeed(double rpm)
          Validates specified speed against configured limits
 void validateSpeed(int counts)
          Validates specified speed against configured limits
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log4j

protected static org.apache.log4j.Logger _log4j
Log4j logger


serialVersionUID

public static final long serialVersionUID
serial version, for Serializable interface

See Also:
Constant Field Values

_elmo

protected Elmo _elmo
Elmo implementation (ElmoSolo, etc.; Elmo is abstract)


_motorSerialPort

protected gnu.io.SerialPort _motorSerialPort
forward controller serial port


_countsPerRevolution

protected int _countsPerRevolution
Motor counts per motor revolution (before gear rection)


_gearRatio

protected double _gearRatio
default gear reduction ratio


_maxMotorCounts

protected int _maxMotorCounts

_minMotorCounts

protected int _minMotorCounts

HALL_DISTANCE_COUNTS

public static final int HALL_DISTANCE_COUNTS
Distance (in motor counts) between louver feedback hall sensors

See Also:
Constant Field Values

HALL_ACTIVE_MASK

public static final int HALL_ACTIVE_MASK
mask for bits indicating digitial input logical pin state

See Also:
Constant Field Values

HALL_PINSTATE_MASK

public static final int HALL_PINSTATE_MASK
mask for bits indicating digital input physical pin state

See Also:
Constant Field Values

HALL_PINSTATE_START_BIT

public static final int HALL_PINSTATE_START_BIT
first bit of pin state in digital input port (used for bit shifting)

See Also:
Constant Field Values

LOUVER_DEGREES_LIMIT_MIN

public static final double LOUVER_DEGREES_LIMIT_MIN
See Also:
Constant Field Values

LOUVER_DEGREES_LIMIT_MAX

public static final double LOUVER_DEGREES_LIMIT_MAX
See Also:
Constant Field Values

LOUVER_PERCENT_LIMIT_MIN

public static final double LOUVER_PERCENT_LIMIT_MIN
See Also:
Constant Field Values

LOUVER_PERCENT_LIMIT_MAX

public static final double LOUVER_PERCENT_LIMIT_MAX
See Also:
Constant Field Values

LOUVER_COUNTS_LIMIT_MIN

public static final long LOUVER_COUNTS_LIMIT_MIN
See Also:
Constant Field Values

LOUVER_COUNTS_LIMIT_MAX

public static final long LOUVER_COUNTS_LIMIT_MAX
See Also:
Constant Field Values

LOUVER_HALL_LIMIT_MIN

public static final int LOUVER_HALL_LIMIT_MIN
See Also:
Constant Field Values

LOUVER_HALL_LIMIT_MAX

public static final int LOUVER_HALL_LIMIT_MAX
See Also:
Constant Field Values

DOUBLE_LIMIT_ZERO

public static final double DOUBLE_LIMIT_ZERO
See Also:
Constant Field Values

INT_LIMIT_ZERO

public static final int INT_LIMIT_ZERO
See Also:
Constant Field Values

LONG_LIMIT_ZERO

public static final long LONG_LIMIT_ZERO
See Also:
Constant Field Values

MAX_DIGITAL_INPUT_BIT

public static final int MAX_DIGITAL_INPUT_BIT
See Also:
Constant Field Values

ABOVE

public static final boolean ABOVE
constant indicates next highest (logical) hall sensor boundary

See Also:
Constant Field Values

BELOW

public static final boolean BELOW
constant indicates next lowest (logical) hall sensor boundary

See Also:
Constant Field Values

TS_UNKNOWN

public static final int TS_UNKNOWN
See Also:
Constant Field Values

TS_DISABLED

public static final int TS_DISABLED
See Also:
Constant Field Values

TS_PENDING

public static final int TS_PENDING
See Also:
Constant Field Values

TS_TRIGGERED

public static final int TS_TRIGGERED
See Also:
Constant Field Values

TS_ERROR

public static final int TS_ERROR
See Also:
Constant Field Values

TS_READ_ERROR

public static final int TS_READ_ERROR
See Also:
Constant Field Values

TS_TIMEOUT

public static final int TS_TIMEOUT
See Also:
Constant Field Values

TS_RESET

public static final int TS_RESET
See Also:
Constant Field Values

_tsStartTimeMS

protected long _tsStartTimeMS

_tsElapsedMS

protected long _tsElapsedMS

_tsTriggerCount

protected long _tsTriggerCount

_tsState

protected int _tsState

_turnSensorEnabled

protected boolean _turnSensorEnabled

_turnSensorReset

protected boolean _turnSensorReset
Constructor Detail

ElmoImpl

public ElmoImpl()
No-arg Constructor


ElmoImpl

public ElmoImpl(Elmo elmo)
Constructor

Method Detail

getMotor

public Elmo getMotor()
get (Elmo) motor controller


setMotor

public void setMotor(Elmo elmo)
get (Elmo) motor controller


configurePort

public gnu.io.SerialPort configurePort(java.lang.String serialPortName)
Configure the serial ports used to communicate with the motor controllers.


setMinMotorCounts

public void setMinMotorCounts(int value)
                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMinMotorCounts

public int getMinMotorCounts()

setMaxMotorCounts

public void setMaxMotorCounts(int value)
                       throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMaxMotorCounts

public int getMaxMotorCounts()

setMotorAcceleration

public void setMotorAcceleration(int value)
                          throws TimeoutException,
                                 java.io.IOException,
                                 java.lang.NullPointerException,
                                 java.lang.IllegalArgumentException,
                                 java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getMotorAcceleration

public int getMotorAcceleration()
                         throws TimeoutException,
                                java.io.IOException,
                                java.lang.NullPointerException,
                                java.lang.IllegalArgumentException,
                                java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setMotorDeceleration

public void setMotorDeceleration(int value)
                          throws TimeoutException,
                                 java.io.IOException,
                                 java.lang.NullPointerException,
                                 java.lang.IllegalArgumentException,
                                 java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getMotorDeceleration

public int getMotorDeceleration()
                         throws TimeoutException,
                                java.io.IOException,
                                java.lang.NullPointerException,
                                java.lang.IllegalArgumentException,
                                java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setMotorStopDeceleration

public void setMotorStopDeceleration(int value)
                              throws TimeoutException,
                                     java.io.IOException,
                                     java.lang.NullPointerException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getMotorStopDeceleration

public int getMotorStopDeceleration()
                             throws TimeoutException,
                                    java.io.IOException,
                                    java.lang.NullPointerException,
                                    java.lang.IllegalArgumentException,
                                    java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setDigitalInputFunction

public void setDigitalInputFunction(int pin,
                                    int function)
                             throws java.lang.IllegalArgumentException,
                                    TimeoutException,
                                    java.io.IOException
Throws:
java.lang.IllegalArgumentException
TimeoutException
java.io.IOException

setReferenceSpeed

public void setReferenceSpeed(int vl,
                              int vh)
                       throws TimeoutException,
                              java.io.IOException,
                              java.lang.NullPointerException,
                              java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

setReferenceLimit

public void setReferenceLimit(int ll,
                              int hl)
                       throws TimeoutException,
                              java.io.IOException,
                              java.lang.NullPointerException,
                              java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

validateSpeed

public void validateSpeed(int counts)
                   throws java.lang.IllegalArgumentException
Validates specified speed against configured limits

Parameters:
counts - - speed in counts
Throws:
java.lang.IllegalArgumentException

validateSpeed

public void validateSpeed(double rpm)
                   throws java.lang.IllegalArgumentException
Validates specified speed against configured limits

Parameters:
rpm - - speed in rpm
Throws:
java.lang.IllegalArgumentException

validateRelative

public void validateRelative(long distanceCounts)
                      throws java.lang.Exception
Throws:
java.lang.Exception

validateAbsolute

public void validateAbsolute(long position)
                      throws java.lang.Exception
Throws:
java.lang.Exception

initializeController

public void initializeController()
                          throws TimeoutException,
                                 java.io.IOException,
                                 java.lang.Exception
Initialize motor controller satisfies ElmoIF

Specified by:
initializeController in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

initializeController

public void initializeController(int serialMode,
                                 int countsPerRevolution,
                                 double gearRatio,
                                 int unitMode,
                                 int acceleration,
                                 int deceleration,
                                 int stopDeceleration)
                          throws TimeoutException,
                                 java.io.IOException,
                                 java.lang.Exception
Specified by:
initializeController in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

rpm2counts

public int rpm2counts(double rpm)
               throws java.lang.Exception
Convert motor speed (rpm) to (counts/sec) (before gear train) (using countsPerRevolution)

Specified by:
rpm2counts in interface ElmoIF
Throws:
java.lang.Exception

counts2rpm

public double counts2rpm(int counts)
                  throws java.lang.Exception
Convert motor speed (counts/sec) to (rpm) (before gear train) (using countsPerRevolution)

Specified by:
counts2rpm in interface ElmoIF
Throws:
java.lang.Exception

orpm2counts

public int orpm2counts(double rpm)
                throws java.lang.Exception
Convert output shaft speed (rpm) to (counts/sec) (at output after gear train) (using gear ratio and counts per revolution)

Specified by:
orpm2counts in interface ElmoIF
Throws:
java.lang.Exception

counts2orpm

public double counts2orpm(int counts)
                   throws java.lang.Exception
Convert output shaft speed (counts/sec) to (rpm) (at output after gear train) (using gear ratio and counts per revolution)

Specified by:
counts2orpm in interface ElmoIF
Throws:
java.lang.Exception

readRegister

public java.lang.String readRegister(java.lang.String register)
                              throws TimeoutException,
                                     java.io.IOException,
                                     java.lang.NullPointerException,
                                     java.lang.IllegalArgumentException,
                                     java.lang.Exception
read an Elmo register value

Specified by:
readRegister in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setSerialMode

public void setSerialMode(int mode)
                   throws java.lang.IllegalArgumentException
Description copied from interface: ElmoIF
Set serial port mode (MODE_SERIAL_LOCAL, MODE_SERIAL_RFC2217)

Specified by:
setSerialMode in interface ElmoIF
Throws:
java.lang.IllegalArgumentException

setCountsPerRevolution

public void setCountsPerRevolution(int value)
                            throws java.lang.IllegalArgumentException
Description copied from interface: ElmoIF
Set commutation counts per motor revolution. Depends on motor type (number of poles, etc.)

Specified by:
setCountsPerRevolution in interface ElmoIF
Throws:
java.lang.IllegalArgumentException

getCountsPerRevolution

public int getCountsPerRevolution()
Description copied from interface: ElmoIF
Get commutation counts per motor revolution. Depends on motor type (number of poles, etc.)

Specified by:
getCountsPerRevolution in interface ElmoIF

setEnable

public void setEnable(boolean value,
                      long timeoutMsec)
               throws TimeoutException
Enable or disable the motor fulfills ElmoIF interface

Specified by:
setEnable in interface ElmoIF
Throws:
TimeoutException

setGearRatio

public void setGearRatio(double value)
                  throws java.lang.IllegalArgumentException
Set the gear ratio between the motor and the output shaft. For example, if the output shaft turns 67.5 times slower than the motor, the gear ratio should be set to 67.5.

Specified by:
setGearRatio in interface ElmoIF
Throws:
java.lang.IllegalArgumentException

getGearRatio

public double getGearRatio()
Get the gear ratio between the motor and the output shaft. For example, if the output shaft turns 67.5 times slower than the motor, the gear ratio should be set to 67.5.

Specified by:
getGearRatio in interface ElmoIF

setPositionCounter

public void setPositionCounter(long positionCounts)
                        throws TimeoutException,
                               java.io.IOException,
                               java.lang.NullPointerException,
                               java.lang.IllegalArgumentException,
                               java.lang.Exception
Set motor position counter for position modes

Specified by:
setPositionCounter in interface ElmoIF
Parameters:
positionCounts - new value of position counter (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getPositionCounter

public long getPositionCounter()
                        throws TimeoutException,
                               java.io.IOException,
                               java.lang.NullPointerException,
                               java.lang.Exception
Get motor position counter for position modes fulfills ElmoIF interface

Specified by:
getPositionCounter in interface ElmoIF
Returns:
position counter (counts)
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getJoggingVelocity

public int getJoggingVelocity()
                       throws TimeoutException,
                              java.io.IOException,
                              java.lang.NullPointerException,
                              java.lang.IllegalArgumentException,
                              java.lang.Exception,
                              java.rmi.RemoteException
get motor jogging (commanded) velocity in counts/sec.

Specified by:
getJoggingVelocity in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
java.rmi.RemoteException

getEncoderVelocity

public int getEncoderVelocity()
                       throws TimeoutException,
                              java.io.IOException,
                              java.lang.NullPointerException,
                              java.lang.IllegalArgumentException,
                              java.lang.Exception
Get motor velocity (in counts/sec, from motor feedback sensors, i.e., before gear train) The encoder velocity is very noisy and typically reads 0 at very low speeds (<15 counts/sec). Averages samples readings of the encoder velocity. Takes only one sample if samples<=0. fulfills ElmoIF interface

Specified by:
getEncoderVelocity in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getEncoderVelocity

public int getEncoderVelocity(int nSamples)
                       throws TimeoutException,
                              java.io.IOException,
                              java.lang.NullPointerException,
                              java.lang.IllegalArgumentException,
                              java.lang.Exception
Description copied from interface: ElmoIF
get (average of nSamples) motor feedback velocity in counts/sec.

Specified by:
getEncoderVelocity in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

isEnabled

public boolean isEnabled()
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.NullPointerException,
                         java.lang.IllegalArgumentException,
                         java.lang.Exception
return motor enabled (MO) status.

Specified by:
isEnabled in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getStatusRegister

public int getStatusRegister()
                      throws TimeoutException,
                             java.io.IOException,
                             java.lang.NullPointerException,
                             java.lang.IllegalArgumentException,
                             java.lang.Exception
Get motor status code. fulfills ElmoIF interface

Specified by:
getStatusRegister in interface ElmoIF
Returns:
status
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
See Also:
Elmo.getStatusRegister()

getFaultRegister

public int getFaultRegister()
                     throws TimeoutException,
                            java.io.IOException,
                            java.lang.NullPointerException,
                            java.lang.IllegalArgumentException,
                            java.lang.Exception
return detailed motor fault information.. fulfills ElmoIF interface

Specified by:
getFaultRegister in interface ElmoIF
Returns:
fault
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception
See Also:
Elmo.getMotorFault()

getPositionError

public long getPositionError()
                      throws TimeoutException,
                             java.io.IOException,
                             java.lang.NullPointerException,
                             java.lang.Exception
Get difference (counts) between commanded and actual position if available

Specified by:
getPositionError in interface ElmoIF
Returns:
position error (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

setJoggingVelocityRPM

public void setJoggingVelocityRPM(double rpm)
                           throws TimeoutException,
                                  java.io.IOException,
                                  java.lang.NullPointerException,
                                  java.lang.IllegalArgumentException,
                                  java.lang.Exception
Set motor velocity (in rpm) Do not initiate motion fulfills ElmoIF interface

Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setJoggingVelocity

public void setJoggingVelocity(int counts)
                        throws TimeoutException,
                               java.io.IOException,
                               java.lang.NullPointerException,
                               java.lang.IllegalArgumentException,
                               java.lang.Exception
Set motor velocity (in counts) Do not initiate motion fulfills ElmoIF interface

Specified by:
setJoggingVelocity in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setPTPSpeed

public void setPTPSpeed(int counts)
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Set motor velocity (in counts) Do not initiate motion fulfills ElmoIF interface

Specified by:
setPTPSpeed in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setPTPSpeedRPM

public void setPTPSpeedRPM(double rpm)
                    throws TimeoutException,
                           java.io.IOException,
                           java.lang.NullPointerException,
                           java.lang.IllegalArgumentException,
                           java.lang.Exception
Set motor velocity (in rpm) Do not initiate motion fulfills ElmoIF interface

Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

showConfiguration

public java.lang.String showConfiguration()
                                   throws TimeoutException,
                                          java.io.IOException,
                                          java.lang.NullPointerException,
                                          java.lang.IllegalArgumentException,
                                          java.lang.Exception
show current configuration information [ a configuration class may be worth doing at some point - klh]

Specified by:
showConfiguration in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

beginMotion

public void beginMotion()
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Start motion according to currently set parameters. fulfills ElmoIF interface

Specified by:
beginMotion in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

jog

public void jog(int counts)
         throws TimeoutException,
                java.io.IOException,
                java.lang.NullPointerException,
                java.lang.IllegalArgumentException,
                java.lang.Exception
Command motor velocity (in counts/sec) fulfills ElmoIF interface

Specified by:
jog in interface ElmoIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

ptpRelative

public void ptpRelative(long distanceCounts,
                        int velocityCounts,
                        boolean wait)
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Move motor relative to current position at specified velocity

Parameters:
distanceCounts - distance to move (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

ptpRelative

public void ptpRelative(long distanceCounts,
                        boolean wait)
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Move motor relative to current position

Specified by:
ptpRelative in interface ElmoIF
Parameters:
distanceCounts - distance to move (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

ptpAbsolute

public void ptpAbsolute(long position,
                        int velocityCounts,
                        boolean wait)
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Move motor to absolute position at specified velocity Motion may be subject to modulo position counting modes in effect.

Parameters:
position - to move to (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

ptpAbsolute

public void ptpAbsolute(long position,
                        boolean wait)
                 throws TimeoutException,
                        java.io.IOException,
                        java.lang.NullPointerException,
                        java.lang.IllegalArgumentException,
                        java.lang.Exception
Move motor to absolute position Motion may be subject to modulo position counting modes in effect.

Specified by:
ptpAbsolute in interface ElmoIF
Parameters:
position - to move to (counts) fulfills ElmoIF interface
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

delay

public void delay(long delayMsec)
delay for specified number of milliseconds

Specified by:
delay in interface ElmoIF
Parameters:
delayMsec - delay duration in milliseconds

getLouverDegreesMax

public double getLouverDegreesMax()

setLouverDegreesMax

public void setLouverDegreesMax(double value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverDegreesMin

public double getLouverDegreesMin()

setLouverDegreesMin

public void setLouverDegreesMin(double value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverCountsMax

public long getLouverCountsMax()

setLouverCountsMax

public void setLouverCountsMax(long value)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverCountsMin

public long getLouverCountsMin()

setLouverCountsMin

public void setLouverCountsMin(long value)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverPercentMax

public double getLouverPercentMax()

setLouverPercentMax

public void setLouverPercentMax(double value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverPercentMin

public double getLouverPercentMin()

setLouverPercentMin

public void setLouverPercentMin(double value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverHallPhyMin

public int getLouverHallPhyMin()

setLouverHallPhyMin

public void setLouverHallPhyMin(int value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverHallPhyMax

public int getLouverHallPhyMax()

setLouverHallPhyMax

public void setLouverHallPhyMax(int value)
                         throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverHallMax

public int getLouverHallMax()

setLouverHallMax

public void setLouverHallMax(int value)
                      throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverHallMin

public int getLouverHallMin()

setLouverHallMin

public void setLouverHallMin(int value)
                      throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getDisplacementRPU

public double getDisplacementRPU()

setDisplacementRPU

public void setDisplacementRPU(double value)
                        throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getSliderLinkageLength

public double getSliderLinkageLength()

setSliderLinkageLength

public void setSliderLinkageLength(double value)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getSliderOffset

public double getSliderOffset()

setSliderOffset

public void setSliderOffset(double value)
                     throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getModelMaxDisplacement

public double getModelMaxDisplacement()

setModelMaxDisplacement

public void setModelMaxDisplacement(double value)
                             throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getLouverLinkageLength

public double getLouverLinkageLength()

setLouverLinkageLength

public void setLouverLinkageLength(double value)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getSliderPivotOffset

public double getSliderPivotOffset()

setSliderPivotOffset

public void setSliderPivotOffset(double value)
                          throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMinDisplacementTravel

public double getMinDisplacementTravel()

setMinDisplacementTravel

public void setMinDisplacementTravel(double value)
                              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMaxDisplacementTravel

public double getMaxDisplacementTravel()

setMaxDisplacementTravel

public void setMaxDisplacementTravel(double value)
                              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getDIHall_Bit

public int getDIHall_Bit(int bit)

setDIHallBit

public void setDIHallBit(int bit,
                         int value)
                  throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getHomingSpeedCounts

public int getHomingSpeedCounts()

setHomingSpeedCounts

public void setHomingSpeedCounts(int value)
                          throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMotionTimeoutOffsetMsec

public long getMotionTimeoutOffsetMsec()

setMotionTimeoutOffsetMsec

public void setMotionTimeoutOffsetMsec(long value)
                                throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMotionTimeoutScale

public double getMotionTimeoutScale()

setMotionTimeoutScale

public void setMotionTimeoutScale(double value)
                           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMotionDistanceOffsetMsec

public long getMotionDistanceOffsetMsec()

setMotionDistanceOffsetMsec

public void setMotionDistanceOffsetMsec(long value)
                                 throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getMotionDistanceScale

public double getMotionDistanceScale()

setMotionDistanceScale

public void setMotionDistanceScale(double value)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

countsPerUnitTravel

public double countsPerUnitTravel()
Get number of motor counts per unit of travel (varies with lead screw gear ratio, counts per revolution and displacement revolution per units)


validatePercent

public boolean validatePercent(double value)
                        throws java.lang.IllegalArgumentException
Validate an louver position value expressed as a percentage of fully open

Throws:
java.lang.IllegalArgumentException

validateDegrees

public boolean validateDegrees(double value)
                        throws java.lang.IllegalArgumentException
Validate an louver position value expressed in engineering units

Throws:
java.lang.IllegalArgumentException

validateCounts

public boolean validateCounts(long value)
                       throws java.lang.IllegalArgumentException
validate a louver position expressed in motor counts

Throws:
java.lang.IllegalArgumentException

validatePosition

public boolean validatePosition(int value)
                         throws java.lang.IllegalArgumentException
validate a louver position expressed as one of the Hall sensor feedback values

Throws:
java.lang.IllegalArgumentException

percent2degrees

public double percent2degrees(double percentValue)
                       throws java.lang.IllegalArgumentException
Convert louver position value (percent) to (engineering) units value This routine does not validate, so may return values that are not physically valid for invalid input

Throws:
java.lang.IllegalArgumentException

degrees2percent

public double degrees2percent(double degreesValue)
                       throws java.lang.IllegalArgumentException
Convert louver position value (engineering units) to percent value This routine does not validate, so may return values that are not physically valid for invalid input

Throws:
java.lang.IllegalArgumentException

readPhysicalLouverPosition

protected int readPhysicalLouverPosition()
                                  throws TimeoutException,
                                         java.io.IOException,
                                         java.lang.NullPointerException,
                                         java.lang.IllegalArgumentException,
                                         java.lang.Exception
read and return louver position, expressed as one of the Hall sensor feedback values

Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

readLogicalLouverPosition

protected int readLogicalLouverPosition(boolean invertScale)
                                 throws TimeoutException,
                                        java.io.IOException,
                                        java.lang.NullPointerException,
                                        java.lang.IllegalArgumentException,
                                        java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getDisplacementCounts

public long getDisplacementCounts(double louverPositionDegrees)
compute displacement (motor counts) for given louver position (degrees). This is an implementation of the kinematic position equations for the louvers (an offset crank-slider mechanism). Louver angle T1 is related to lead screw displacement D by: D = a SIN(T1) - b SIN( ACOS( -(a cos(T1)+c)/b ) ) where a = louver linkage length ( 1.5" ) b = lead screw linkage length ( 10" ) c = lead screw offset ( 8.81" ) This expression references displacement relative to the louver pivot point, and displacement increases with decreasing angle; it does not take into account the offset (-0.44 in) of the slider pivot or the length of the louver pivot arm (+1.5 in). The coordinate system is transformed such that displacement D' is in the range 0-maxDisplacementTravel (5.3 in) and D`(0)=0. D' = K - D + A + Z where K = Max positive travel (6.23 in) A = offsets for louver pivot arm ( +1.5 in) Z = offsets for louver pivot arm and slider ( -0.44 in)


getInvertHallPosition

public boolean getInvertHallPosition()
If invertHallPosition is true, the order of the feedback readings is reversed, ranging from 15-0 instead of 0-15. This is used when the feedback board may be mounted in either direction along the lead screw axis while maintaining the same logical feedback sense (0 is closed, 15 is open)

Specified by:
getInvertHallPosition in interface ElmoLouverIF

setInvertHallPosition

public void setInvertHallPosition(boolean value)
If invertHallPosition is true, the order of the feedback readings is reversed, ranging from 15-0 instead of 0-15. This is used when the feedback board may be mounted in either direction along the lead screw axis while maintaining the same logical feedback sense (0 is closed, 15 is open)

Specified by:
setInvertHallPosition in interface ElmoLouverIF

findBoundary

public long findBoundary(boolean positive,
                         int speedCounts)
                  throws TimeoutException,
                         java.io.IOException,
                         java.lang.NullPointerException,
                         java.lang.IllegalArgumentException,
                         java.lang.Exception
Find and stop at the nearest Hall sensor feedback transition location. Throws IllegalArgumentException if current position is above upper or below lower hall feedback limit (0x0, 0xF),

Specified by:
findBoundary in interface ElmoLouverIF
Parameters:
positive - If positive is true, find the transition by moving in the positive direction, otherwise move in the negative direction.
speedCounts - operate at speedCounts counts/sec
Returns:
position counter value at transition
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

center

public long center(int speedCounts)
            throws TimeoutException,
                   java.io.IOException,
                   java.lang.NullPointerException,
                   java.lang.IllegalArgumentException,
                   java.lang.Exception
Find the center of the current Hall effect feedback position. The strategy is to travel to the nearest transition boundaries, then move halfway between them. The strategy is slightly modified for the two endpoints, where transitions are somewhat different. The upper transition is also a false 0, so that has to be dealt with if it's possible to get there. Notes: - Resets position counter (but returns original value) - Disables the motor

Specified by:
center in interface ElmoLouverIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

home

public void home(int position)
          throws TimeoutException,
                 java.io.IOException,
                 java.lang.NullPointerException,
                 java.lang.IllegalArgumentException,
                 java.lang.Exception
Home to one of the louver's 16 Hall effect position feedback switches. The basic strategy is: - find the center of the current (nearest) feedback position - travel to the desired position (now a multiple of the sensor spacing) - reset the position counter This minimizes unnecessary opening/closing of the louver. This version uses the current value of _homingSpeedCounts

Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

home

public void home(int position,
                 int velocityCounts)
          throws TimeoutException,
                 java.io.IOException,
                 java.lang.NullPointerException,
                 java.lang.IllegalArgumentException,
                 java.lang.Exception
Description copied from interface: ElmoLouverIF
Home to one of the louver's 16 Hall effect position feedback switches. Use the current speed motion settings and do not change the position counter.

Specified by:
home in interface ElmoLouverIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

home

public void home(int position,
                 boolean setCounter,
                 long counterValue,
                 int vLo,
                 int vHi)
          throws TimeoutException,
                 java.io.IOException,
                 java.lang.NullPointerException,
                 java.lang.IllegalArgumentException,
                 java.lang.Exception
Home to one of the louver's 16 Hall effect position feedback switches. The basic strategy is: - find the center of the current (nearest) feedback position - travel to the desired position (now a multiple of the sensor spacing) - reset the position counter This minimizes unnecessary opening/closing of the louver.

Specified by:
home in interface ElmoLouverIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

setLouverPercent

public void setLouverPercent(double positionPercent)
                      throws java.lang.IllegalArgumentException,
                             java.lang.Exception
Set an interpolated louver position between _louverDegreesMin and _louverDegreesMax. Position is expressed as a percentage of full range, 1.0 being open and 0.0 being closed.

Specified by:
setLouverPercent in interface ElmoLouverIF
Throws:
java.lang.IllegalArgumentException
java.lang.Exception

setLouverDegrees

public void setLouverDegrees(double positionDegrees)
                      throws java.lang.IllegalArgumentException,
                             java.lang.Exception
Set an interpolated louver position between _louverDegreesMin and _louverDegreesMax. Position is expressed in engineering units.

Specified by:
setLouverDegrees in interface ElmoLouverIF
Throws:
java.lang.IllegalArgumentException
java.lang.Exception

getLouverPositionDegrees

public double getLouverPositionDegrees()
                                throws TimeoutException,
                                       java.io.IOException,
                                       java.lang.NullPointerException,
                                       java.lang.Exception
Get louver position (in engineering units) This derives from the kinematic position equations for the louvers (an offset crank-slider mechanism). Louver angle T1 is related to lead screw displacement D by: D = a SIN(T1) - b SIN( ACOS( -(a cos(T1)+c)/b ) ) where a = louver linkage length ( 1.5" ) b = lead screw linkage length ( 10" ) c = lead screw offset ( 8.81" ) We solve this for T1, which may be represented a quadratic in Cos(T1) (or Sin(T1) depending on implementation of arccos and arcsin and the geometry assumptions)

Specified by:
getLouverPositionDegrees in interface ElmoLouverIF
Returns:
louver position (degrees)
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getLouverPositionDegrees

public double getLouverPositionDegrees(long positionCounts)
                                throws TimeoutException,
                                       java.io.IOException,
                                       java.lang.NullPointerException,
                                       java.lang.Exception
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getLouverPositionPercent

public double getLouverPositionPercent()
                                throws TimeoutException,
                                       java.io.IOException,
                                       java.lang.NullPointerException,
                                       java.lang.Exception
Get louver position (as a percent of full travel)

Specified by:
getLouverPositionPercent in interface ElmoLouverIF
Returns:
louver position (percent, 0.0-1.0)
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getLouverPositionPercent

public double getLouverPositionPercent(long positionCounts)
                                throws TimeoutException,
                                       java.io.IOException,
                                       java.lang.NullPointerException,
                                       java.lang.Exception
Get louver position (as a percent of full travel)

Returns:
louver position (percent, 0.0-1.0)
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.Exception

getLouverStatusMessage

public java.lang.String getLouverStatusMessage()
                                        throws TimeoutException,
                                               java.io.IOException,
                                               java.lang.NullPointerException,
                                               java.lang.IllegalArgumentException,
                                               java.lang.Exception
return a message indicating the state of several motor registers

Specified by:
getLouverStatusMessage in interface ElmoLouverIF
Throws:
TimeoutException
java.io.IOException
java.lang.NullPointerException
java.lang.IllegalArgumentException
java.lang.Exception

getLouverSampleMessage

public java.lang.String getLouverSampleMessage()
                                        throws TimeoutException,
                                               java.io.IOException,
                                               java.lang.Exception
return a (terse) message indicating the state of several motor registers

Specified by:
getLouverSampleMessage in interface ElmoLouverIF
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

initializeTurnSensor

public void initializeTurnSensor()

getTurnSensorTimeoutMSec

public long getTurnSensorTimeoutMSec()

setTurnSensorTimeoutMSec

public void setTurnSensorTimeoutMSec(long value)
                              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getTurnSensorInputBit

public int getTurnSensorInputBit()

setTurnSensorInputBit

public void setTurnSensorInputBit(int value)
                           throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getTurnSensorOutputBit

public int getTurnSensorOutputBit()

setTurnSensorOutputBit

public void setTurnSensorOutputBit(int value)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

armTurnsSensorTrigger

public boolean armTurnsSensorTrigger()

disarmTurnsSensorTrigger

public boolean disarmTurnsSensorTrigger()
Disarm the turn sensor homing function


getTurnSensorTimeoutMillis

public long getTurnSensorTimeoutMillis(double velocityRPM,
                                       double gearRatio)
Compute the time for one rotation at the current speed


readTurnSensor

public int readTurnSensor()
return DISABLED, TRIGGERED, PENDING, READ_ERROR, RESET


setTurnSensorState

protected void setTurnSensorState(int state,
                                  long triggerCount,
                                  long elapsedTime)

updateTurnSensorState

protected int updateTurnSensorState()
Read turn sensor and update sensor state. The turn sensor consists of a magnet/hall effect pair wired to one of the Elmo digital input pins. Elmo homing functions (HM[N]) are used to configured to detect a transition on that pin and set an output (OP[N]) bit when triggered.

Returns:
ElmoImpl.TS_DISABLED if disabled

getThrusterSampleMessage

public java.lang.String getThrusterSampleMessage()
                                          throws TimeoutException,
                                                 java.io.IOException,
                                                 java.lang.Exception
return thruster sample string

Specified by:
getThrusterSampleMessage in interface ElmoThrusterIF
Throws:
TimeoutException
java.io.IOException
java.lang.Exception

setTurnsSensorEnable

public void setTurnsSensorEnable(boolean value)
Enable or disable the turns sensor

Specified by:
setTurnsSensorEnable in interface ElmoThrusterIF

getTSTriggerCount

public long getTSTriggerCount()
Description copied from interface: ElmoThrusterIF
Return number of times the turns sensor has been triggered since the last reset

Specified by:
getTSTriggerCount in interface ElmoThrusterIF

getTSElapsedMsec

public long getTSElapsedMsec()
Description copied from interface: ElmoThrusterIF
Return the elapsed time since last turns sensor trigger (msec)

Specified by:
getTSElapsedMsec in interface ElmoThrusterIF

getTSState

public int getTSState()
Description copied from interface: ElmoThrusterIF
Return the turns sensor state

Specified by:
getTSState in interface ElmoThrusterIF

getTSStateMnemonic

public static java.lang.String getTSStateMnemonic(int stateValue)

getTSStateName

public java.lang.String getTSStateName()
Description copied from interface: ElmoThrusterIF
return a mnemonic for turns sensor state

Specified by:
getTSStateName in interface ElmoThrusterIF


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.