Enhancement: execute external process in sequence / shutdown computer to end sequence

Issue #502 resolved
Chris Turchin created an issue

I finally did my first imaging session with NINA, and it worked well! I am coming from APT and the different UI takes some getting used to (for example, I expected “park” and “warm ccd” in the sequence rather than settings, but that is just because that is how APT works).

Anyways, there are a few things I think would really add value to NINA. I will add issues as the occur to me and if I find time and motivation, maybe I can submit some patches 🙂

One issue that would help my process is to run external scripts or programs at the end of a sequence.

My process usually look like this:

  • image some object (# images, gain, exp. time, etc.)
  • goto other object
  • image other object
  • … repeat as needed …
  • stop tracking
  • warm ccd
  • park scope
  • run file sync to copy / move files from my imaging machine to file server (via a simple rsync / robocopy script)
  • shutdown imaging machine

as far as I can tell, I can do everything except the last two items in nina - In fact, if you can make it possible to run an external process, then I can shutdown the system myself 😉 My idea is to add a new setting similar to “warm CCD” where an external processes can be defined. If defined and the command exists, then it is run at the end of the sequence (in process so the output can be collected) and the result of the command is appended to the log.

See attached patch execute-cmd-after-seq.patch

Comments (8)

  1. Chris Turchin reporter

    The attached patch implements a new sequence option to define command to run at completion of the sequence, this seems more “NINA like” than my first idea (and far less complicated).

    Basic sanity checks are performed (if exists, etc.) and the command, if present, runs after the CCD warm command.

    The command runs in process with a max. timeout of 60 minutes, and the command output is then written to the log file.

  2. Chris Turchin reporter

    Thanks @Stefan B I missed the “fork” part 😉 in my forked repo on Bitbucket that works fine. And to add insult to injury I created that patch against master rather than develop and LOTS has changed. So I binned it and re-wrote it again. PR submitted.

  3. Ron Kramer

    I’ve requested a script be run (optionally) at the end of a sequence a while back. It would allow us to do so many things. (custom park the scope, close and home the dome, and more.
    Also a flag to “end sequence” would be nice (checked before starting the next exposure in the sequence). to make sure everything is running. A ascom check of status of mount (tracking? true/false) if false then “end sequence, end options run this external script.

    That way when my scope hits a custom horizon (tree line) the scope now stops tracking, but the sequence continues to shoot, often for hours until my cloudwatcher detects “light at dawn”. It will then close the dome, but again if NINA doesn’t know the status of the gear it will shoot the inside of my closed dome until sequence count is finished. A simple “ mount status tracking check would allow NINA to know status of the current equipment setup.

    So if for any reason the mount is not TRACKING true, then sequence goto end.
    This would allow us to abort the sequence for various reasons by toggling mount tracking in other (mount) software.

  4. Chris Turchin reporter

    @Ron Kramer With the aforementioned PR you can configure a post-sequence script that will be executred after the other post-sequence actions, that is, that is after the warm and park etc. It was merged to develop (and I believe to 1.10) yesterday, so give it go in the next nightly and report back here how it works for you.

    The idea to integrate a “go/no-go check” before continuing with a sequence (after each exposure? after a new target? …) sounds interesting as well, I would put it into another issue so it does not get lost.

  5. Log in to comment