View Issue Details

IDProjectCategoryView StatusLast Update
0002747SkyChart1-Softwarepublic24-09-24 13:41
ReporterMichael C Rushford Assigned ToPatrick Chevalley  
PrioritynormalSeverityfeatureReproducibilityalways
Status resolvedResolutionno change required 
PlatformPCOSWindowsOS Version10 64bit
Product Version4.3 beta 
Summary0002747: b'MOVESCOPEH RA:15.994166666666667 Failed! out of range\r\n'
DescriptionPython script can move the chart but not the telescope claiming the small amount I am moving is out of range.

cdcmd b'GETSCOPERADEC'
56 resp b'OK! 15h59m25s +21d28m39s\r\n'
225 RAhor 15
235 RAmin 59
233 RAsec 25
15.990277777777777

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)
Steps To ReproduceFull code:
#!/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('135 data ',data)
    while b'Failed!' not in data:
       obj = ''
       p = data.find('OK!')
       if p>=0 :
         obj = data[p+3:]
       print ('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")
       print
       ##
       # 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:
    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
   
    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 (result)

print ("Close connexion to Skychart")
#s.close()
TagsNo tags attached.

Activities

Patrick Chevalley

24-07-28 07:58

administrator   ~0008977

I think there is a confusion about how this command work, maybe the documentation need to be improved.

MOVESCOPEH do not move the telescope cursor to RA position but to hour angle, declination.
By definition the hour angle is in range -12 to +12 so 15 is out of range.
Also the parameter for this command is RA and DEC in decimal form, without any other text.

For example "MOVESCOPEH -1.0 0.0" show the cursor on the equator, one hour before the meridian.

Use "MOVESCOPE 15.99 +21.47" to show the cursor at a specific RA,DEC.

Do this work for you?

Michael C Rushford

24-07-28 20:25

reporter   ~0008978

Thankyou for helping me understand.
I tried MOVESCOPE no errors reported, it places a camera and field of view position for the telescope on the Sky chart stellar plot but does not move the telescope.
I tried SLEW which did move the telescope.
I am open to other suggestions, my goal is to move the telescope so to make a mosaic following the mosaic file made by Sky Chart.
Thanks

Patrick Chevalley

24-07-28 20:54

administrator   ~0008979

Yes MOVESCOPE name is misleading, it only show a mark on the chart.
This is because this command was added to support telescope mount that not have a standard interface but only a script that can be used to display the telescope position.

SLEW is the right command to move the telescope.
Be careful the coordinates need to be for the equinox of the chart, the precession for the specific telescope driver setting is made by the program.
If you read the coordinates from the mosaic file this is the right one and no conversion is need.
In doubt you can use the command GETCHARTEQSYS that return the chart current setting.

I see in your script comment a link to the command description translated in Spanish and Dutch, be careful this translations are not current and it is better you refer to the English page:
https://www.ap-i.net/skychart/start?id=en/documentation/server_commands#telescope

Michael C Rushford

24-07-28 21:45

reporter   ~0008980

I have this code working to move the telescope both in hardware and on the Sky chart graphic.

#!/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 os
import time
import socket
import math

# default values.
HOST = '127.0.0.1'
PORT = 3292
#SciTechJog east to west 6.7
#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

t = "08h30m42s"
h=t.split('h')
m=t.split('m')
s=t.split('s')
print(h,m,s)
#(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)

HOMEDIR = os.environ['HOMEPATH']
print (HOMEDIR)
# 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('135 data ',data)
    while b'Failed!' not in data:
       obj = ''
       p = data.find('OK!')
       if p>=0 :
         obj = data[p+3:]
       print ('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")
       print
       ##
       # 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 ("L227",HOST, PORT)
s.connect((HOST, PORT))
data = s.recv(1024)
#print ('data ', data )
#
#testcommands()
#
GETSCOPERADEC = cdccmd(b'GETSCOPERADEC')
print ("L235 GETSCOPERADEC = cdccmd(b'GETSCOPERADEC') ",GETSCOPERADEC)
print("L236 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:
    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 ("L253 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
   
    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/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')
    step=0.001
    for P in range(0,3,1):#range(start, stop, step)
        print(P)
        c="SETRA RA:"+RAhor+"h"+RAmin+"m"+str(P)+"s"
        print(c)
        cdccmd(str.encode(c))
        cdccmd(b'REDRAW')
        time.sleep(3)
        c="MOVESCOPE "+ str(float(RAhor)+float(RAmin)/60+float(RAsec)/3600+float(P*step)) + " +" + str(float(DECdeg)+float(DECmin)/60+float(DECsec)/3600)
        print(c)
        cdccmd(str.encode(c))
        cdccmd(b'REDRAW')
        time.sleep(3)
        c="SLEW "+ str(float(RAhor)+float(RAmin)/60+float(RAsec)/3600+float(P*step)) + " +" + str(float(DECdeg)+float(DECmin)/60+float(DECsec)/3600)
        print(c)
        cdccmd(str.encode(c))
        cdccmd(b'REDRAW')
        time.sleep(3)
    for P in range(3,0,-1):#range(start, stop, step)
        c="SETRA RA:"+RAhor+"h"+RAmin+"m"+str(P)+"s"
        print(c)
        cdccmd(str.encode(c))
        cdccmd(b'REDRAW')
        time.sleep(3)
        c="MOVESCOPE "+ str(float(RAhor)+float(RAmin)/60+float(RAsec)/3600+float(P*step)) + " +" + str(float(DECdeg)+float(DECmin)/60+float(DECsec)/3600)
        print(c)
        cdccmd(str.encode(c))
        cdccmd(b'REDRAW')
        time.sleep(3)
        c="SLEW "+ str(float(RAhor)+float(RAmin)/60+float(RAsec)/3600+float(P*step)) + " +" + str(float(DECdeg)+float(DECmin)/60+float(DECsec)/3600)
        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
print ("Close connexion to Skychart")
s.close()

Issue History

Date Modified Username Field Change
24-07-28 06:09 Michael C Rushford New Issue
24-07-28 07:58 Patrick Chevalley Status new => feedback
24-07-28 07:58 Patrick Chevalley Note Added: 0008977
24-07-28 20:25 Michael C Rushford Note Added: 0008978
24-07-28 20:25 Michael C Rushford Status feedback => new
24-07-28 20:54 Patrick Chevalley Note Added: 0008979
24-07-28 21:45 Michael C Rushford Note Added: 0008980
24-09-24 13:41 Patrick Chevalley Assigned To => Patrick Chevalley
24-09-24 13:41 Patrick Chevalley Status new => resolved
24-09-24 13:41 Patrick Chevalley Resolution open => no change required