Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gnthibault committed Aug 13, 2023
2 parents 11c697d + c1b585e commit 9a79569
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 80 deletions.
19 changes: 19 additions & 0 deletions Camera/IndiASICamera290MMMini.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Basic stuff
import numpy as np

# Local stuff
from Camera.IndiASICamera import IndiASICamera
from Camera.IndiASICameraNonCool import IndiASICameraNonCool

class IndiASICamera290MMMini(IndiASICameraNonCool):
def __init__(self, serv_time, config=None,
connect_on_create=True):

# Parent initialization
super().__init__(
serv_time=serv_time,
config=config,
connect_on_create=connect_on_create)

def set_offset(self, value):
pass
7 changes: 1 addition & 6 deletions Camera/IndiAbstractCameraSimulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ def initialize_simulation_setup(self):

def unpark(self):
IndiAbstractCamera.unpark(self)
self.initialize_simulation_setup()

def set_cooling_on(self):
# This feels like a bug from the simulator ...
self.logger.warning(f"set_cooling_on working in async mode, as it seems to be a bug in simulator implementation")
self.set_switch('CCD_COOLER', ['COOLER_ON'], sync=False, timeout=self.defaultTimeout)
self.initialize_simulation_setup()
3 changes: 2 additions & 1 deletion Camera/IndiCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ def set_temperature(self, temperature):
sync=True, timeout=1200)

def set_cooling_on(self):
self.set_switch('CCD_COOLER', ['COOLER_ON'], sync=True, timeout=self.defaultTimeout)
# No sync, because that's the way it works on indi for the CCD_COOLER property, it stays yellow in the interface
self.set_switch('CCD_COOLER', ['COOLER_ON'], sync=False)

def set_cooling_off(self):
self.set_switch('CCD_COOLER', ['COOLER_OFF'], sync=True, timeout=self.defaultTimeout)
Expand Down
16 changes: 6 additions & 10 deletions Mount/IndiAbstractMount.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ def _setup_abstract_config(self):
###############################################################################
# Mandatory overriden methods
###############################################################################
def initialize(self, *arg, **kwargs): # pragma: no cover
self.logger.debug(f"Initializing mount with args {arg}, {kwargs}")
self.connect()
self._is_initialized = True

def initialize(self):
self.logger.debug("Initializing from IndiAbstractMount")
IndiMount.unpark(self)
self.logger.debug("Successfully initialized from IndiAbstractMount")

def park(self):
""" Slews to the park position and parks the mount.
Expand Down Expand Up @@ -129,15 +130,10 @@ def unpark(self):
self.start_indi_driver()
self.connect(connect_device=True)
self.initialize()
self._is_initialized = False
self._is_initialized = True
self._is_parked = False
self.logger.debug(f"Mount {self.device_name} successfully unparked")

def initialize(self):
self.logger.debug("Initializing from IndiAbstractMount")
IndiMount.unpark(self)
self.logger.debug("Successfully initialized from IndiAbstractMount")

def slew_to_coord(self, coord):
self.slew_to_coord_and_track(coord)

Expand Down
4 changes: 2 additions & 2 deletions Mount/IndiG11.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def initialize(self):
#TODO TN URGENT as a temporary fix. we decided to park at startup but
# the proper behaviour for the mount should be parked status by default
# at startup, see https://indilib.org/forum/general/5497-indi-losmandy-driver-impossible-to-get-proper-park-status.html#41664
IndiMount.park(self)
IndiMount.unpark(self)
self.logger.debug("Successfully initialized from IndiG11")

def set_time_config(self):
Expand Down Expand Up @@ -308,4 +308,4 @@ def set_park_settings(self, mode='HOME'):
def set_coord(self, coord):
IndiMount.set_coord(self, coord)
# Wait for the mount/tube to damper vibrations
time.sleep(5)
time.sleep(10)
11 changes: 6 additions & 5 deletions Observatory/AggregatedCustomScopeController.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,13 @@ def park(self):
self.logger.debug("Parking")

# Power acquisition instruments: this is a very specific case, see https://github.com/indilib/indi-3rdparty/issues/822
self.upbv2.power_off_acquisition_equipments()
time.sleep(1)
self.upbv2.switch_off_acquisition_equipments_usb()
if self.is_initialized:
self.upbv2.power_off_acquisition_equipments()
time.sleep(1)
self.upbv2.switch_off_acquisition_equipments_usb()

# Deinitialize arduino servo first (as it relies on upb power)
self.arduino_servo_controller.park()
# Deinitialize arduino servo first (as it relies on upb power)
self.arduino_servo_controller.park()

# Deinitialize upbv2
self.upbv2.park()
Expand Down
34 changes: 19 additions & 15 deletions conf_files/config_backyard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ mount:
indi_port : 7625
cameras:
-
module: IndiASICameraNonCool
module: IndiASICamera290MMMini
camera_name : ZWO CCD ASI290MM Mini
do_acquisition: false
SCOPE_INFO: # 200/800 newtonian
FOCAL_LENGTH: 800
APERTURE: 200
sampling_arcsec: 0.88
do_guiding: true
do_pointing: true
pointing_seconds: 40
do_pointing: false
pointing_seconds: 30
do_adjust_pointing: true
adjust_center_x: 877
adjust_center_y: 637
Expand All @@ -174,14 +174,19 @@ cameras:
autofocus_merit_function: half_flux_radius
indi_client :
indi_host : localhost
indi_port : 7625
indi_port : 7627
#use_unique_client: True
indi_webmanager:
module: IndiWebManagerClient
host: localhost
port: 8627
profile_name: zwo_guiding
-
module: IndiPlayerOneCamera
camera_name : PlayerOne CCD Ares-M PRO
indi_driver_name: PlayerOne CCD
do_acquisition: true
working_temperature: -12
working_temperature: 10
SCOPE_INFO: # 200/800 newtonian
FOCAL_LENGTH: 800
APERTURE: 200
Expand Down Expand Up @@ -248,7 +253,7 @@ cameras:
sampling_arcsec: 1.88
subsample_astrometry: 4
do_guiding: false
do_pointing: false
do_pointing: true
pointing_seconds: 10
do_adjust_pointing: false
adjust_center_x: 400
Expand All @@ -261,16 +266,20 @@ cameras:
autofocus_merit_function: half_flux_radius #vollath_F4
indi_client:
indi_host: localhost
indi_port: 7625

indi_port: 7628
indi_webmanager:
module: IndiWebManagerClient
host: localhost
port: 8628
profile_name: altair_pointing
pointer:
module: IterativeSync #DifferentialPointer #IterativeSync
gen_hips: False
timeout_seconds: 900
max_iterations: 10
max_pointing_error_seconds: 10
offset_pointer:
module: StarOffsetPointer #StarOffsetPointer #NoOffsetPointer
module: StarOffsetPointer #StarOffsetPointer #NoOffsetPointer #InvisibleOffsetPointer
timeout_seconds: 300
max_identification_error_seconds: 1
sync_mount_upon_solve: True
Expand All @@ -282,7 +291,7 @@ guider:
port : 4400
do_calibration : False
profile_name : backyard
exposure_time_sec : 2
exposure_time_sec : 8
settle :
pixels : 3
time : 10
Expand Down Expand Up @@ -342,11 +351,6 @@ paws_publisher:
mqtt_port: 1883
com_mode: publisher
msg_port: 6500
indi_webmanager:
module: IndiWebManagerClient
host: localhost
port: 8624
profile_name: full_setup
#independant_services:
# -
# module: NasaGCNService
Expand Down
63 changes: 35 additions & 28 deletions conf_files/spectral_targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,48 @@ constraints :
maxairmass : 17 #for testing, normally use 2
minmoonseparationdeg : 2 # normally put 45
targets :
# "Altair" : #HD214680 #HD222404
"Altair" : #HD214680 #HD222404
priority : 0
count : 1
temperature : 10
gain: 150
offset: 30
exp_time_sec : 20
"Arcturus":
priority: 0
count: 1
temperature: 15
gain: 150
offset: 30
exp_time_sec: 20
"10 Lacertae": #HD214680 #HD222404
priority: 0
count: 1
temperature: 15
gain: 150
offset: 30
exp_time_sec: 20
"Gamma Cassiopeiae" :
priority : 0
count : 2
temperature : 10
gain: 150
offset: 30
exp_time_sec : 5
# "T CrB" :
# priority : 0
# count : 1
# temperature : 15
# temperature : 10
# gain: 150
# offset: 30
# exp_time_sec : 20
# "Arcturus":
# priority: 0
# count: 1
# temperature: 15
# gain: 150
# offset: 30
# exp_time_sec: 20
# "10 Lacertae": #HD214680 #HD222404
# priority: 0
# count: 1
# temperature: 15
# gain: 150
# offset: 30
# exp_time_sec: 20
# "T CrB" :
# "V375 Lac" :
# priority : 0
# count : 1
# temperature : 15
# count : 2
# temperature : 10
# gain: 150
# offset: 30
# exp_time_sec : 20
"V375 Lac" :
priority : 0
count : 2
temperature : 15
gain: 150
offset: 30
exp_time_sec : 5
# exp_time_sec : 5
# "GK Per":
# priority: 0
# count: 2
Expand All @@ -47,7 +54,7 @@ targets :
# exp_time_sec: 5
reference_observation:
count : 10
temperature : 15
temperature : 10
gain : 150
offset: 30
exp_time_sec : 20
Expand Down
2 changes: 1 addition & 1 deletion helper/IndiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, config):

self.indi_webmanager_client = IndiWebManagerDummy()
if "indi_webmanager" in config:
self.indi_webmanager_client = IndiWebManagerClient(config)
self.indi_webmanager_client = IndiWebManagerClient(config["indi_webmanager"])

# Start the main ioloop that will serve all async task in another (single) thread
self.device_subscriptions = {} # dict of device_name: coroutines
Expand Down
18 changes: 15 additions & 3 deletions helper/IndiDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Indi stuff
from helper.device import device, VectorHandler
from helper.IndiWebManagerClient import IndiWebManagerClient

#Local
from Base.Base import Base
Expand Down Expand Up @@ -171,8 +172,10 @@ def _setup_indi_client(self):
try:
self.logger.debug(f"Setting up indi client")
self.indi_client = IndiClient(config=self.indi_client_config)
except Exception:
raise RuntimeError('Problem setting up indi client')
except Exception as e:
msg = f"Problem setting up indi client for device {self.device_name}: {e}"
self.logger.error(msg)
raise RuntimeError(msg)

def connect_client(self):
"""
Expand Down Expand Up @@ -231,8 +234,18 @@ def is_connected(self):
return False

def stop_indi_server(self):
# We could simply do like that:
# if self.indi_client is None:
# self._setup_indi_client()
# self.indi_client.indi_webmanager_client.start_server()
# But then in case of stopping, it could consume ressources for no reason
if self.indi_client is not None:
self.indi_client.indi_webmanager_client.stop_server()
else:
# Setup temporary webmanager client
if "indi_webmanager" in self.indi_client_config:
iwmc = IndiWebManagerClient(self.indi_client_config["indi_webmanager"])
iwmc.stop_server()

def start_indi_server(self):
if self.indi_client is None:
Expand All @@ -244,7 +257,6 @@ def start_indi_driver(self):
driver_name=self.indi_driver_name,
check_started=True)


def get_switch(self, name):
return self.get_vector_dict(name)

Expand Down
Loading

0 comments on commit 9a79569

Please sign in to comment.