Indigo scripting - example

Forum dedicated to INDIGO Script know-how exchange
Post Reply
JohanB
Posts: 267
Joined: Thu Apr 21, 2016 5:55 pm

Indigo scripting - example

Post by JohanB »

Hi all,

Spend some time over the weekend figuring out how Indigo scripting works and i made a script that monitors the SQM value (with a Unihedron SQM) and date/time, and parks and powers off the setup when either the SQM value drops under a threshold or a specific moment in time has been reached.

To use the script, before executing one must set the mount name (mount_driver_name), date/time to stop (finish_date_time) and the SQM threshold (min_sqm_value). This could be made a bit more elegant with new custom properties being defined under agent_scripting, but that is something for another weekend :-) Sharing it as an example for now.

The script works by creating two event handlers and a timer;
- One event handler to monitor property changes on the Unihedron SQM (which reports the SQM value every 10s) (SQM_handler)
- A timer that is called every 10s to monitor if a certain moment in time has passed, like early in the morning... (timer)
- One event handler to monitor the parking of the mount and shutting down the setup when the mount is successfully parked (PARK.handler)

Once executed, the script will run until either of the conditions is met or the script is stopped manually from another script with;

delete indigo_event_handlers.SQM_handler;
delete indigo_event_handlers.PARK_handler;
indigo_cancel_timer(timer);

The script;
start_monitoring.txt
(3.71 KiB) Downloaded 35 times
Have fun!

Johan
User avatar
Peter Polakovic
Posts: 2698
Joined: Thu Apr 21, 2016 9:38 am

Re: Indigo scripting - example

Post by Peter Polakovic »

:thumbsup:
User avatar
Peter Polakovic
Posts: 2698
Joined: Thu Apr 21, 2016 9:38 am

Re: Indigo scripting - example

Post by Peter Polakovic »

For those who want play with scripting, there is a new script editor panel in each v4.x application and also standalone application called INDIGO Script Editor.

https://bb.cloudmakers.eu/viewtopic.php?f=15&t=594


Image
JohanB
Posts: 267
Joined: Thu Apr 21, 2016 5:55 pm

Re: Indigo scripting - example

Post by JohanB »

Hi Peter,

Great, looking good! Will take a closer look this afternoon, now that we're past the X-Mass festivities :-)

But before that, a quick question; what do the "Set" and "Reset" buttons do?

Regards, johan
User avatar
Peter Polakovic
Posts: 2698
Joined: Thu Apr 21, 2016 9:38 am

Re: Indigo scripting - example

Post by Peter Polakovic »

Set and reset do the same as in control panel. Scripts are actually properties on a server side so you have to set the value or reset it (to the original property value). Peter

P.S. Pls. use build 551, we enabled much more CodeMirror features in script editor :)

Image
User avatar
aaron
Posts: 110
Joined: Thu Apr 09, 2020 11:47 pm
Location: Upstate New York, US
Contact:

Re: Indigo scripting - example

Post by aaron »

I’ve begun playing but the learning curve will take a little time. Anyway, let’s start a list of potential uses:
  • The indigo server can set up related agents on boot
  • Always turn on my PowerBox dew heaters
  • Automatically dither every 3 frames instead of every 1 frame? Script would set dithering aggressivity to 0 until third frame.
  • meridian flip maybe? No plate solving, but better than nothing. I’m thinking wait X minutes, then go to coordinates, then calibrate guiding, then resume sequence.
What else?
JohanB
Posts: 267
Joined: Thu Apr 21, 2016 5:55 pm

Re: Indigo scripting - example

Post by JohanB »

Hi Aaron,

What about;

- Park and power down when the clouds move in
- Re-calibrate guiding if during a long session the RMSE starts to climb
- Plate-solving?

Regarding the latter, the astrometry setup has a JSON based API. Found a python script to use it, but it is over my head to put this in an indigo-script. https://github.com/dstndstn/astrometry. ... /client.py

Would be great though if somebody could get this going and share the script :-)

Regards, Johan
Post Reply