private class DomeReceiver.Slew extends Thread
isAt(), successful
meaning that the desired position was reached. The anticipated use of
this class is to construct it supplying the desired position and the
allowed offset, then starting it and joining on it for a certain
timeout. If the thread did not finish successfully, it should be
canceled.
Remember: This thread never switches motors on or off!Thread.State, Thread.UncaughtExceptionHandler| Modifier and Type | Field and Description |
|---|---|
private boolean |
cancel
Signals a cancel issued from the outside.
|
private double |
nominal
The requested nominal position in degrees.
|
private double |
offset
The allowed offset.
|
private boolean |
success
If the position is reached, this boolean get true and we die.
|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Modifier | Constructor and Description |
|---|---|
protected |
Slew(double to,
double off)
Constructs a new slewing thread to watch the movement of the
dome to the desired position, required accuracy given.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
cancel()
Cancels this thread.
|
boolean |
isAt()
Returns true, if the desired position is reached.
|
void |
run()
We constantly query the current position of the dome at a cycle of
DomeReceiver.KEY_SLEWSLEEP until the required position is reached within
the required offset. |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldprivate final double nominal
private final double offset
private boolean cancel
private boolean success
protected Slew(double to,
double off)
public void run()
DomeReceiver.KEY_SLEWSLEEP until the required position is reached within
the required offset. If the motors are off, i.e. the dome is not
moving, or if we are canceled from the outside, the success
flag is set to false and we return. Otherwise we return when the
position is reached.
Remember: This thread never switches motors on or off!public boolean isAt()
protected void cancel()