def getAzAlt(self, Ra, Dec): RaDec = sidereal.RADec(Ra.r, Dec.r) AltAz = RaDec.altAz(RaDec.hourAngle(self.sysTime, self.Lon.r), self.Lat.r) Az = angles.Angle(r=AltAz.az) Alt = angles.Angle(r=AltAz.alt) return [Az, Alt]
def reportingLoop(self): self.clientSock.send("report") while self.theQuitCall.alive: reading = self.clientSock.recv(1024) radecS = reading.split(":") Ra = angles.Angle(r=float(radecS[0])) Dec = angles.Angle(r=float(radecS[1])) self.stelCom.sendStellariumCoords(Ra,Dec) if(self.stelReceiver.hasTarget): break else: self.clientSock.send("1")
def getRaDec(self, Az, Alt): Az, Alt = angles.Angle(d=Az), angles.Angle(d=Alt) AltAz = sidereal.AltAz(Alt.r, Az.r) GST = sidereal.SiderealTime.fromDatetime(self.sysTime) LST = GST.lst(self.Lon.r) RaDec = AltAz.raDec(LST, self.LatLon) Ra = angles.Angle(r=RaDec.ra) Dec = angles.Angle(r=RaDec.dec) return [Ra, Dec]
def evaluationMode(self): theQuitCall = quitter.quitter("The position evaluator") theQuitCall.start() try: self.clientSock.send("report") while theQuitCall.alive: reading = self.clientSock.recv(1024) radecS = reading.split(":") Ra = angles.Angle(r=float(radecS[0])) Dec = angles.Angle(r=float(radecS[1])) Ra.ounit = "degrees" Dec.ounit = "degrees" print "Ra :%s" % Ra print "Dec:%s" % Dec self.clientSock.send("1") self.clientSock.send("0") completion = self.clientSock.recv(1024) if completion != "reportingComplete": print "Error: the iTelRaspberry server did not confirm completion of reporting mode" except IOError as e: print "evaluation mode failed, check connection %s" % e.message
def stellariumToAngle(self,RaInt,DecInt): Ra = angles.Angle(h=(RaInt*12.0/2147483648)) Dec = angles.Angle(d=(DecInt*90.0/1073741824)) return [Ra, Dec]
def __init__(self, sysTime): self.sysTime = sysTime [self.Lat, self.Lon] = [angles.Angle(d=49.8997541), angles.Angle(d=-97.1374937)] self.LatLon = sidereal.LatLon(self.Lat.r, self.Lon.r)
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]) pitchAvg[avgIdx%AVERAGE_LENGTH] = float(imuRes[1])
slew = [routeNorm[0] * SLmax, routeNorm[1] * SLmax] step = [slew[0] * dt, slew[1] * dt] Ra_me = Ra_me + step[0] Dec_me = Dec_me + step[1] print('Me: [%3.2f, %3.2f], Targ: [ %3.2f, %3.2f ] deg. Slew: [%3.2f, %3.2f] deg/s. Slew step: [%3.2f, %3.2f]' \ % (math.degrees(Ra_me), math.degrees(Dec_me), math.degrees(Ra_tg), math.degrees(Dec_tg), math.degrees(slew[0]), math.degrees(slew[1]), math.degrees(step[0]), math.degrees(step[1]) ) ) if track: SAT.update(obs) Ra = angles.Angle(r=SAT.obj.ra) Dec = angles.Angle(r=SAT.obj.dec) Alt = math.degrees(SAT.obj.alt) Az = math.degrees(SAT.obj.az) Ra.ounits = "hours" Dec.ounits = "degrees" slewSpeed = [(Az - AzOld), (Alt - AltOld)] if (slewSpeed[0] != 0) & (slewSpeed[1] != 0): visible = 'VISIBLE' if SAT.check_pass(0) else 'NOT VISIBLE' #visible = 'NOT VISIBLE' up = 'UP' if (Alt > 0.0) else 'NOT UP' print( 'AZ/ALT: %f / %f | RA/DEC: %s / %s | SLEW: %f / %f (deg/s) -- %s, %s'