Commit 04d61a0cb055b83f1af50eff235cba44d0416962

Authored by Alain Klotz
1 parent af870c66
Exists in dev

Serie de mises à jours de mountastro.

mount_tnc/raspberry/config_msc_default.py 0 → 100644
... ... @@ -0,0 +1,71 @@
  1 +home = celme.Home("GPS 2.0975 E 43.631388 158") ; # Telescope valley
  2 +site = celme.Site(home)
  3 +
  4 +# === Mount connection
  5 +mount1 = mountastro.Mountastro("HADEC", name="Default mount", manufacturer="Simulator", model="BasicMount", serial_number="0", site=site, CONTROLLER_BASE_ID=1, CONTROLLER_POLAR_ID=2)
  6 +# --- shortcuts
  7 +mount1_axisb = mount1.axis[mountastro.Mountaxis.BASE]
  8 +mount1_axisp = mount1.axis[mountastro.Mountaxis.POLAR]
  9 +# --- simulation or not
  10 +mount1_axisb.real = False
  11 +mount1_axisb.ratio_wheel_puley = 6.132857 # D=208.0 ; d=32.5 ; f=1.5 ; (D+f/2)/(d+f/2)
  12 +mount1_axisb.inc_per_motor_rev = 1540 # DPR for -490000 to +490000
  13 +mount1_axisb.senseinc = 1
  14 +mount1_axisp.real = False
  15 +mount1_axisp.ratio_wheel_puley = 6.75 # D=208.0 ; d=30.0 ; f=1.5 ; (D+f/2)/(d+f/2)
  16 +mount1_axisp.inc_per_motor_rev = 1421 # DPR for -490000 to +490000
  17 +mount1_axisp.senseinc = -1
  18 +
  19 +# --- Initial ha,dec for encoders
  20 +#mount1_axisb.update_inc0(10750,-90,mount1_axisb.PIERSIDE_POS1)
  21 +mount1.set_param("CONFIGURATION","Fork")
  22 +if mount1.get_param("CONFIGURATION")=="German":
  23 + # --- German mount
  24 + mount1.set_param("LABEL_REGULAR","Tube West") ; # Tube west = PIERSIDE_POS1
  25 + mount1.set_param("LABEL_FLIPED","Tube East")
  26 + mount1.set_param("CAN_REVERSE",True)
  27 + mount1.set_param("LIME_REVERSE",+30) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  28 + mount1.set_param("LIMW_REVERSE",-30) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  29 + mount1_axisb.update_inc0(0,-90,mount1_axisb.PIERSIDE_POS1)
  30 + mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1)
  31 + if mount1_axisb.real == True:
  32 + mount1_axisb.update_inc0(62500,-90,mount1_axisb.PIERSIDE_POS1)
  33 + if mount1_axisp.real == True:
  34 + mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1)
  35 + mount1.park_ha = 270
  36 + mount1.park_dec = 90
  37 + mount1.park_side = mount1_axisb.PIERSIDE_POS1
  38 +elif mount1.get_param("CONFIGURATION")=="Fork":
  39 + # --- Fork mount. Tube always "west" in "auto"
  40 + mount1.set_param("LABEL_REGULAR","Regular") ; # Regular = PIERSIDE_POS1
  41 + mount1.set_param("LABEL_FLIPED","Fliped")
  42 + mount1.set_param("CAN_REVERSE",False)
  43 + mount1.set_param("LIME_REVERSE",+90) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  44 + mount1.set_param("LIMW_REVERSE",-90) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  45 + mount1_axisb.update_inc0(0,0,mount1_axisb.PIERSIDE_POS1)
  46 + mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1)
  47 + if mount1_axisb.real == True:
  48 + mount1_axisb.update_inc0(62500,0,mount1_axisb.PIERSIDE_POS1)
  49 + if mount1_axisp.real == True:
  50 + mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1)
  51 + else:
  52 + mount1_axisp._incsimu = -239793.8
  53 + mount1.park_ha = 0
  54 + mount1.park_dec = 0
  55 + mount1.park_side = mount1_axisb.PIERSIDE_POS1
  56 +
  57 +# --- first read of encoders (zero values the first time)
  58 +incsimus = ["" for kaxis in range(mountastro.Mountaxis.AXIS_MAX)]
  59 +mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)
  60 +# --- second read of encoders (valid values)
  61 +time.sleep(0.05)
  62 +mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)
  63 +# --- Init the simulation values according the real ones
  64 +mount1_axisb.synchro_real2simu()
  65 +# --- Get the initial position
  66 +res = mount1.hadec_coord()
  67 +mount1.log.print("Initial position = {}".format(res))
  68 +
  69 +# ======= parameters
  70 +mount1.speedslew(5.0,5.0)
  71 +mount1.disp()
... ...
mount_tnc/raspberry/config_msc_tm350_guitalens.py 0 → 100644
... ... @@ -0,0 +1,78 @@
  1 +home = celme.Home("GPS 2.0375 E 43.6443484725 136.9")
  2 +site = celme.Site(home)
  3 +
  4 +# === ASTROMECCA connection
  5 +mount1 = mountastro.Mountastro("HADEC", name="Guitalens Mount", manufacturer="Astro MECCA", model="TM350", serial_number="beta001", site=site, CONTROLLER_BASE_ID=1, CONTROLLER_POLAR_ID=2)
  6 +if connect_real_mount == True:
  7 + mount1.set_channel_params("SERIAL", port=port_serial_controller, baud_rate=115200, delay_init_chan=0.1, end_of_command_to_send="\r\n".encode('utf8'), end_of_command_to_receive="\r\n".encode('utf8'), delay_put_read=0.06)
  8 + mount1.verbose_chan = False
  9 +# --- shortcuts
  10 +mount1_axisb = mount1.axis[mountastro.Mountaxis.BASE]
  11 +mount1_axisp = mount1.axis[mountastro.Mountaxis.POLAR]
  12 +# --- simulation or not
  13 +mount1_axisb.real = False
  14 +if connect_real_mount == True:
  15 + mount1_axisb.real = True
  16 +mount1_axisb.ratio_wheel_puley = 6.132857; # 6.27819 ; # 6.32721 ; # D=208.0 ; d=32.5 ; f=1.5 ; (D+f/2)/(d+f/2)
  17 +mount1_axisb.inc_per_motor_rev = 1540 # DPR for -490000 to +490000
  18 +mount1_axisb.senseinc = 1
  19 +mount1_axisp.real = False
  20 +if connect_real_mount == True:
  21 + mount1_axisp.real = True
  22 +mount1_axisp.ratio_wheel_puley = 6.75 ; # 6.75 ; # 6.7462935 ; # D=208.0 ; d=30.0 ; f=1.5 ; (D+f/2)/(d+f/2)
  23 +mount1_axisp.inc_per_motor_rev = 1421
  24 +mount1_axisp.senseinc = -1
  25 +
  26 +# --- Initial ha,dec for encoders
  27 +#mount1_axisb.update_inc0(10750,-90,mount1_axisb.PIERSIDE_POS1)
  28 +mount1.set_param("CONFIGURATION","Fork")
  29 +if mount1.get_param("CONFIGURATION")=="German":
  30 + # --- German mount
  31 + mount1.set_param("LABEL_REGULAR","Tube West") ; # Tube west = PIERSIDE_POS1
  32 + mount1.set_param("LABEL_FLIPED","Tube East")
  33 + mount1.set_param("CAN_REVERSE",True)
  34 + mount1.set_param("LIME_REVERSE",+30) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  35 + mount1.set_param("LIMW_REVERSE",-30) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  36 + mount1_axisb.update_inc0(0,-90,mount1_axisb.PIERSIDE_POS1)
  37 + mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1)
  38 + if mount1_axisb.real == True:
  39 + mount1_axisb.update_inc0(62500,-90,mount1_axisb.PIERSIDE_POS1)
  40 + if mount1_axisp.real == True:
  41 + mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1)
  42 + mount1.park_ha = 270
  43 + mount1.park_dec = 90
  44 + mount1.park_side = mount1_axisb.PIERSIDE_POS1
  45 +elif mount1.get_param("CONFIGURATION")=="Fork":
  46 + # --- Fork mount. Tube always "west" in "auto"
  47 + mount1.set_param("LABEL_REGULAR","Regular") ; # Regular = PIERSIDE_POS1
  48 + mount1.set_param("LABEL_FLIPED","Fliped")
  49 + mount1.set_param("CAN_REVERSE",False)
  50 + mount1.set_param("LIME_REVERSE",+90) ; # Tube west = PIERSIDE_POS1 = [-180 : lim_side_east]
  51 + mount1.set_param("LIMW_REVERSE",-90) ; # Tube east = PIERSIDE_POS2 = [lim_side_west : +180]
  52 + mount1_axisb.update_inc0(0,0,mount1_axisb.PIERSIDE_POS1)
  53 + mount1_axisp.update_inc0(0,90,mount1_axisp.PIERSIDE_POS1)
  54 + if mount1_axisb.real == True:
  55 + mount1_axisb.update_inc0(62500,0,mount1_axisb.PIERSIDE_POS1)
  56 + if mount1_axisp.real == True:
  57 + mount1_axisp.update_inc0(6500,90,mount1_axisp.PIERSIDE_POS1)
  58 + else:
  59 + mount1_axisp._incsimu = -239793.8
  60 + mount1.park_ha = 0
  61 + mount1.park_dec = 0
  62 + mount1.park_side = mount1_axisb.PIERSIDE_POS1
  63 +
  64 +# --- first read of encoders (zero values the first time)
  65 +incsimus = ["" for kaxis in range(mountastro.Mountaxis.AXIS_MAX)]
  66 +mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)
  67 +# --- second read of encoders (valid values)
  68 +time.sleep(0.05)
  69 +mount1.enc2cel(incsimus, save=mount1.SAVE_ALL)
  70 +# --- Init the simulation values according the real ones
  71 +mount1_axisb.synchro_real2simu()
  72 +# --- Get the initial position
  73 +res = mount1.hadec_coord()
  74 +mount1.log.print("Initial position = {}".format(res))
  75 +
  76 +# ======= ASTROMECCA parameters
  77 +mount1.speedslew(5.0,5.0)
  78 +mount1.disp()
... ...
mount_tnc/raspberry/doc_rst/conf.py
... ... @@ -46,8 +46,8 @@ source_suffix = '.rst'
46 46 master_doc = 'index'
47 47  
48 48 # General information about the project.
49   -project = u'astromecca'
50   -copyright = u'2020, astromecca'
  49 +project = u'Mount Control Software'
  50 +copyright = u'2021, astromecca'
51 51 author = u'A. Klotz, A. Cailleau'
52 52  
53 53 # The version info for the project you're documenting, acts as replacement for
... ... @@ -347,7 +347,7 @@ except ModuleNotFoundError:
347 347 pass # no rst2pdf for you
348 348  
349 349 pdf_documents = [
350   - ('index', u'astromecca_software', u'Astromecca software', u'Alain Klotz and Antoine Cailleau'),
  350 + ('index', u'mount_control_software', u'Mount Control Software', u'Alain Klotz and Antoine Cailleau'),
351 351 ]
352 352 # A comma-separated list of custom stylesheets. Example:
353 353 pdf_stylesheets = ['sphinx', 'kerning', 'a4']
... ...
mount_tnc/raspberry/doc_rst/index.rst
1 1 ***************************************************
2   -Welcome in the AstroMecCA software documentation
  2 +Welcome in the AstroMeCCA software documentation
3 3 ***************************************************
4 4  
5 5 .. image:: doc_images/cropped-logo-astromecca.jpg
6   - :height: 200px
  6 + :height: 300px
7 7 :align: center
8 8  
9   -+------------------------------+-----------------------------------+
10   -| | 107, Bis route de Servies | | Director: Antoine Cailleau |
11   -| | En Raynaud | | antoine.cailleau@astromecca.fr |
12   -| | 81570 Cuq les Vielmur | | +33 6 64 45 73 15 |
13   -| | FRANCE | |
14   -+------------------------------+-----------------------------------+
  9 ++------------------------------+--------------------------------------+
  10 +| | 107, Bis route de Servies | | Director: Antoine Cailleau |
  11 +| | En Raynaud | | antoine.cailleau@astromecca.fr |
  12 +| | 81570 Cuq les Vielmur | | +33 6 64 45 73 15 |
  13 +| | FRANCE | | http://astromecca.fr/ |
  14 ++------------------------------+--------------------------------------+
15 15  
16   -.. image:: doc_images/rapido2_v2a.jpg
17   - :height: 200px
  16 +.. figure:: doc_images/rapido2_v2a.jpg
  17 + :height: 300px
18 18 :align: center
19 19  
20   -1. Using the software pad of AstroMecCA
  20 + A German TM 350 AtroMeCCA mount equiped by a reflector 300mm telescope and a refractor 60mm telescope.
  21 +
  22 +1. Using the Mount Control Software
21 23 ***************************************
22 24  
23   -Describes how to use the pad software to slew the mount toword sky objects.
  25 +Describes the basic use of the Mount Control Software and
  26 +how to use its pad to slew the mount towards sky objects.
24 27  
25 28 .. toctree::
26 29 :maxdepth: 3
27 30  
28   - using_astromecca_pad
  31 + using_mount_control_software
29 32  
30 33 2. Communication protocols for AstroMecCA
31 34 *****************************************
... ... @@ -62,6 +65,11 @@ Describe how to instanciate celme classes to use them in a personal Python code.
62 65  
63 66 For developpers of Python code in mount classes.
64 67  
  68 +.. toctree::
  69 + :maxdepth: 3
  70 +
  71 + generate_documentation
  72 +
65 73 The classes of Mounts for astronomy.
66 74  
67 75 .. toctree::
... ...
mount_tnc/raspberry/mount_control_software.py 0 → 100644
... ... @@ -0,0 +1,314 @@
  1 +# -*- coding: utf-8 -*-
  2 +import time
  3 +import socket
  4 +
  5 +import mountastro
  6 +import celme
  7 +import sys
  8 +import os
  9 +
  10 +# #####################################################################
  11 +# #####################################################################
  12 +# #####################################################################
  13 +# Main
  14 +# #####################################################################
  15 +# #####################################################################
  16 +# #####################################################################
  17 +
  18 +if __name__ == "__main__":
  19 +
  20 + RUN_CMDLINE = 0
  21 + RUN_SPYDER = 1
  22 +
  23 + # --- Detect the origin of launch
  24 + if any('SPYDER' in name for name in os.environ)==True:
  25 + runner = RUN_SPYDER
  26 + else:
  27 + runner = RUN_CMDLINE
  28 + hostname = socket.gethostname()
  29 + print("Running from {} on hostname {}".format(runner, hostname))
  30 +
  31 + # --- Set the configuration variables
  32 + if runner == RUN_SPYDER:
  33 + config_path = "./"
  34 + config_mount = "config_msc_default.py"
  35 + connect_real_mount = False ; # True -> port_serial_controller
  36 + server_active = True
  37 + remote_transport = "TCP" ; # SERIAL TCP
  38 + remote_protocol = "ASCOM" ; # LX200 ASCOM MSC
  39 + test_client = True ; # True -> port_serial_remote_client
  40 + use_pad = True ; # True to use the GUI pad
  41 +
  42 + # --- some special computers for dev
  43 + if hostname == "titanium":
  44 + config_mount = "config_msc_tm350_guitalens.py"
  45 +
  46 + # --- Delete the previous objects if they are instanciated
  47 + if 'remote_client' in globals():
  48 + del(remote_client)
  49 + if 'remote_server' in globals():
  50 + del(remote_server)
  51 + time.sleep(1)
  52 + if 'mount1' in globals():
  53 + del(mount1)
  54 + time.sleep(0.5)
  55 +
  56 + # --- Decode the command line arguments and set configuration variables
  57 + if runner == RUN_CMDLINE:
  58 + """
  59 + python3 mount_controle_software.py -pad
  60 + python3 mount_controle_software.py -server -transport TCP -port 1111 -client -client_port 1111 -pad
  61 + python3 mount_controle_software.py -server -transport SERIAL -port //./COM1 -client -client_port //./COM8 -pad
  62 + """
  63 + import argparse
  64 + parser = argparse.ArgumentParser(description='Launch MCS')
  65 + # --- Config
  66 + parser.add_argument('-config_path', action='store', help='Path where configuration files will be read.')
  67 + # --- Controller
  68 + parser.add_argument('-mount_real', action='store_true', help='Connect to a real mount controller. You must specify the -mount_port.')
  69 + parser.add_argument('-mount_port', action='store', help='Port identifier for the connection with a real mount controller -mount_real.')
  70 + # --- Server
  71 + parser.add_argument('-server', action='store_true', help='To activate a server. You must specify the -langage, -transport, -port.')
  72 + parser.add_argument('-langage', action='store', type=str, help='Server langage protocol (LX200, ASCOM, ASTROMECCA).')
  73 + parser.add_argument('-transport', action='store', type=str, help='Server transport protocol (SERIAL, TCP).')
  74 + parser.add_argument('-port', action='store', type=str, help='Port identifier for the server to listen a client.')
  75 + # --- Client
  76 + parser.add_argument('-client', action='store_true', help='To test a client. You must specify the -client_port')
  77 + parser.add_argument('-client_port', action='store', help='Port identifier for the client to dialog with a server.')
  78 + # --- Pad
  79 + parser.add_argument('-pad', action='store_true', help='Display the virtual pad.')
  80 + # ===
  81 + args = parser.parse_args()
  82 + print("Command line args = {}".format(args))
  83 + # ===
  84 + # --- Config
  85 + if args.config_path==None:
  86 + config_path = "./"
  87 + else:
  88 + config_path = str(args.config_path)
  89 + if args.config_path==None:
  90 + config_mount = "config_msc_default.py"
  91 + else:
  92 + config_mount = str(args.config_mount)
  93 + # --- Controller
  94 + if args.mount_real==True:
  95 + connect_real_mount = True
  96 + else:
  97 + connect_real_mount = False
  98 + # ---
  99 + if args.mount_port==None:
  100 + port_serial_controller = "Not defined"
  101 + else:
  102 + port_serial_controller = str(args.mount_port)
  103 + # --- Server
  104 + if args.server==True:
  105 + server_active = True
  106 + else:
  107 + server_active = False
  108 + # ---
  109 + if args.langage==None:
  110 + remote_protocol = "LX200"
  111 + else:
  112 + remote_protocol = str(args.langage)
  113 + # ---
  114 + if args.transport==None:
  115 + remote_transport = "SERIAL"
  116 + else:
  117 + remote_transport = str(args.transport)
  118 + # ---
  119 + if args.port==None:
  120 + port_serial_remote_server = "Not defined"
  121 + else:
  122 + port_serial_remote_server = str(args.port)
  123 + # --- Client
  124 + if args.client==True:
  125 + test_client = True
  126 + else:
  127 + test_client = False
  128 + # ---
  129 + if args.client_port==True:
  130 + port_serial_remote_client = "Not defined"
  131 + else:
  132 + port_serial_remote_client = str(args.client_port)
  133 + # ---
  134 + # --- Pad
  135 + if args.pad==True:
  136 + use_pad = True
  137 + else:
  138 + use_pad = False
  139 +
  140 + # --- Configuration of the communication ports
  141 + if runner == RUN_CMDLINE:
  142 + if remote_transport == "SERIAL" or connect_real_mount==True:
  143 + # --- serial port configurations
  144 + tools = mountastro.Mounttools()
  145 + available_serial_ports = tools.get_available_serial_ports()
  146 + nport = len(available_serial_ports)
  147 +
  148 + if connect_real_mount==True:
  149 + if port_serial_controller not in available_serial_ports:
  150 + print("Mount port {} is not in the available list {}".format(port_serial_controller,available_serial_ports))
  151 + exit(2)
  152 +
  153 + if server_active == True:
  154 + if port_serial_remote_server not in available_serial_ports:
  155 + print("Server listening port {} is not in the available list {}".format(port_serial_remote_server,available_serial_ports))
  156 + exit(2)
  157 + if runner == RUN_SPYDER:
  158 + # --- serial port configurations
  159 + if remote_transport == "SERIAL":
  160 + tools = mountastro.Mounttools()
  161 + available_serial_ports = tools.get_available_serial_ports()
  162 + nport = len(available_serial_ports)
  163 + # --- At minima the server port exists
  164 + if nport<1:
  165 + print("Not enough serial ports for the server")
  166 + exit()
  167 + else:
  168 + port_serial_remote_server=available_serial_ports[0]
  169 + # --- Other ports
  170 + if test_client == True and connect_real_mount == False:
  171 + # --- Case : only client test, no real mount
  172 + port_serial_remote_client=available_serial_ports[1]
  173 + if test_client == False and connect_real_mount == True:
  174 + # --- Case : only real mount, no client test
  175 + port_serial_controller=available_serial_ports[1]
  176 + if test_client == True and connect_real_mount == True:
  177 + # --- Case : real mount and client test
  178 + port_serial_remote_client=available_serial_ports[1]
  179 + port_serial_controller=available_serial_ports[2]
  180 + # === Special computers
  181 + if hostname == "titanium":
  182 + print("Configuration = {}".format(hostname))
  183 + port_serial_remote_server=available_serial_ports[0]
  184 + port_serial_remote_client=available_serial_ports[1]
  185 + port_serial_controller=available_serial_ports[0]
  186 + elif hostname == "rapido2":
  187 + print("Configuration = {}".format(hostname))
  188 + port_serial_controller='/dev/ttyAMA0'
  189 + port_serial_remote_server='/dev/ttyAMA1'
  190 + port_serial_remote_client='/dev/ttyAMA0'
  191 + elif hostname == "astromecca":
  192 + print("Configuration = {}".format(hostname))
  193 + port_serial_controller='/dev/ttySC0'
  194 + port_serial_remote_server='/dev/ttySC1'
  195 + port_serial_remote_client='/dev/ttySC0'
  196 + else:
  197 + print("No predefined configuration for {}".format(hostname))
  198 +
  199 + # --- Launch the program
  200 + if runner == RUN_CMDLINE or runner == RUN_SPYDER:
  201 +
  202 + # --- TCP port configurations
  203 + if remote_transport == "TCP":
  204 + host_tcp_remote_server = socket.gethostname()
  205 + port_tcp_remote_server = 1111
  206 + # === Special computers
  207 + if hostname == "titanium":
  208 + print("Configuration = {}".format(hostname))
  209 + host_tcp_remote_server = '192.168.0.4'
  210 + elif hostname == "rapido2":
  211 + print("Configuration = {}".format(hostname))
  212 + else:
  213 + print("No predefined configuration for {}".format(hostname))
  214 +
  215 + # --- Summary of the configuration
  216 + if server_active == True:
  217 + print("Server transport protocol = {}".format(remote_transport))
  218 + print("Server langage protocol = {}".format(remote_protocol))
  219 + if remote_transport == "SERIAL":
  220 + print("port_serial_remote_server = {}".format(port_serial_remote_server))
  221 + if test_client == True:
  222 + print("port_serial_remote_client = {}".format(port_serial_remote_client))
  223 + else:
  224 + print("host_tcp_remote_server = {}".format(host_tcp_remote_server))
  225 + print("port_tcp_remote_server = {}".format(port_tcp_remote_server))
  226 + if connect_real_mount == True:
  227 + print("port_serial_mount = {}".format(port_serial_controller))
  228 +
  229 + # ======= Read the configuration file of the mount parameters
  230 + config_mount_file = config_path + config_mount
  231 + print("Read the configuration mount file = {}".format(config_mount_file))
  232 + exec(open(config_mount_file).read())
  233 +
  234 + # ======= Transport protocol parameter
  235 + if remote_protocol == "LX200" and remote_transport == "SERIAL":
  236 + bauds = 9600
  237 + else:
  238 + bauds = 115200
  239 +
  240 + # ======= Server
  241 + if server_active == True:
  242 + print("="*30)
  243 + if remote_transport == "SERIAL":
  244 + remote_port = port_serial_remote_server
  245 + else:
  246 + remote_port = port_tcp_remote_server
  247 + msg = "{} server on port {} for protocol {}".format(remote_transport, remote_port, remote_protocol)
  248 + print(msg)
  249 + remote_server = mountastro.MountremoteServer(mount1, remote_transport, port=remote_port, protocol=remote_protocol, verbose_level=1, baud=bauds)
  250 + remote_server.start()
  251 + time.sleep(1)
  252 +
  253 + # The server is non blocking
  254 + # Now you have the hand to send commands to the server
  255 + # To illustrate that, we send a message via a client
  256 +
  257 + print("Type remote_server.stop() to stop the server")
  258 +
  259 + # ======= Client
  260 + if test_client == True:
  261 +
  262 + print("="*30)
  263 + if remote_transport == "SERIAL":
  264 + remote_port = port_serial_remote_client
  265 + else:
  266 + remote_port = port_tcp_remote_server
  267 + msg = "{} client on port {} for protocol {}".format(remote_transport, remote_port, remote_protocol)
  268 + print(msg)
  269 + if remote_transport == "SERIAL":
  270 + remote_client = mountastro.MountremoteClient(remote_transport, port=remote_port, baud=bauds, protocol=remote_protocol, verbose_level=1)
  271 + else:
  272 + remote_client = mountastro.MountremoteClient(remote_transport, hostname=host_tcp_remote_server, port=remote_port, protocol=remote_protocol, verbose_level=1)
  273 + remote_client.open_chan()
  274 + print("="*30)
  275 + if remote_protocol == "LX200":
  276 + command = ':GR'
  277 + result = remote_client.putread_chan(command)
  278 + print("Command = {}\nResult = {}".format(command,result))
  279 + print("="*30)
  280 + command = '#:GD#'
  281 + result = remote_client.putread_chan(command)
  282 + print("Command = {}\nResult = {}".format(command,result))
  283 + elif remote_protocol == "ASTROMECCA":
  284 + command = "{'req': {'get': ''}}"
  285 + result = remote_client.putread_chan(command)
  286 + print("Command = {}\nResult = {}".format(command,result))
  287 + print("="*30)
  288 + command = "{'req': {'get': 'radec'}}"
  289 + result = remote_client.putread_chan(command)
  290 + print("Command = {}\nResult = {}".format(command,result))
  291 + elif remote_protocol == "ASCOM":
  292 + command = 'RightAscension'
  293 + result = remote_client.putread_chan(command)
  294 + print("Command = {}\nResult = {}".format(command,result))
  295 + print("="*30)
  296 + command = 'Declination'
  297 + result = remote_client.putread_chan(command)
  298 + print("Command = {}\nResult = {}".format(command,result))
  299 + print("="*30)
  300 +
  301 + # ======= pad
  302 + if use_pad == True:
  303 + try:
  304 + print("Create the pad. Tk Event loop activated.")
  305 + mount1.pad_create("pad_dev1")
  306 + print("Pad deleted. Tk Event loop stopped")
  307 + except (KeyboardInterrupt, SystemExit):
  308 + pass
  309 + except:
  310 + raise
  311 +
  312 + # To stop the server:
  313 + # remote_server.stop()
  314 +
... ...
mount_tnc/raspberry/mountastro/mountastro.py
... ... @@ -16,10 +16,10 @@ if modulename in dir():
16 16 if modulename not in dir():
17 17 import celme
18 18  
19   -from mountaxis import Mountaxis
20   -from mounttools import Mounttools
21   -from mountlog import Mountlog
22   -from mountpad import Mountpad
  19 +from .mountaxis import Mountaxis
  20 +from .mounttools import Mounttools
  21 +from .mountlog import Mountlog
  22 +from .mountpad import Mountpad
23 23  
24 24 # #####################################################################
25 25 # #####################################################################
... ... @@ -1975,7 +1975,7 @@ class Mountastro(Mounttools):
1975 1975 self._lx200_precision = self.LX200_LOW_PRECISION
1976 1976 else:
1977 1977 self._lx200_precision = self.LX200_HIGH_PRECISION
1978   - if self._remote_command_protocol=="ASTROMECCA":
  1978 + if self._remote_command_protocol=="MSC":
1979 1979 # --- Split the string to a list of dictionaries
1980 1980 # String example : command = {"req":{"cmd":{"PRESET":5}}}{"req":{"get": ""}}}
1981 1981 # List of dictionaries : commands = ['{"req":{"cmd":{"PRESET":5}}}', '{"req":{"get": ""}}']
... ...
mount_tnc/raspberry/mountastro/mountastro_astromecca.py
... ... @@ -13,10 +13,10 @@ if modulename in dir():
13 13 if modulename not in dir():
14 14 import celme
15 15  
16   -from mountastro import Mountastro
17   -from mountaxis import Mountaxis
18   -from mountchannel import Mountchannel
19   -from mountutils_eqmod import Mountutils_eqmod
  16 +from .mountastro import Mountastro
  17 +from .mountaxis import Mountaxis
  18 +from .mountchannel import Mountchannel
  19 +from .mountutils_eqmod import Mountutils_eqmod
20 20  
21 21 # #####################################################################
22 22 # #####################################################################
... ...
mount_tnc/raspberry/mountastro/mountaxis.py
... ... @@ -3,7 +3,7 @@ import time
3 3 import math
4 4  
5 5 import os
6   -from mounttools import Mounttools
  6 +from .mounttools import Mounttools
7 7  
8 8 # #####################################################################
9 9 # #####################################################################
... ...
mount_tnc/raspberry/mountastro/mountpad.py
... ... @@ -10,7 +10,7 @@ if modulename in dir():
10 10 if modulename not in dir():
11 11 import celme
12 12  
13   -from mounttools import Mounttools
  13 +from .mounttools import Mounttools
14 14  
15 15 # #####################################################################
16 16 # #####################################################################
... ...
mount_tnc/raspberry/mountastro/mountremote.py
... ... @@ -7,10 +7,10 @@ from threading import Thread, Event
7 7 #from threading import RLock
8 8 import select, queue
9 9  
10   -from mountastro import Mountastro
11   -from mountchannel import Mountchannel
12   -from mountaxis import Mountaxis
13   -from mounttools import Mounttools
  10 +from .mountastro import Mountastro
  11 +from .mountchannel import Mountchannel
  12 +from .mountaxis import Mountaxis
  13 +from .mounttools import Mounttools
14 14  
15 15 # --- celme imports
16 16 modulename = 'celme'
... ...