Commit 4182192c authored by Tammo Jan Dijkema's avatar Tammo Jan Dijkema
Browse files

Add waitUntilMoving, rename speed_az

parent c4f692e9
......@@ -9,6 +9,7 @@ import os.path
import numpy as np
import threading
import select
import time
config = ConfigParser()
config.readfp(open(os.path.join(os.path.dirname(__file__), 'telescope.ini')))
......@@ -30,6 +31,9 @@ class telescope():
if consoleHost == 'console':
logging.warning("You are using the actual console, not a demo!")
self.dist_az = None
self.dist_el = None
self.outsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.setmode == 'J2000':
......@@ -98,8 +102,8 @@ class telescope():
self.el = (float(vals[1])*u.rad).to(u.deg)
self.dist_az = (float(vals[2])*u.rad).to(u.deg)
self.dist_el = (float(vals[3])*u.rad).to(u.deg)
self.az_speed = float(vals[4])
self.el_speed = float(vals[5])
self.speed_az = float(vals[4])
self.speed_el = float(vals[5])
def setRaDec(self, setpoint):
......@@ -117,7 +121,7 @@ class telescope():
(ra, dec) = setpoint.to_string('hmsdms').split()
cmd = '{:s}\t{:s}\n'.format(ra, dec).decode('UTF-8')
cmd = '{:s}\t{:s}\n'.format(ra, dec.strip('+'))'J2000 setpoint sent to DT: {}'.format(cmd))
......@@ -137,7 +141,7 @@ class telescope():
if isinstance(el, u.Quantity):
el =
cmd = '{:f}\t{:f}\n'.format(az, el).decode('UTF-8')
cmd = '{:f}\t{:f}\n'.format(az, el)'AzEl sent to DT: {}'.format(cmd))
......@@ -170,7 +174,17 @@ class telescope():
Wait until distance to the setpoint gets within tolerance
while abs(self.dist_el)>0.01*u.deg or abs(self.dist_az)>0.01*u.deg:
# No time.sleep here, because getDistToSetpoint already blocks with an interval
time.sleep(2)"Waiting to reach setpoint")
while self.dist_el is None or self.dist_az is None or \
abs(self.dist_el)>0.01*u.deg or abs(self.dist_az)>0.01*u.deg:
def waitUntilMoving(self):
Wait until the telescope reckognizes that it is not at its setpoint
'''"Waiting to set setpoint")
while self.dist_el is None or self.dist_az is None or \
(abs(self.dist_el)<0.01*u.deg and abs(self.dist_az)<0.01*u.deg):
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