View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002756 | SkyChart | 1-Software | public | 24-08-20 05:06 | 24-09-24 13:24 |
| Reporter | Michael C Rushford | Assigned To | |||
| Priority | normal | Severity | tweak | Reproducibility | always |
| Status | feedback | Resolution | open | ||
| Platform | PC | OS | Windows | OS Version | 10 64bit |
| Product Version | 4.3 beta | ||||
| Summary | 0002756: GETSCOPERADEC S/F Return current telescope coordinates, string or float format | ||||
| Description | Using python 3. data = cdccmd(b'GETSCOPERADEC F') print ("b'GETSCOPERADEC F data ",data) b'GETSCOPERADEC F data b'OK! 16h28m54s +21d28m39s\r\n' Request for floating point location for the telescope only reports a string no mater if use F or S. a preferred scope command would be like asking for the chart center Ra or dec separately | ||||
| Steps To Reproduce | Python 3 code demonstrates this issue on last few lines #!/usr/bin/python # example script that load an observation list # and loop on every visible object from this list #https://github.com/pchev/skychart/blob/master/skychart/sample_client/python/testObsList.py import re import os import time import socket import math # default values. HOST = '127.0.0.1' PORT = 3292 HOMEDIR = os.environ['HOMEPATH'] # Real port values can be read from ~/.skychart/tmp/tcpport when skychart is running # In Windows change this to read the registry key HKCU\Software\Astro_PC\Ciel\Status\TcpPort #f = open(HOMEDIR+'\\.skychart\\tmp\\tcpport.txt','r') PORT = 3292#int(f.read()) #print("PORT ",PORT) #f.close # set the observation list to use here: #obslist = os.getcwd()+'\\testlist.txt' obslist = b'C:\\skychart-4.2.1-4073-windows\\testlist.txt' #print("obslist ",obslist) if PORT==0 : print ('Skychart is not running') exit(1) # function to clear the receive buffer def purgebuffer(): s.setblocking(0) resp = '.\r\n' while resp != '': try: resp = s.recv(1024) except: resp = '' s.setblocking(1) return resp # function to send a command and wait for the response def cdccmd(cmd,prterr=True): print("cdcmd ", cmd) purgebuffer() s.setblocking(1) s.send(cmd+b'\r\n') data = b'' resp = b'.\r\n' while True: resp = s.recv(1024) data = data + resp print('56 resp ',resp) if (b"OK!" in resp)or(b"Failed!" in resp): break if (prterr)and(b"OK!" not in resp) : print (cmd+b' '+data) return data def testcommands(): # # Set chart option cdccmd(b'SETFOV 1') cdccmd(b'SETPROJ EQUAT') cdccmd(b'REDRAW') # Connect the telescope cdccmd(b'CONNECTTELESCOPE') cdccmd(b'REDRAW') time.sleep(2) # move x and y back to center cdccmd(b'MOVENORTH') cdccmd(b'REDRAW') time.sleep(2) cdccmd(b'MOVESOUTH') cdccmd(b'REDRAW') time.sleep(2) cdccmd(b'MOVEEAST') cdccmd(b'REDRAW') time.sleep(2) cdccmd(b'MOVEWEST') cdccmd(b'REDRAW') time.sleep(2) #MARKCENTER cdccmd(b'MARKCENTER ON') cdccmd(b'REDRAW') time.sleep(2) cdccmd(b'MARKCENTER OFF') cdccmd(b'REDRAW') time.sleep(2) #GETID CENTER and SCOPE cdccmd(b'IDCENTER') cdccmd(b'IDSCOPE') # Connect the telescope cdccmd(b'CONNECTTELESCOPE') cdccmd(b'REDRAW') time.sleep(2) print (" ") cdccmd(b'GETRISESET') cdccmd(b'REDRAW') time.sleep(2) print (" ") #21h09m33s -16d21m32s 317.3875, -16.35888889 #t = "21:09:33" #(h, m, s) = t.split(':') #result = float(h) + float(m)/60 + float(s)/60/60 #print ("result",float_to_bin(result)) #cdccmd(b'SETRA ',float_to_bin(result)) #cdccmd(b'SETRA RA:21.0') #cdccmd(b'REDRAW') #time.sleep(2) # Disconnect the telescope #cdccmd(b'DISCONNECTTELESCOPE') def Loadobservationlist(): # Load the observation list print (b'Load the observation list: '+ obslist) cdccmd(b'OBSLISTLOAD '+obslist) # Set limit to observable objects cdccmd(b'OBSLISTAIRMASSLIMIT 2') cdccmd(b'OBSLISTLIMIT ON') # Select first object data = cdccmd(b'OBSLISTFIRST') print('L136 data ',data) while b'Failed!' not in data: obj = '' p = data.find('OK!') if p>=0 : obj = data[p+3:] print ('L142 Process object: '+obj) # Slew the telescope to selected object cdccmd('SLEW') # wait slew is completed data=cdccmd(b'GETSCOPERADEC') prevdata='' while data != prevdata : time.sleep(5) prevdata=data data=cdccmd(b'GETSCOPERADEC') print ("152 Telescope position: "+data.strip(' \t\n\r')) print ('Telescope pointed on '+obj ) ## ## Insert here the code to command the guider and CCD camera ## print ("Start auto-guider") print ("Start CCD exposure") time.sleep(5) print ("End CCD exposure") print ("Stop auto-guider") ## # refresh limit for current time cdccmd(b'OBSLISTLIMIT ON') # Go to next object in list data = cdccmd(b'OBSLISTNEXT',False) print ('End of observation list') def get_x_y_co(circles): xc = circles[0] #x-co of circle (center) yc = circles[0] #y-co of circle (center) r = circles[1] #radius of circle arr=[] for i in range(0,359,45): y = yc + r*math.cos(i) x = xc+ r*math.cos(i) x=int(x) y=int(y) #Create array with all the x-co and y-co of the circle arr.append([x,y]) return arr def float_to_bin(x): if x == 0: return "0" * 64 w, sign = (float.hex(x), 0) if x > 0 else (float.hex(x)[1:], 1) mantissa, exp = int(w[4:17], 16), int(w[18:]) return "{}{:011b}{:052b}".format(sign, exp + 1023, mantissa) ############################################################# # Start of the main program ############################################################# circles = [1,2,0.1] get_x_y_co(circles) print (get_x_y_co(circles)) # Connect to Skychart s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #print (s) print (HOST, PORT) s.connect((HOST, PORT)) data = s.recv(1024) #print ('data ', data ) # #testcommands() # #GETSCOPERADEC = cdccmd(b'GETSCOPERADEC') #print ("207 GETSCOPERADEC = cdccmd(b'GETSCOPERADEC') ",GETSCOPERADEC) #print("GETSCOPERADEC DATA ",data) #cdccmd(b'REDRAW') #time.sleep(2) #cdccmd(b'SETRA RA:21h12m26.2s') #cdccmd(b'REDRAW') #time.sleep(2) data=cdccmd(b'GETSCOPERADEC') #str(data, 'UTF8') #print ("218 data ",data) #print ("219 Telescope position: ",data.strip(b' \t\n\r')) #b'OK! 21h12m26s -15d57m20s' str(data, 'UTF8') if b"h" in data: Sunobj=data.split(b"SUN") print ("L226 Sunobj ",Sunobj) hours=data.split(b"h") #print ("223 data.split(bh)" ,hours[0]) #data.split(bh) [b'OK! 21', b'12m26s -15d54m21s\r\n'] RAhor = (hours[0].decode('ascii')[4:]) print ("225 RAhor ",RAhor) min=data.split(b" ") # print ("229 min[0] ",min[0])#min[0] b'OK!' # print ("229 min[1] ",min[1])#min[1] b'21h12m26s' m =min[1].split(b"m") # print ("233 m[0] ",m[0] )#233 m[0] b'21h12' RAmin=m[0].decode('ascii')[3:] # print ("235 RAmin ",RAmin )#RAmin 12 se=min[1].split(b"s") # print ("237 s ",se) RAsec=se[0].decode('ascii')[6:] print ("233 RAsec ",RAsec) RAfloat=int(RAhor)+int(RAmin)/60+int(RAsec)/3600 print (RAfloat) h1 = int(RAfloat) m1 = int(RAfloat*60) % 60 s1 = int(RAfloat*3600) % 60 sh1=0 if len(str(h1)) == 1: sh1="0"+str(h1) else: sh1=str(sh1) if len(str(m1)) == 1: sm1="0"+str(m1) else: sm1=str(m1) if len(str(s1)) == 1: ss1="0"+str(s1) else: ss1=str(s1) print(sh1+"h"+sm1+"m"+ss1+"s") d=hours[1].split(b"d") DECdeg=d[0][-3:].decode('ascii')#238 DECdeg -16 print ("237 DECdeg",DECdeg) DECm=data.split(b"m")#DECdeg [b'OK! 21h12', b'47s -15d59', b'50s\r\n'] DECmin=DECm[1].decode('ascii')[-2:] print ("241 DECmin",DECmin) DECs=data.split(b"s")#DECdeg [b'OK! 21h12', b'47s -15d59', b'50s\r\n'] #print ("244 DECs ",DECs[1]) DECsec=DECs[1].decode('ascii')[-2:] print ("246 DECsec",DECsec) c="SETRA RA:"+RAhor+"h"+RAmin+"m"+RAsec+"s" print (c) cdccmd(str.encode(c)) time.sleep(2) cdccmd(b'REDRAW') #https://www.ap-i.net/skychart/es/documentation/server_commands #https://www.ap-i.net/skychart/nl/documentation/server_commands?s[]=dec #MOVESCOPE RA Dec [00.00]#Move the telescope cursor to the coordinates. ra in decimal hours Beweeg de telescoop cursor naar de coördinaten. RA in decimale uren. #MOVESCOPEH Uurhoek Dec [00.00]#Similar to Movescope, but with horary angle instead of ra. horary Gelijk aan MOVESCOPE, maar met uurhoek in plaats van RA. Uurhoek in decimale uren. #SLEW RAhr Dec [in decimal]#Swivel the standard telescope to the specified coordinates Zwenk de standaard telescoop naar de opgegeven coördinaten. #ABORTSLEW#Abort the current slew command Breek het huidige zwenk-commando af. #SLEWINDI RAhr Dec [decimaal]#Swivel the indi telescope to the specified coordinates Zwenk de INDI telescoop naar de opgegeven coördinaten #ABORTSLEWINDI#ABORTSLEWINDI Abort the current slew command. ABORTSLEWINDI Breek het huidge zwenk-commando af.. #SYNC RAhr Dec [in decimal]#Synchronize the default telescope to the specified coordinates Synchroniseer de standaard telescoop op de opgegeven coördinaten. c="SETDEC DEC:"+DECdeg+"d"+DECmin+"m"+DECsec+"s" print (c) cdccmd(str.encode(c)) time.sleep(2) cdccmd(b'REDRAW') ''' for P in range(59,-1,-20):#se print(P) c="SETRA RA:"+str(RAhor)+"h"+str(RAmin)+"m"+str(P)+"s" print(c) cdccmd(str.encode(c)) cdccmd(b'REDRAW') time.sleep(3) a = [int(num) for num in re.findall(r"\d+", c)] ho=a[0] mi=a[1] se=a[2] RAdec = "MOVESCOPEH RA:"+str(RAhor)+"h"+str(RAmin)+"m"+str(P)+"s" RAdec = "MOVESCOPEH RA:"+str(float(RAhor) + float(RAmin)/60 + float(P)/60/60) print (RAdec) cdccmd(str.encode(RAdec)) cdccmd(b'REDRAW') time.sleep(3) for P in range(0,60,20): c="SETRA RA:"+str(RAhor)+"h"+str(RAmin)+"m"+str(P)+"s" a = [int(num) for num in re.findall(r"\d+", c)] ho=a[0] mi=a[1] se=a[2] result = float(ho) + float(mi)/60 + float(se)/60/60 print (result) print(c) cdccmd(str.encode(c)) cdccmd(b'REDRAW') time.sleep(3) ''' #m = int(min[0].decode('ascii')[1:]) #print ("m[0] ",m) #print ("223 hours",hours) #print ("data ",data) #print ("209 Telescope position: ",data.strip(b' \t\n\r')) # Close connexion to Skychart #EQUINOX=2460519.5 #mosaic_01 08h31m36s +19d01m16s 0.00 7.11 5.34 #mosaic_02 08h31m36s +18d56m28s 0.00 7.11 5.34 #mosaic_03 08h31m36s +18d51m40s 0.00 7.11 5.34 #mosaic_04 08h31m09s +19d01m16s 0.00 7.11 5.34 #mosaic_05 08h31m09s +18d56m28s 0.00 7.11 5.34 #mosaic_06 08h31m09s +18d51m40s 0.00 7.11 5.34 #mosaic_07 08h30m42s +19d01m16s 0.00 7.11 5.34 #mosaic_08 08h30m42s +18d56m28s 0.00 7.11 5.34 #mosaic_09 08h30m42s +18d51m40s 0.00 7.11 5.34 #a = [int(num) for num in re.findall(r"\d+", c)] #RAhor=a[0] #RAmin=a[1] #RAsec=a[2] #result = float(RAhor) + float(RAmin)/60 + float(RAsec)/60/60 #print ("L350 result ",result) print ("Close connexion to Skychart") data = cdccmd(b'GETRISESET') print ("L131 GETRISESET ",data)############################ data = cdccmd(b'GETRA F')#Chart center RA, S → 17h07m12s F → 17.11991 print ("L133 b'GETRA F data ",data) data = cdccmd(b'GETDEC')#Chart center DEC print ("L133 b'GETDEC F data ",data) data = cdccmd(b'GETSCOPERADEC F') print ("L133 b'GETSCOPERADEC F data ",data) s.close() | ||||
| Additional Information | Thanks for your efforts. | ||||
| Tags | No tags attached. | ||||
|
|
I cannot reproduce the problem. Using your code (expurgated from all the unnecessary rows) I get the following: cdcmd b'GETSCOPERADEC F' 56 resp b'OK! 12.94850 3.26544\r\n' L133 b'GETSCOPERADEC F data b'OK! 12.94850 3.26544\r\n' The F/S parameters where added in January 2020, so be sure you use a beta 4.3 more recent than this date, if possible the last one : https://sourceforge.net/projects/skychart/files/0-beta/ |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 24-08-20 05:06 | Michael C Rushford | New Issue | |
| 24-09-24 13:24 | Patrick Chevalley | Status | new => feedback |
| 24-09-24 13:24 | Patrick Chevalley | Note Added: 0009143 |