×

INDI Library v1.8.0 is Released (27 Jul 2019)

INDI Library v1.8.0 is mostly a maintenance release to fix a few bugs in several drivers.

Full Automation and Weather handling in the Scheduler

  • Posts: 265
  • Karma: 5
  • Thank you received: 79

Replied by sterne-jaeger on topic Full Automation and Weather handling in the Scheduler

Hi Hans,
that sounds like an excellent idea! Just one thing: please try to implement weather handling standalone and do not try to squeeze it into the scheduler. We plan to rework the scheduler currently, since it is a huge and awfully complex class.

It should be easy to change the scheduler in such a way that it can be started/stopped/aborted/paused/... from outside. That could be a way to let the two modules easily cooperate without deeply intertwining them.

And please try to consider automated tests from the very beginning.

If you need help, do not hesitate...

- Wolfgang
The following user(s) said Thank You: knro, El Corazon, Ron Kramer
3 months 2 weeks ago #38719

Please Log in or Create an account to join the conversation.

  • Posts: 326
  • Thank you received: 50

Replied by Ron Kramer on topic Full Automation and Weather handling in the Scheduler

I haven't used the scheduler much yet - but this is a necessity for me as well. I THOUGHT the weather watcher was already capable of doing this? IT won't allow me to open if cloudy, but you're saying it won't shut down and park/close?

I have a script that I run from windows. Is there something similar that I can run from linux?
The cloud watcher flags unsafe/clouds or whatever to its data file.
Is there a way to read that file during sub acquisition and abort or wait until (between exposures) to check that file and run a shut down/close up script?

I use to leave SGP running and go to bed - no worries. It would always be closed in the morning because even daylight is unsafe. So it would close at dawn.

So the dat file is written every minute with this format - Really it could look only at SAFE or UNSAFE and close up if unsafe. The rest could be ignored
since unsafe is flagged in the event of any of the other values aren't in the GREEN zone.

"2019-05-03","18:07:21","Cloudy","Dry","Very light","1.2","15.9","4014","1","15.9","10%","21.0","","Closed","5","0","Unsafe","Calm","3.0","Humid","77%"

Maybe you're not referring to Weather Watcher driver? What about watch dog? Can it watch the dat file from the cloud watcher and close up?

This was my windows .vbs script file.
dim dome
set dome = CreateObject( "POTH.dome" )
call dome.CloseShutter()
set dome = nothing

The cloudwatcher software would call the script. But I can't run the cloudwatcher software under linux.
I could run the cloudwatcher software on the desktop running Kstars in the house, but it would have to send a command to the nexdome driver to close.
AP Mach1 / CP4 APCC & PEMpro.
EXP SCI - ED152cf APO - Celestron 11" RASA - Stellarvue 80mm
Baader F2 HS NB filters, Lodestar X2 guide camera / OAG - ZWO 290mm mini
ZWO ASI1600MM Pro / ASI174M (solar) / ASI094MC
NEXDome, CLoudwatcher, AVX mount/ASIair and Stellarmate

Last edit: 3 months 2 weeks ago by Ron Kramer.
3 months 2 weeks ago #38751

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 20

Replied by H__ on topic Full Automation and Weather handling in the Scheduler

Hi Ferrante,

fenriques wrote: I could provide some help defining and testing use cases if needed.


To get this started without having to change anything in EKOS I've written ekos_sentinel.py. It basically adds what is missing today :
weather safe ?
yes:
    scheduler running ?
    yes:
        ok
    no:
        start scheduler
no:
    scheduler running ?
    yes:
        stop scheduler
        park mount
        close roof
        warm ccd
    no:
        ok

When EKOS gets bad-weather-shutdown handling itself this external daemon can still prove useful as it can be made into a safeguard for when EKOS crashes or locks up. So I intend to maintain it.
Code lives at https://github.com/d33psky/rolloffroof/tree/master/ekos

Here's my 3th test run log (I went to sleep around 03:00 :) ) :
./ekos_sentinel.py --indi_host localhost
2019-05-01 02:45:51,250 ekos_sentinel INFO     weather is safe, roof is closed, start ekos scheduler
Start scheduler
2019-05-01 02:46:51,306 ekos_sentinel INFO     weather is safe, roof is open
...
2019-05-01 03:32:53,546 ekos_sentinel INFO     weather is safe, roof is open
2019-05-01 03:33:53,565 ekos_sentinel WARNING  weather is unsafe, roof is open, stop ekos scheduler
Stop scheduler
2019-05-01 03:33:53,567 ekos_sentinel WARNING  park mount
2019-05-01 03:33:54,583 ekos_sentinel WARNING  close roof
2019-05-01 03:34:51,630 ekos_sentinel WARNING  warm camera
2019-05-01 03:34:51,651 ekos_sentinel WARNING  failed to warm the camera, this is not critical to safety so just continue
2019-05-01 03:35:51,725 ekos_sentinel INFO     weather is unsafe, roof is closed

It did the critical things right; stop the EKOS scheduler, park the mount, park the roof, but it failed to warm the camera. I'll work on that of course ;-)
I also need to add cap support, and allow for a flexible shutdown order as that is really observatory dependent. I also should replace calling indi_getprop and indi_setprop with the Python pyindi-client, which I learned existed only today.

The interfacing with EKOS goes via DBUS and there's things in EKOS that can be improved as well like query capabilities (assuming DBUS even allows for that).

-- Hans
The following user(s) said Thank You: Gonzothegreat, fenriques
3 months 2 weeks ago #38752

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 25

Replied by fenriques on topic Full Automation and Weather handling in the Scheduler

thanks Hans,
Seems perfect. I will give it a try. Btw I see that we share part of the equipment (10Micron, ASI).
A few questions:
- the workflow manages the scheduler to start if the weather is ok. But also resumes a job if after a break the weather returns ok? it seems it doesn't.
- I guess it should be run with a command like:
python3 ./ekos_sentinel.py 192.168.xxx.xxx --options
Can you provide a simple start command line please?
- For my setup I'll add some time delays (sleep), for example my roof hits the mount if it is not yet parked (I have parking sensors, but better be safe). It would be nice to have also a fixed number of retries, e.g. try to warm up the camera for 3 times before issuing a warning.

Ferrante
3 months 2 weeks ago #38758

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 20

Replied by H__ on topic Full Automation and Weather handling in the Scheduler

Hi Wolfgang,

sterne-jaeger wrote: please try to implement weather handling standalone and do not try to squeeze it into the scheduler. We plan to rework the scheduler currently, since it is a huge and awfully complex class.

The scheduler class would certainly benefit from refactoring. Is your rework started somewhere yet ? Branch/posts/chat ?

It should be easy to change the scheduler in such a way that it can be started/stopped/aborted/paused/... from outside. That could be a way to let the two modules easily cooperate without deeply intertwining them.

Agreed. As a quick hack I've already used what's available via DBUS today from a python script. Should such a weather or safety (broader) tab use DBUS to instruct the scheduler or should we use plain C++ class methods ?

And please try to consider automated tests from the very beginning.
If you need help, do not hesitate...

I will definitely need help. I'll first continue reading up on kstars code to see if it speaks to me ;-)


-- Hans
Last edit: 3 months 2 weeks ago by H__. Reason: spacing
3 months 2 weeks ago #38776

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 20

Replied by H__ on topic Full Automation and Weather handling in the Scheduler

Hi Ron,

Ron Kramer wrote: I haven't used the scheduler much yet - but this is a necessity for me as well. I THOUGHT the weather watcher was already capable of doing this? IT won't allow me to open if cloudy, but you're saying it won't shut down and park/close?

Exactly. And scary.

I have a script that I run from windows. Is there something similar that I can run from linux?

I see several weather related drivers in INDI, and I added one myself too : Weather Safety Proxy https://indilib.org/devices/weather-stations/weather-safety-proxy.html .

The cloud watcher flags unsafe/clouds or whatever to its data file.
Is there a way to read that file during sub acquisition and abort or wait until (between exposures) to check that file and run a shut down/close up script?

For this you can probably best use the Weather Watcher https://indilib.org/devices/weather-stations/weather-watcher.html as you have several weather measurement values.

I use to leave SGP running and go to bed - no worries. It would always be closed in the morning because even daylight is unsafe. So it would close at dawn.

That's my goal as well. And the weather safety service I wrote (which the weather safety proxy polls) also considers daylight to be unsafe.

So the dat file is written every minute with this format - Really it could look only at SAFE or UNSAFE and close up if unsafe. The rest could be ignored
since unsafe is flagged in the event of any of the other values aren't in the GREEN zone.
"2019-05-03","18:07:21","Cloudy","Dry","Very light","1.2","15.9","4014","1","15.9","10%","21.0","","Closed","5","0","Unsafe","Calm","3.0","Humid","77%"

If you want to only use Safe/Unsafe then using the Weather Safety Proxy does make sense, but you'll have to write a script (or rest API endpoint) that translates the Safe/Unsafe from that dat line to JSON format.

What about watch dog? Can it watch the dat file from the cloud watcher and close up?

It can not afaik. The watch dog only monitors if the indiserver has working clients connected to it (think of a networked INDI setup with indiserver close to the gear and some indi client elsewhere connecting to it over a network).

This was my windows .vbs script file.
dim dome
set dome = CreateObject( "POTH.dome" )
call dome.CloseShutter()
set dome = nothing

The cloudwatcher software would call the script. But I can't run the cloudwatcher software under linux.
I could run the cloudwatcher software on the desktop running Kstars in the house, but it would have to send a command to the nexdome driver to close.

You could use the ekos_sentinel.py for the mean time.

-- Hans
3 months 2 weeks ago #38777

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 20

Replied by H__ on topic Full Automation and Weather handling in the Scheduler

Hi Ferrante,

fenriques wrote: thanks Hans,
Seems perfect. I will give it a try. Btw I see that we share part of the equipment (10Micron, ASI).

Oh cool !

A few questions:
- the workflow manages the scheduler to start if the weather is ok.

Yes, that's what the scheduler does today (once). And what ekos_sentinel.py does too (continually).

But also resumes a job if after a break the weather returns ok? it seems it doesn't.

When safe weather returns later during the night ekos_sentinel.py will start the scheduler again.

- I guess it should be run with a command like:
<code>python3 ./ekos_sentinel.py 192.168.xxx.xxx --options</code>
Can you provide a simple start command line please?

I use it like this :
./ekos_sentinel.py --indi_host localhost
But there's several settings hardcoded in the script that all need to be parameterized :
INDI_DOME_PARK_PROPERTY = 'Dome Scripting Gateway.DOME_PARK.PARK'
INDI_DOME_PARK_PROPERTY_PARK_SETTING = 'On'
INDI_WEATHER_PROPERTY = 'Weather Meta.WEATHER_STATUS.STATION_STATUS'
INDI_WEATHER_PROPERTY_OK_SETTING = 'Ok'
WEATHER_META_STATION_INDEXES = {1, 2}
INDI_MOUNT_PARK_PROPERTY = '10micron.TELESCOPE_PARK.PARK'
INDI_MOUNT_PARK_PROPERTY_PARK_SETTING = 'On'
INDI_CAMERA_COOLER_PROPERTY = 'ZWO CCD ASI1600MM-Cool.CCD_COOLER_POWER.CCD_COOLER_VALUE'
INDI_CAMERA_COOLER_PROPERTY_OFF_SETTING = '0'
MAIN_LOOP_SLEEP_SECONDS = 60
INDI_COMMAND_SEND_TIMEOUT = 5
MOUNT_PARK_TIMEOUT = 60
ROOF_CLOSE_TIMEOUT = 60

Python's argumentparser provides for some documentation :
./ekos_sentinel.py --help
usage: ekos_sentinel.py [-h] [--debug] [--once] --indi_host INDI_HOST

Ekos Sentinel

optional arguments:
  -h, --help            show this help message and exit
  --debug               enable debug level verbosity
  --once                run only once, useful for debugging
  --indi_host INDI_HOST
                        INDI server address

- For my setup I'll add some time delays (sleep), for example my roof hits the mount if it is not yet parked (I have parking sensors, but better be safe).

My mount can hit the roof too. And I found a bug; the roof starts closing when the mount is still parking :/ I'm glad the 10micron move park fast and my roof is slow :-D There's already a poll loop in there that is supposed to wait for that event. I'll fix that next.

It would be nice to have also a fixed number of retries, e.g. try to warm up the camera for 3 times before issuing a warning.

Makes sense. I'll add that.

-- Hans
3 months 2 weeks ago #38779

Please Log in or Create an account to join the conversation.

  • Posts: 118
  • Thank you received: 25

Replied by fenriques on topic Full Automation and Weather handling in the Scheduler

Hi Ron and Hans,
for sure the Scheduler is not managing shutdown triggered by weather conditions as of today, but the Weather and Dome drivers are managing that.
I tested right now with WeatherWatcher and it works. There's just some configuration to take care of:
- In your Dome driver you should enable the AutoPark switch.
- in your Dome driver enter 'Weather Watcher' (or other driver) in Option->Snoop Devices -> Weather. Think that capital letters and spaces matter.
- Restart Ekos. I think the server doesn't need to be restarted.
- As a test, in Weather Watcher Parameters, lower the temp threshold to a lower value.

Note: this works for the roof driver that I wrote myself (Talon6 RoR) and Weather Watcher. But the AutoPark feature is written in the Dome parent class, so should work for every driver.

Ferrante

EDIT: I know this is a partial solution and not a full shutdown/resume procedure, it just parks the dome. For more advanced solutions there's Hans's python script or the next version of the Scheduler.
Last edit: 3 months 2 weeks ago by fenriques.
3 months 2 weeks ago #38785

Please Log in or Create an account to join the conversation.

  • Posts: 265
  • Karma: 5
  • Thank you received: 79

Replied by sterne-jaeger on topic Full Automation and Weather handling in the Scheduler

H__ wrote: The scheduler class would certainly benefit from refactoring. Is your rework started somewhere yet ? Branch/posts/chat ?

Indeed, but it's in a very early stage. See here: indilib.org/forum/development/5137-parti...-scheduler-code.html

-Wolfgang
3 months 2 weeks ago #38790

Please Log in or Create an account to join the conversation.

  • Posts: 364
  • Thank you received: 64

Replied by dokeeffe on topic Full Automation and Weather handling in the Scheduler

Sorry I'm late to this conversation. I'm a bit confused. The scheduler used to monitor the weather while running and run the shutdown procedure if clouds or rain came in.
Is this feature now not in the scheduler?
Does anyone know what version it was removed in? I'll need to go back to that version. Currently I cant use my observatory without this feature.

Thanks,
Derek
Celestron CPC1100 Atik 383L
HP8300 Elite i5 running Xubuntu, Indi, Kstars & Ekos
Roll off roof observatory
Battling Irish weather
github.com/dokeeffe
twitter.com/BallyhouraStars
3 months 2 weeks ago #38796

Please Log in or Create an account to join the conversation.

  • Posts: 44
  • Thank you received: 20

Replied by H__ on topic Full Automation and Weather handling in the Scheduler

H__ wrote:

fenriques wrote: - For my setup I'll add some time delays (sleep), for example my roof hits the mount if it is not yet parked (I have parking sensors, but better be safe).

My mount can hit the roof too. And I found a bug; the roof starts closing when the mount is still parking :/ I'm glad the 10micron move park fast and my roof is slow :-D There's already a poll loop in there that is supposed to wait for that event. I'll fix that next.

This is fixed now. (I forgot that you cannot ask INDI if a mount *is* parked, you have to look at things like park coordinates and tracking)

H__ wrote:

fenriques wrote: It would be nice to have also a fixed number of retries, e.g. try to warm up the camera for 3 times before issuing a warning.

Makes sense. I'll add that.

This is added.


I've also made all functions available from the command line for individual testing, and added cap support. This is the documentation so far :
./ekos_sentinel.py --help
usage: ekos_sentinel.py [-h] --indi_host INDI_HOST
                        [--indi_command_retries INDI_COMMAND_RETRIES]
                        [--debug] [--once] [--get_weather_safety]
                        [--get_mount_safety] [--get_cap_safety]
                        [--get_roof_safety] [--park_mount] [--close_cap]
                        [--close_roof] [--warm_camera]

EKOS Sentinel, version 1.0 .
EKOS scheduler in Kstars 3.2.0 waits for good weather before opening the observatory,
but does not close down when weather gets bad. That's where this script aims to help.

loop:
    weather safe ?
    yes:
        scheduler running ?
        yes:
            ok
        no:
            start scheduler
    no:
        scheduler running ?
        yes:
            stop scheduler
            park mount
            close cap
            close roof
            warm ccd
        no:
            ok

Instead of 'scheduler running ?' we have to use 'roof closed ?' for now.
Modify the static config in this script for your setup.

optional arguments:
  -h, --help            show this help message and exit
  --indi_host INDI_HOST
                        INDI server address
  --indi_command_retries INDI_COMMAND_RETRIES
                        try INDI commands this amount of times before giving
                        up, defaults to 1
  --debug               enable debug level verbosity
  --once                run only once, useful for debugging
  --get_weather_safety  for testing: only call get_weather_safety
  --get_mount_safety    for testing: only call get_mount_safety
  --get_cap_safety      for testing: only call get_cap_safety
  --get_roof_safety     for testing: only call get_roof_safety
  --park_mount          for testing: only call park_mount
  --close_cap           for testing: only call close_cap
  --close_roof          for testing: only call close_roof
  --warm_camera         for testing: only call warm_camera

Only --indi-host is required for normal operation, the rest is for debugging and testing

-- Hans
The following user(s) said Thank You: dokeeffe, fenriques
3 months 2 weeks ago #38799

Please Log in or Create an account to join the conversation.

  • Posts: 364
  • Thank you received: 64

Replied by dokeeffe on topic Full Automation and Weather handling in the Scheduler

Hans,
Thank you!! Just looking at your ekos_sentinel script and the EkosDbus. This looks really good!!
Derek
Celestron CPC1100 Atik 383L
HP8300 Elite i5 running Xubuntu, Indi, Kstars & Ekos
Roll off roof observatory
Battling Irish weather
github.com/dokeeffe
twitter.com/BallyhouraStars
3 months 2 weeks ago #38800

Please Log in or Create an account to join the conversation.

Time to create page: 0.618 seconds