def stellariumConnectMenu(self,theClient): host = "localhost" port = 10001 while(True): print "** Telescope server ready" print "** The host is: %s" % host print "** The port is: %u\n" % port print "** Telescope server Menu" print "** IMPORTANT! You must start this server *before* attempting to connect via Stellarium" print "** 1. Start server" print "** 2. Change host and port" print "** 3. Return to Main Menu" uInput = raw_input() if uInput=="1": print "Telescope server started." print "Connect from within stellarium using host=%s and port=%u" % (host, port) stelCon = stellariumConnect.stellariumConnect(host,port) stelCon.handshakeStellarium() theClient.stellariumMode(stelCon) break elif uInput=="2": host = self.setAddresHost() port = self.setAddressPort() elif uInput=="3": break else: print "Error %s is not a valid menu option please try again." % uInput
def stellariumConnectMenu(self, theClient): host = "localhost" port = 10001 while (True): print "** Telescope server ready" print "** The host is: %s" % host print "** The port is: %u\n" % port print "** Telescope server Menu" print "** IMPORTANT! You must start this server *before* attempting to connect via Stellarium" print "** 1. Start server" print "** 2. Change host and port" print "** 3. Return to Main Menu" uInput = raw_input() if uInput == "1": print "Telescope server started." print "Connect from within stellarium using host=%s and port=%u" % ( host, port) stelCon = stellariumConnect.stellariumConnect(host, port) stelCon.handshakeStellarium() theClient.stellariumMode(stelCon) break elif uInput == "2": host = self.setAddresHost() port = self.setAddressPort() elif uInput == "3": break else: print "Error %s is not a valid menu option please try again." % uInput
def calibrationMenu(self, theClient): host = "localhost" port = 10001 while (True): print "** iTelescope calibration instructions:\n" print "** Calibration uses Stellarium, Connect from within Stellarium (after starting the server below)." print "** Point the telescope at a known star (e.g. Polaris) then select that star in Stellarium" print "** Issue the \"go to\" command from Stellarium (ctrl + <Telescope Number>)\n" print "** Telescope server ready" print "** The host is: %s" % host print "** The port is: %u\n" % port print "** 1. Start Stellarium server" print "** 2. Change host and port" print "** 3. I have aligned the telescope myself thanks (reset corrections to zero)." print "** 4. Return to Main Menu" uInput = raw_input() if uInput == "1": print "Telescope server started." print "Connect from within stellarium using host=%s and port=%u" % ( host, port) stelCon = stellariumConnect.stellariumConnect(host, port) stelCon.handshakeStellarium() theClient.calibrationMode(stelCon) #stelCon.closeConnection() #stelCon = stellariumConnect.stellariumConnect(host,port) #stelCon.handshakeStellarium() #theClient.stellariumMode(stelCon) break elif uInput == "2": host = self.setAddresHost() port = self.setAddressPort() elif uInput == "3": theClient.calibrationReset() elif uInput == "4": break else: print "Error %s is not a valid menu option please try again." % uInput
def calibrationMenu(self,theClient): host = "localhost" port = 10001 while(True): print "** iTelescope calibration instructions:\n" print "** Calibration uses Stellarium, Connect from within Stellarium (after starting the server below)." print "** Point the telescope at a known star (e.g. Polaris) then select that star in Stellarium" print "** Issue the \"go to\" command from Stellarium (ctrl + <Telescope Number>)\n" print "** Telescope server ready" print "** The host is: %s" % host print "** The port is: %u\n" % port print "** 1. Start Stellarium server" print "** 2. Change host and port" print "** 3. I have aligned the telescope myself thanks (reset corrections to zero)." print "** 4. Return to Main Menu" uInput = raw_input() if uInput=="1": print "Telescope server started." print "Connect from within stellarium using host=%s and port=%u" % (host, port) stelCon = stellariumConnect.stellariumConnect(host,port) stelCon.handshakeStellarium() theClient.calibrationMode(stelCon) #stelCon.closeConnection() #stelCon = stellariumConnect.stellariumConnect(host,port) #stelCon.handshakeStellarium() #theClient.stellariumMode(stelCon) break elif uInput=="2": host = self.setAddresHost() port = self.setAddressPort() elif uInput=="3": theClient.calibrationReset() elif uInput=="4": break else: print "Error %s is not a valid menu option please try again." % uInput
R = TSC.twoStarRotationMatrix() R1 = TSC.oneStarRotaionMatrix() TSC.addRotationMatrix(R) [Az2,Alt2] = TSC.correct(-3.036725575684632, 0.300000000000000) calP = calibrationParser("instrumentCalibration.xml") calP.setAzAltCorrection(R) Rp = calP.getAzAltCorrection() print Rp print R print [Az2,Alt2] sCon = stellariumConnect.stellariumConnect('localhost',10001) sCon.handshakeStellarium() while True: [Ra, Dec] = sCon.receiveStellariumCoords(10) if Ra != False: Ra.ounits = "hours" Dec.ounits = "degrees" print "%s / %s" % (Ra,Dec) sCon.sendStellariumCoords(Ra, Dec)
import stellariumConnect, angles, serial, numpy as np, sys from datetime import datetime, timedelta from reportCoordinates import reportCoordinates import scrollWheelMac as scroll AVERAGE_LENGTH = 15. if len(sys.argv) == 1: print "Please call this script with the serial port identifier and optionally a time offset" exit() elif len(sys.argv) > 1: portIdentifier = '/dev/tty.' + sys.argv[1] timeOffset = float(sys.argv[2]) if (len(sys.argv) == 3) else 0 stelCon = stellariumConnect.stellariumConnect("localhost",10001) stelCon.handshakeStellarium() stelCon.sendStellariumCoords(angles.Angle(r=0), angles.Angle(r=0)) imu = serial.Serial(portIdentifier, 115200) try: avgIdx = 0 encoderPrev, encoderDelta = (0, 0) first = True while True: yawAvg, pitchAvg, rollAvg, zoomAvg = (np.zeros(AVERAGE_LENGTH), np.zeros(AVERAGE_LENGTH), np.zeros(AVERAGE_LENGTH), np.zeros(AVERAGE_LENGTH)) for i in range(int(AVERAGE_LENGTH)): reading = imu.readline().strip() imuRes = reading.split(",") if len(imuRes) <> 4: continue try: yawAvg[avgIdx%AVERAGE_LENGTH] = float(imuRes[0])