stella.roof
Class BaaderDome

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by io.AbstractDriver
                  extended by stella.roof.BaaderDome
All Implemented Interfaces:
Driver, Cloneable, DomeDriver, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class BaaderDome
extends AbstractDriver
implements DomeDriver

Dome driver implementation for the Baader dome in Potsdam, sheltering Robotel.


Nested Class Summary
private  class BaaderDome.AzimuthRead
          This thread permanently tries to read the azimuth.
static class BaaderDome.Close
          Simple test class that connects to the dome server and closes the dome, additionally cranking out the azimuth.
private  class BaaderDome.CloseHatch
          A thread that turns on the hatch motor for opening and turns it off automatically after a specified wait time.
private  class BaaderDome.CloseSlit
          A thread that turns on the hatch motor for opening and turns it off automatically after a specified wait time.
static class BaaderDome.Open
          Simple test class that connects to the dome server and opens the dome, additionally cranking out the azimuth.
private  class BaaderDome.OpenHatch
          A thread that turns on the hatch motor for opening and turns it off automatically after a specified wait time.
private  class BaaderDome.OpenSlit
          A thread that turns on the hatch motor for opening and turns it off automatically after a specified wait time.
static class BaaderDome.Test
          Simple test class that connects to the dome server and rotates the dome, additionally cranking out the azimuth.
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Double cache
          We have to cache valid azimuth reading due to faulty hardware.
private static double DEFAZIMUTHLINEAR
          Measured linear term, ticks per degree.
private static double DEFAZIMUTHOFFSET
          Offset, crude estimate, N=jump.
private static long DEFAZIMUTHSLEEP
          Default property value.
static String DEFDRIVERNAME
          Default name of the dome in Potsdam.
private static long DEFHATCHCLOSE
          Default property value.
private static long DEFHATCHOPEN
          Default property value.
private static long DEFHATCHSURE
          Default property value.
private static long DEFJOINFULL
          Default property value.
private static int DEFMAXVALID
          Minimum valid reading on dome.
private static int DEFMINVALID
          Minimum valid reading on dome.
private static long DEFREADTIMEOUT
          Default property value.
private static int DEFRPCTIMEOUT
          Default property value.
private static String DEFSERVERNAME
          Default property value.
private static long DEFSLITFULL
          Default property value.
private static long DEFSLITSURE
          Default property value.
private static double DEFSLOWSPEED
          Measured slow speed.
private static boolean DEFUPDATE
          Default property value.
private static Object HATCH
          A lock for hatch operation.
private  Trigger hatchopen
          The trigger that is true, if the hatch is open.
private  Trigger hatchshut
          The trigger that is true, if the hatch is shut.
static String KEY_AZIMUTHLINEAR
          The conversion factor from position encoder to azimuth, linear term.
static String KEY_AZIMUTHOFFSET
          The conversion factor from position encoder to azimuth, offset.
static String KEY_AZIMUTHSLEEP
          Timeout between azimuth reads, ms.
static String KEY_HATCHCLOSE
          Time to ensure that the hatch has moved its entire way.
static String KEY_HATCHOPEN
          Time to ensure that the hatch has moved its entire way.
static String KEY_HATCHSURE
          Time to ensure that the hatch is closed, smaller than full time.
static String KEY_JOINFULL
          Time to ensure that joins are good
static String KEY_MAXVALID
          The raw-azimuth maximum value that is valid.
static String KEY_MINVALID
          The raw-azimuth minimum value that is valid.
static String KEY_READTIMEOUT
          Timeout to get a valid azimuth reading on moving dome.
static String KEY_RPCTIMEOUT
          The RPC time-out in millisecond.
static String KEY_SERVERNAME
          FCDN of the host where the guider rpc server is running.
static String KEY_SLITFULL
          Time to ensure that the slit has moved its entire way.
static String KEY_SLITSURE
          Time to ensure that the slit has opened, smaller than full time.
static String KEY_SLOWSPEED
          The speed in azimuth at slow, degrees per second.
static String KEY_UPDATE
          If true, start the updarte thread on client connect.
static int OK
          return value for OK .
private  DomeClient robotel
          The RPC client talking to the module-pc at the dome.
private static Object SLIT
          A lock for slit operation.
private  Trigger slitopen
          The trigger that is true, if the slit is open.
private  Trigger slitshut
          The trigger that is true, if the slit is shut.
private  Thread update
          This thread updates the azimuth reading continuosly.
 
Fields inherited from class io.AbstractDriver
KEY_DRIVERNAME
 
Fields inherited from class util.PropertyBundles
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES
 
Fields inherited from class util.PropertyResources
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset
 
Fields inherited from class util.PropertyContainer
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR
 
Fields inherited from interface util.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
BaaderDome(Map<String,String> prop)
          Constructs a new BaaderDome driver, but does not connect to hardware.
 
Method Summary
 boolean close()
          Close the RPC communication.
 boolean closeDome()
          Closes the dome.
 boolean closeHatch()
          Closes the hatch.
 boolean closeSlit()
          Closes the slit.
 boolean fastBackward()
          Starts fast backward in azimuth.
 boolean fastForward()
          Starts fast forward in azimuth.
 double getAzimuth()
          Returns the azimuth position of the dome in degrees.
 void init()
          On itit, the triggers are constructed and set to dome closed.
 boolean isDomeClosed()
          Returns true, if dome is closed.
 boolean isDomeOpened()
          Returns true, if dome is open.
 boolean isOpen()
          We are open if we have a client.
 boolean open()
          Opens the RPC client to the module-PC operating the dome.
 boolean openDome()
          Opens the dome.
 boolean openHatch()
          Opens the hatch.
 boolean openSlit()
          Opens the slit.
 boolean slowBackward()
          Starts slow backward in azimuth.
 boolean slowForward()
          Starts slow forward in azimuth.
private  boolean startUpdate()
          This method starts the update thread.
 boolean stopAzimuth()
          Stops the azimuth motor.
 
Methods inherited from class io.AbstractDriver
createDriver, equals, getDriverName, hashCode
 
Methods inherited from class util.PropertyBundles
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource
 
Methods inherited from class util.PropertyResources
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet
 
Methods inherited from class util.PropertyContainer
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface io.Driver
getDriverName
 
Methods inherited from interface util.ResourceSupplying
getResource, getResourceAsStream, getResources
 
Methods inherited from interface util.PropertySupplying
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties
 

Field Detail

OK

public static final int OK
return value for OK .

See Also:
Constant Field Values

KEY_SERVERNAME

public static final String KEY_SERVERNAME
FCDN of the host where the guider rpc server is running.

See Also:
Constant Field Values

KEY_RPCTIMEOUT

public static final String KEY_RPCTIMEOUT
The RPC time-out in millisecond.

See Also:
Constant Field Values

KEY_AZIMUTHLINEAR

public static final String KEY_AZIMUTHLINEAR
The conversion factor from position encoder to azimuth, linear term.

See Also:
Constant Field Values

KEY_AZIMUTHOFFSET

public static final String KEY_AZIMUTHOFFSET
The conversion factor from position encoder to azimuth, offset.

See Also:
Constant Field Values

KEY_SLOWSPEED

public static final String KEY_SLOWSPEED
The speed in azimuth at slow, degrees per second. Setting at 10Hz.

See Also:
Constant Field Values

KEY_UPDATE

public static final String KEY_UPDATE
If true, start the updarte thread on client connect.

See Also:
Constant Field Values

KEY_MINVALID

public static final String KEY_MINVALID
The raw-azimuth minimum value that is valid.

See Also:
Constant Field Values

KEY_MAXVALID

public static final String KEY_MAXVALID
The raw-azimuth maximum value that is valid.

See Also:
Constant Field Values

KEY_READTIMEOUT

public static final String KEY_READTIMEOUT
Timeout to get a valid azimuth reading on moving dome.

See Also:
Constant Field Values

KEY_AZIMUTHSLEEP

public static final String KEY_AZIMUTHSLEEP
Timeout between azimuth reads, ms.

See Also:
Constant Field Values

KEY_HATCHSURE

public static final String KEY_HATCHSURE
Time to ensure that the hatch is closed, smaller than full time.

See Also:
Constant Field Values

KEY_HATCHOPEN

public static final String KEY_HATCHOPEN
Time to ensure that the hatch has moved its entire way.

See Also:
Constant Field Values

KEY_HATCHCLOSE

public static final String KEY_HATCHCLOSE
Time to ensure that the hatch has moved its entire way.

See Also:
Constant Field Values

KEY_SLITSURE

public static final String KEY_SLITSURE
Time to ensure that the slit has opened, smaller than full time.

See Also:
Constant Field Values

KEY_SLITFULL

public static final String KEY_SLITFULL
Time to ensure that the slit has moved its entire way.

See Also:
Constant Field Values

KEY_JOINFULL

public static final String KEY_JOINFULL
Time to ensure that joins are good

See Also:
Constant Field Values

HATCH

private static final Object HATCH
A lock for hatch operation.


SLIT

private static final Object SLIT
A lock for slit operation.


DEFDRIVERNAME

public static final String DEFDRIVERNAME
Default name of the dome in Potsdam.

See Also:
Constant Field Values

DEFSERVERNAME

private static final String DEFSERVERNAME
Default property value.

See Also:
Constant Field Values

DEFRPCTIMEOUT

private static final int DEFRPCTIMEOUT
Default property value.

See Also:
Constant Field Values

DEFUPDATE

private static final boolean DEFUPDATE
Default property value.

See Also:
Constant Field Values

DEFSLOWSPEED

private static final double DEFSLOWSPEED
Measured slow speed.

See Also:
Constant Field Values

DEFMINVALID

private static final int DEFMINVALID
Minimum valid reading on dome.

See Also:
Constant Field Values

DEFMAXVALID

private static final int DEFMAXVALID
Minimum valid reading on dome.

See Also:
Constant Field Values

DEFAZIMUTHLINEAR

private static final double DEFAZIMUTHLINEAR
Measured linear term, ticks per degree.

See Also:
Constant Field Values

DEFAZIMUTHOFFSET

private static final double DEFAZIMUTHOFFSET
Offset, crude estimate, N=jump. -> -32089(mm?) = -180deg

See Also:
Constant Field Values

DEFAZIMUTHSLEEP

private static final long DEFAZIMUTHSLEEP
Default property value.

See Also:
Constant Field Values

DEFREADTIMEOUT

private static final long DEFREADTIMEOUT
Default property value.

See Also:
Constant Field Values

DEFHATCHSURE

private static final long DEFHATCHSURE
Default property value.

See Also:
Constant Field Values

DEFHATCHCLOSE

private static final long DEFHATCHCLOSE
Default property value.

See Also:
Constant Field Values

DEFHATCHOPEN

private static final long DEFHATCHOPEN
Default property value.

See Also:
Constant Field Values

DEFSLITSURE

private static final long DEFSLITSURE
Default property value.

See Also:
Constant Field Values

DEFSLITFULL

private static final long DEFSLITFULL
Default property value.

See Also:
Constant Field Values

DEFJOINFULL

private static final long DEFJOINFULL
Default property value.

See Also:
Constant Field Values

robotel

private DomeClient robotel
The RPC client talking to the module-pc at the dome.


hatchopen

private Trigger hatchopen
The trigger that is true, if the hatch is open.


hatchshut

private Trigger hatchshut
The trigger that is true, if the hatch is shut.


slitopen

private Trigger slitopen
The trigger that is true, if the slit is open.


slitshut

private Trigger slitshut
The trigger that is true, if the slit is shut.


cache

private Double cache
We have to cache valid azimuth reading due to faulty hardware.


update

private Thread update
This thread updates the azimuth reading continuosly.

Constructor Detail

BaaderDome

public BaaderDome(Map<String,String> prop)
Constructs a new BaaderDome driver, but does not connect to hardware. This is done in the open() section.

Method Detail

init

public void init()
On itit, the triggers are constructed and set to dome closed. Read only after the client has been opened and the appropriate hardware has been installed.

Specified by:
init in interface Initializable
Overrides:
init in class PropertyResources

open

public boolean open()
             throws IOException
Opens the RPC client to the module-PC operating the dome. Currently, the hardware does not support reading of the limit switches, but setting the #KEY_HATCHSWITCHES and #KEY_SLITSWITCHES to true, initializes the internal triggers with true readings.

Specified by:
open in interface Driver
Returns:
True if initialization was successful.
Throws:
IOException

startUpdate

private boolean startUpdate()
                     throws IOException
This method starts the update thread. It is normally started right at opening the driver. It assumes that the dome client is connected.

Throws:
IOException

isOpen

public boolean isOpen()
We are open if we have a client.

Specified by:
isOpen in interface Driver
Returns:
True, if a previous initialization was successful

close

public boolean close()
              throws IOException
Close the RPC communication.

Specified by:
close in interface Driver
Returns:
True if clean-up was successful.
Throws:
IOException

stopAzimuth

public boolean stopAzimuth()
                    throws IOException
Stops the azimuth motor.

Specified by:
stopAzimuth in interface DomeDriver
Throws:
IOException

fastForward

public boolean fastForward()
                    throws IOException
Starts fast forward in azimuth. Forward means in normal daily rotation, from south to west.

Specified by:
fastForward in interface DomeDriver
Throws:
IOException

fastBackward

public boolean fastBackward()
                     throws IOException
Starts fast backward in azimuth. Backwards measn against normal daily rotation, from south to east.

Specified by:
fastBackward in interface DomeDriver
Throws:
IOException

slowForward

public boolean slowForward()
                    throws IOException
Starts slow forward in azimuth. Forward means in normal daily rotation, from south to west.

Specified by:
slowForward in interface DomeDriver
Throws:
IOException

slowBackward

public boolean slowBackward()
                     throws IOException
Starts slow backward in azimuth. Backwards measn against normal daily rotation, from south to east.

Specified by:
slowBackward in interface DomeDriver
Throws:
IOException

openSlit

public boolean openSlit()
                 throws IOException
Opens the slit. On robotel, this is only possible, if the hatch is closed.

Specified by:
openSlit in interface DomeDriver
Throws:
IOException

openHatch

public boolean openHatch()
                  throws IOException
Opens the hatch. Only possible, if the slit is not closed.

Specified by:
openHatch in interface DomeDriver
Throws:
IOException

openDome

public boolean openDome()
                 throws IOException
Opens the dome. This means we first close the hatch, start the slit opening and then start the hatch opening.

Specified by:
openDome in interface DomeDriver
Throws:
IOException

closeDome

public boolean closeDome()
                  throws IOException
Closes the dome. This means we close both at the same time.

Specified by:
closeDome in interface DomeDriver
Throws:
IOException

closeHatch

public boolean closeHatch()
                   throws IOException
Closes the hatch. Only possible, if the slit is not totally shut.

Specified by:
closeHatch in interface DomeDriver
Throws:
IOException

closeSlit

public boolean closeSlit()
                  throws IOException
Closes the slit. This is only possible in conjunction to the hatch being closed, so we return a close dome here.

Specified by:
closeSlit in interface DomeDriver
Throws:
IOException

isDomeOpened

public boolean isDomeOpened()
Returns true, if dome is open. Currently, not hardware switches are installed, so we return the state of our internal switches.

Specified by:
isDomeOpened in interface DomeDriver

isDomeClosed

public boolean isDomeClosed()
Returns true, if dome is closed. Currently, not hardware switches are installed, so we return the state of our internal switches.

Specified by:
isDomeClosed in interface DomeDriver

getAzimuth

public double getAzimuth()
                  throws IOException
Returns the azimuth position of the dome in degrees. Numbering starts at South, increases to West, and goes to East=270.

The hardware installed at robotel is not very reliable, at an error rate of 50%. The unability to read is strongly position depending, i.e. if the dome is stopped at a position, where reading fails, repeating the reading will not help. Thus, we start a parallel thread on opening that contiuously caches valid readings. The most actual reading is returned by this method, without any access to the hardware.

Specified by:
getAzimuth in interface DomeDriver
Throws:
IOException