Commit a7d18925 authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add tolerance to wait functions, fix check for mercurius

parent 74940254
...@@ -29,7 +29,7 @@ class telescope(): ...@@ -29,7 +29,7 @@ class telescope():
if consoleHost is None: if consoleHost is None:
consoleHost = config.get('Console','HostName') consoleHost = config.get('Console','HostName')
if consoleHost == 'console': if consoleHost == 'console':
if socket.hostname=="mercurius": if socket.gethostname()=="mercurius":
logging.warning("You are using the actual console, not a demo!") logging.warning("You are using the actual console, not a demo!")
else: else:
raise ValueError("Talking to the actual console can only be done from mercurius") raise ValueError("Talking to the actual console can only be done from mercurius")
...@@ -128,7 +128,7 @@ class telescope(): ...@@ -128,7 +128,7 @@ class telescope():
if self.setmode != 'J2000': if self.setmode != 'J2000':
raise ValueError("Cannot set Ra/Dec if mode is not J2000") raise ValueError("Cannot set Ra/Dec if mode is not J2000")
if not isinstance(setpoint, SkyCoord): if isinstance(setpoint, tuple):
coord = SkyCoord(ra =setpoint[0] * u.radian, coord = SkyCoord(ra =setpoint[0] * u.radian,
dec=setpoint[1] * u.radian) dec=setpoint[1] * u.radian)
...@@ -225,7 +225,7 @@ class telescope(): ...@@ -225,7 +225,7 @@ class telescope():
self._event_traces.wait() self._event_traces.wait()
return self.setpoint_radec return self.setpoint_radec
def waitUntilThere(self): def waitUntilThere(self, tolerance=0.01*u.deg):
''' '''
Wait until distance to the setpoint gets within tolerance Wait until distance to the setpoint gets within tolerance
''' '''
...@@ -234,9 +234,9 @@ class telescope(): ...@@ -234,9 +234,9 @@ class telescope():
distIsSmall = False distIsSmall = False
while not distIsSmall: while not distIsSmall:
diff = self.getDistance(waitForUpdate=True) diff = self.getDistance(waitForUpdate=True)
distIsSmall = abs(self.dist_el)<0.01*u.deg and abs(self.dist_az)<0.01*u.deg distIsSmall = abs(self.dist_el)<tolerance and abs(self.dist_az)<tolerance
def waitUntilMoving(self): def waitUntilMoving(self, tolerance=0.01*u.deg):
''' '''
Wait until the telescope reckognizes that it is not at its setpoint Wait until the telescope reckognizes that it is not at its setpoint
''' '''
...@@ -244,7 +244,7 @@ class telescope(): ...@@ -244,7 +244,7 @@ class telescope():
distIsBig = False distIsBig = False
while not distIsBig: while not distIsBig:
dist = self.getDistance(waitForUpdate=True) dist = self.getDistance(waitForUpdate=True)
distIsBig = dist[0]>0.01*u.deg or dist[1]>0.01*u.deg distIsBig = dist[0]>tolerance or dist[1]>tolerance
def getJ2000(self): def getJ2000(self):
''' '''
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment