Script example
Here is the code of the Python script scope_unpark you can use to unpark the telescope.
The full script code look as following:
# This script unpark the telescope mount from ccdciel import ccdcielex import sys try: connected = (ccdcielex('Telescope_Connected')['result']) if not connected : ccdcielex('LogMsg','Telescope not connected!') sys.exit(1) parked = (ccdcielex('Telescope_Parked')['result']) if not parked : ccdcielex('LogMsg','Telescope already unparked') sys.exit(0) r = (ccdcielex('Telescope_Park',False)['result']['status']) ccdcielex('LogMsg','Telescope Unpark %r' %(r)) except Exception as e: print('error '+e.message)
Is a comment to explain what this script do
from ccdciel import ccdcielex
Import the Python CCDciel interface module.
import sys
You can import any other Python module you need.
try:
Start of exception block that will catch any error in the CCDciel interface.
connected = (ccdcielex('Telescope_Connected')['result'])
We ask CCDciel if the telescope is connected, the result is in our variable “connected”.
if not connected : ccdcielex('LogMsg','Telescope not connected!') sys.exit(1)
We test the result of the previous command, “connected” is True if the telescope is connected, so we add the negation “not” to test for “not connected”. If the result of the test “not connected” is true we execute the indented code block, this write a message in the log and exit the script.
parked = (ccdcielex('Telescope_Parked')['result'])
We continue and we do the same to check if the telescope is parked, with the result in our “parked” variable.
if not parked :
We test if the telescope is already unparked, in this case we exit the script.
r = (ccdcielex('Telescope_Park',False)['result']['status'])
We call the method 'Telescope_Park' with the argument False to unpark the telescope. This effectively unpark the telescope and the status of the command is in variable “r”.
ccdcielex('LogMsg','Telescope Unpark %r' %(r))
This write a message to the log to show the status of the command, this can be 'OK!' or 'Failed!'.
except Exception as e: print('error '+e.message)
End of the exception block, this is executed only in case of error with the CCDciel interface.