×

INDI Library v2.0.6 is Released (02 Feb 2024)

Bi-monthly release with minor bug fixes and improvements

PHD2 and scheduler shutdown...

  • Posts: 333
  • Thank you received: 24
Is there a way that the Scheduler can continue image captures, even if PHD2 is reporting lost star, until the sequence and scheduler rules complete?

In my last session, it was not possible to use the Scheduler with PHD2. The skies were not great. They were good enough so that every second 120s sub would be okay. Unfortunately that is just the way the weather is here right now.

PHD2 would recover on its own to start the guiding nicely again; however, Ekos would shutdown if guiding was checked off in the scheduler.

Unchecking guiding was fine, and PHD2 would do its thing and the scheduler finished in the end.

The missing part is that Ekos would not shutdown PHD2 once the sequence completed. Ekos would shut down everything else, and PHD2 would continue looping the camera. Ideally, Ekos could tell PHD2 to somehow stop when the sequence stops, if it is running.

Please let me known if this might be possible somehow.

Thank you
Last edit: 6 years 8 months ago by Stephen.
6 years 9 months ago #17322

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

You could perhaps shutdown PHD2 in the shutdown script?
The following user(s) said Thank You: Stephen
6 years 9 months ago #17325

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

  • Posts: 333
  • Thank you received: 24
I did not think of that. Great idea.

I have not used the startup/such down scripts yet. Is it as simple entering the complete path to a shell script to kill the PHD2 process?
6 years 9 months ago #17327

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

  • Posts: 333
  • Thank you received: 24
Okay. It seems shell scripts will not work. I tried the below example and it failed. Is it the sudo causing the failure or perhaps a shell script cannot work.

2017-06-20T18:54:05 Manual shutdown procedure terminated due to errors.
2017-06-20T18:54:05 Shutdown script failed, aborting...
2017-06-20T18:54:04 Executing script /home/astroberry/bin/ekos_shutdown_script.sh ...
2017-06-20T18:54:03 Warning! Executing shutdown procedure manually...

e.g. Not pretty but a quick test.

psid=`ps axww | grep -i "phd2" | awk '{print $1}'`
sudo kill -9 $psid
6 years 8 months ago #17347

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

Why run sudo? is PHD2 running as root? This is a simpler script:
#!/bin/bash
pkill phd2 | true

This script will always return 0 whether PHD2 was running or not but it will kill it if it is running. Try that.
The following user(s) said Thank You: Stephen
6 years 8 months ago #17350

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

  • Posts: 333
  • Thank you received: 24
This worked perfectly!! Thank you
6 years 8 months ago #17353

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

  • Posts: 210
  • Thank you received: 104
This work but phd2 do not close nicely because the signal is not handled within phd2. This may lead to memory leak.

You can use the server interface instead:
nc localhost 4400 <<EOF
{"method": "shutdown"}
EOF

Other server command are described here:
github.com/OpenPHDGuiding/phd2/wiki/Even...er-method-invocation
The following user(s) said Thank You: Stephen
6 years 8 months ago #17362

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

  • Posts: 333
  • Thank you received: 24
This is excellent.

I have another issues in that instructing PHD2 to dither when running separate, yet connected to IND, does not happen as mentioned above. Perhaps there is a script solution for this with the CCD.... something to try. I can post back if successful.
6 years 8 months ago #17368

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

  • Posts: 210
  • Thank you received: 104
You can dither with the following netcat command:
nc -N localhost 4400 <<EOF
{"method": "dither", "params":[5, false, {"pixels": 1.0, "time": 5, "timeout": 30}]}
EOF
-N option is require to exit netcat after the command is send
5 is the dither range
false is to not force RA only
The remaining parameters are the settle options:
wait to settle to 1 pixel
for a minimum of 5 second
for a maximum of 30 second

To know when the dither is completed it is possible to wait for the "SettleDone" event send by phd2 when settle is completed but this can be difficult by using only netcat, in this case a python script using a socket object is probably more easy to do. Or just make your script to sleep for the maximum settle timeout.
The following user(s) said Thank You: Stephen
6 years 8 months ago #17381

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

  • Posts: 333
  • Thank you received: 24
I will definitely give this a try.

Perhaps some day I will be able to get leaving the guiding as part of the scheduler, checked off in the scheduler. Until this perhaps this can help get dither working for me :)
6 years 8 months ago #17388

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

  • Posts: 454
  • Thank you received: 51
Hello Patrick,
Is there somewhere some tutorials to use the PHD2 server ?
Looks like there is a poor documentation to handle PHD1 via socket on the wiki.
Maybe some details on what are the interface methods and arguments that are exposed and some little examples might be useful.
Thanks
Patrick
4 years 9 months ago #39635

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

  • Posts: 210
  • Thank you received: 104
Hi Patrick,

The documentation for the server is also on the wiki but the page is poorly named EventMonitoring, probably because in a first time this server was used to send event and then extended to process command.

Scroll down to the middle of this page to find "PHD Server method invocation":
github.com/OpenPHDGuiding/phd2/wiki/EventMonitoring

This all use JSON format and there is example of message with the main command description.
You can exercise the command with: telnet localhost 4400
4 years 9 months ago #39637

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

Time to create page: 0.613 seconds