Skip to content

Instantly share code, notes, and snippets.

@petrushy
Created October 27, 2018 13:06
Show Gist options
  • Save petrushy/dc953a0d128064d6b5a071c72b2bd85c to your computer and use it in GitHub Desktop.
Save petrushy/dc953a0d128064d6b5a071c72b2bd85c to your computer and use it in GitHub Desktop.
A notebook example of interfacing to INDI
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Notebook version of satellite tracker\n",
"This version is using pyephem for the satellite propagation and npindi for the communciations with the mount"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"import logging\n",
"import signal\n",
"import sys\n",
"import time\n",
"import time\n",
"import sys\n",
"import threading\n",
"import ephem\n",
"from math import pi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using npindi as it does not require building the full indi driver stack."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"from indi.client.indiclient import IndiClient\n",
"from indi.INDI import INDI\n",
"from indi.client.indievent import IndiEvent, IndiEventType"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"# INDI settings\n",
"host = 'localhost'\n",
"port = 7624\n",
"driver_name =\"Telescope Simulator\""
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"# logging default (stderr)\n",
"logging.basicConfig(format='%(asctime)s: %(name)-8s %(levelname)-8s %(message)s', level=logging.INFO)\n",
"logger = logging.getLogger('indiclient')"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2018-10-27 15:04:36,045: indiclient ERROR Property duplicated: 'CONNECTION' in device Telescope Simulator\n",
"2018-10-27 15:04:36,078: indiclient ERROR Property duplicated: 'DRIVER_INFO' in device Telescope Simulator\n",
"2018-10-27 15:04:36,083: indiclient ERROR Property duplicated: 'POLLING_PERIOD' in device Telescope Simulator\n",
"2018-10-27 15:04:36,093: indiclient ERROR Property duplicated: 'DEBUG' in device Telescope Simulator\n",
"2018-10-27 15:04:36,104: indiclient ERROR Property duplicated: 'CONFIG_PROCESS' in device Telescope Simulator\n",
"2018-10-27 15:04:36,106: indiclient ERROR Property duplicated: 'CONNECTION_MODE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,109: indiclient ERROR Property duplicated: 'DEVICE_PORT' in device Telescope Simulator\n",
"2018-10-27 15:04:36,121: indiclient ERROR Property duplicated: 'DEVICE_BAUD_RATE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,124: indiclient ERROR Property duplicated: 'DEVICE_AUTO_SEARCH' in device Telescope Simulator\n",
"2018-10-27 15:04:36,077: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Telescope Simulator\n",
"2018-10-27 15:04:36,135: indiclient ERROR Property duplicated: 'DEVICE_PORT_SCAN' in device Telescope Simulator\n",
"2018-10-27 15:04:36,135: indiclient ERROR Property duplicated: 'DOME_POLICY' in device Telescope Simulator\n",
"2018-10-27 15:04:36,137: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Telescope Simulator\n",
"2018-10-27 15:04:36,139: indiclient ERROR Property duplicated: 'TELESCOPE_INFO' in device Telescope Simulator\n",
"2018-10-27 15:04:36,141: indiclient ERROR Property duplicated: 'DOME_POLICY' in device Telescope Simulator\n",
"2018-10-27 15:04:36,142: indiclient ERROR Property duplicated: 'SCOPE_CONFIG_NAME' in device Telescope Simulator\n",
"2018-10-27 15:04:36,144: indiclient ERROR Property duplicated: 'TELESCOPE_INFO' in device Telescope Simulator\n",
"2018-10-27 15:04:36,149: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Telescope Simulator\n",
"2018-10-27 15:04:36,151: indiclient ERROR Property duplicated: 'SCOPE_CONFIG_NAME' in device Telescope Simulator\n",
"2018-10-27 15:04:36,172: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device CCD Simulator\n",
"2018-10-27 15:04:36,173: indiclient ERROR Property duplicated: 'ON_COORD_SET' in device Telescope Simulator\n",
"2018-10-27 15:04:36,175: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,177: indiclient ERROR Property duplicated: 'EQUATORIAL_EOD_COORD' in device Telescope Simulator\n",
"2018-10-27 15:04:36,182: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,183: indiclient ERROR Property duplicated: 'TELESCOPE_ABORT_MOTION' in device Telescope Simulator\n",
"2018-10-27 15:04:36,186: indiclient ERROR Property duplicated: 'FPS' in device CCD Simulator\n",
"2018-10-27 15:04:36,187: indiclient ERROR Property duplicated: 'TELESCOPE_TRACK_MODE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,190: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,193: indiclient ERROR Property duplicated: 'TELESCOPE_TRACK_STATE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,195: indiclient ERROR Property duplicated: 'RECORD_FILE' in device CCD Simulator\n",
"2018-10-27 15:04:36,196: indiclient ERROR Property duplicated: 'TELESCOPE_TRACK_RATE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,197: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device CCD Simulator\n",
"2018-10-27 15:04:36,199: indiclient ERROR Property duplicated: 'TELESCOPE_MOTION_NS' in device Telescope Simulator\n",
"2018-10-27 15:04:36,200: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,202: indiclient ERROR Property duplicated: 'TELESCOPE_MOTION_WE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,203: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device CCD Simulator\n",
"2018-10-27 15:04:36,204: indiclient ERROR Property duplicated: 'TELESCOPE_SLEW_RATE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,206: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device CCD Simulator\n",
"2018-10-27 15:04:36,207: indiclient ERROR Property duplicated: 'TARGET_EOD_COORD' in device Telescope Simulator\n",
"2018-10-27 15:04:36,209: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device CCD Simulator\n",
"2018-10-27 15:04:36,210: indiclient ERROR Property duplicated: 'TIME_UTC' in device Telescope Simulator\n",
"2018-10-27 15:04:36,211: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device CCD Simulator\n",
"2018-10-27 15:04:36,213: indiclient ERROR Property duplicated: 'GEOGRAPHIC_COORD' in device Telescope Simulator\n",
"2018-10-27 15:04:36,214: indiclient ERROR Property duplicated: 'EQUATORIAL_PE' in device CCD Simulator\n",
"2018-10-27 15:04:36,216: indiclient ERROR Property duplicated: 'TELESCOPE_PARK' in device Telescope Simulator\n",
"2018-10-27 15:04:36,223: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Guide Simulator\n",
"2018-10-27 15:04:36,225: indiclient ERROR Property duplicated: 'TELESCOPE_PARK_POSITION' in device Telescope Simulator\n",
"2018-10-27 15:04:36,226: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,228: indiclient ERROR Property duplicated: 'TELESCOPE_PARK_OPTION' in device Telescope Simulator\n",
"2018-10-27 15:04:36,229: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device Guide Simulator\n",
"2018-10-27 15:04:36,231: indiclient ERROR Property duplicated: 'APPLY_SCOPE_CONFIG' in device Telescope Simulator\n",
"2018-10-27 15:04:36,232: indiclient ERROR Property duplicated: 'FPS' in device Guide Simulator\n",
"2018-10-27 15:04:36,233: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Telescope Simulator\n",
"2018-10-27 15:04:36,235: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,237: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_NS' in device Telescope Simulator\n",
"2018-10-27 15:04:36,243: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_WE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,247: indiclient ERROR Property duplicated: 'GUIDE_RATE' in device Telescope Simulator\n",
"2018-10-27 15:04:36,250: indiclient ERROR Property duplicated: 'SYSTEM_PORTS' in device Telescope Simulator\n",
"2018-10-27 15:04:36,253: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Telescope Simulator\n",
"2018-10-27 15:04:36,255: indiclient ERROR Property duplicated: 'DOME_POLICY' in device Telescope Simulator\n",
"2018-10-27 15:04:36,257: indiclient ERROR Property duplicated: 'TELESCOPE_INFO' in device Telescope Simulator\n",
"2018-10-27 15:04:36,258: indiclient ERROR Property duplicated: 'SCOPE_CONFIG_NAME' in device Telescope Simulator\n",
"2018-10-27 15:04:36,270: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Telescope Simulator\n",
"2018-10-27 15:04:36,275: indiclient ERROR Property duplicated: 'CONNECTION' in device CCD Simulator\n",
"2018-10-27 15:04:36,277: indiclient ERROR Property duplicated: 'DRIVER_INFO' in device CCD Simulator\n",
"2018-10-27 15:04:36,279: indiclient ERROR Property duplicated: 'POLLING_PERIOD' in device CCD Simulator\n",
"2018-10-27 15:04:36,282: indiclient ERROR Property duplicated: 'DEBUG' in device CCD Simulator\n",
"2018-10-27 15:04:36,285: indiclient ERROR Property duplicated: 'CONFIG_PROCESS' in device CCD Simulator\n",
"2018-10-27 15:04:36,289: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device CCD Simulator\n",
"2018-10-27 15:04:36,238: indiclient ERROR Property duplicated: 'RECORD_FILE' in device Guide Simulator\n",
"2018-10-27 15:04:36,310: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device Guide Simulator\n",
"2018-10-27 15:04:36,315: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device Guide Simulator\n",
"2018-10-27 15:04:36,304: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device CCD Simulator\n",
"2018-10-27 15:04:36,321: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device CCD Simulator\n",
"2018-10-27 15:04:36,324: indiclient ERROR Property duplicated: 'EQUATORIAL_PE' in device CCD Simulator\n",
"2018-10-27 15:04:36,325: indiclient ERROR Property duplicated: 'CCD_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,328: indiclient ERROR Property duplicated: 'CCD_ABORT_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,329: indiclient ERROR Property duplicated: 'CCD_FRAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,331: indiclient ERROR Property duplicated: 'CCD_BINNING' in device CCD Simulator\n",
"2018-10-27 15:04:36,334: indiclient ERROR Property duplicated: 'FITS_HEADER' in device CCD Simulator\n",
"2018-10-27 15:04:36,317: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device Guide Simulator\n",
"2018-10-27 15:04:36,341: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device Guide Simulator\n",
"2018-10-27 15:04:36,335: indiclient ERROR Property duplicated: 'GUIDER_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,345: indiclient ERROR Property duplicated: 'GUIDER_ABORT_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,342: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device Guide Simulator\n",
"2018-10-27 15:04:36,352: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device Guide Simulator\n",
"2018-10-27 15:04:36,350: indiclient ERROR Property duplicated: 'GUIDER_FRAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,355: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Filter Simulator\n",
"2018-10-27 15:04:36,357: indiclient ERROR Property duplicated: 'CCD_TEMPERATURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,368: indiclient ERROR Property duplicated: 'CCD_INFO' in device CCD Simulator\n",
"2018-10-27 15:04:36,364: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Focuser Simulator\n",
"2018-10-27 15:04:36,373: indiclient ERROR Property duplicated: 'Mode' in device Focuser Simulator\n",
"2018-10-27 15:04:36,371: indiclient ERROR Property duplicated: 'GUIDER_INFO' in device CCD Simulator\n",
"2018-10-27 15:04:36,379: indiclient ERROR Property duplicated: 'GUIDER_BINNING' in device CCD Simulator\n",
"2018-10-27 15:04:36,382: indiclient ERROR Property duplicated: 'CCD_COMPRESSION' in device CCD Simulator\n",
"2018-10-27 15:04:36,384: indiclient ERROR Property duplicated: 'CCD1' in device CCD Simulator\n",
"2018-10-27 15:04:36,387: indiclient ERROR Property duplicated: 'GUIDER_COMPRESSION' in device CCD Simulator\n",
"2018-10-27 15:04:36,390: indiclient ERROR Property duplicated: 'CCD2' in device CCD Simulator\n",
"2018-10-27 15:04:36,391: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_NS' in device CCD Simulator\n",
"2018-10-27 15:04:36,398: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_WE' in device CCD Simulator\n",
"2018-10-27 15:04:36,400: indiclient ERROR Property duplicated: 'CCD_FRAME_TYPE' in device CCD Simulator\n",
"2018-10-27 15:04:36,403: indiclient ERROR Property duplicated: 'CCD_FRAME_RESET' in device CCD Simulator\n",
"2018-10-27 15:04:36,406: indiclient ERROR Property duplicated: 'GUIDER_FRAME_TYPE' in device CCD Simulator\n",
"2018-10-27 15:04:36,407: indiclient ERROR Property duplicated: 'CCD_RAPID_GUIDE' in device CCD Simulator\n",
"2018-10-27 15:04:36,415: indiclient ERROR Property duplicated: 'GUIDER_RAPID_GUIDE' in device CCD Simulator\n",
"2018-10-27 15:04:36,417: indiclient ERROR Property duplicated: 'TELESCOPE_TYPE' in device CCD Simulator\n",
"2018-10-27 15:04:36,420: indiclient ERROR Property duplicated: 'WCS_CONTROL' in device CCD Simulator\n",
"2018-10-27 15:04:36,425: indiclient ERROR Property duplicated: 'UPLOAD_MODE' in device CCD Simulator\n",
"2018-10-27 15:04:36,427: indiclient ERROR Property duplicated: 'UPLOAD_SETTINGS' in device CCD Simulator\n",
"2018-10-27 15:04:36,429: indiclient ERROR Property duplicated: 'CCD_EXPOSURE_LOOP' in device CCD Simulator\n",
"2018-10-27 15:04:36,431: indiclient ERROR Property duplicated: 'CCD_EXPOSURE_LOOP_COUNT' in device CCD Simulator\n",
"2018-10-27 15:04:36,433: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,436: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,439: indiclient ERROR Property duplicated: 'FPS' in device CCD Simulator\n",
"2018-10-27 15:04:36,441: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,443: indiclient ERROR Property duplicated: 'RECORD_FILE' in device CCD Simulator\n",
"2018-10-27 15:04:36,445: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device CCD Simulator\n",
"2018-10-27 15:04:36,447: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,449: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device CCD Simulator\n",
"2018-10-27 15:04:36,451: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device CCD Simulator\n",
"2018-10-27 15:04:36,454: indiclient ERROR Property duplicated: 'CCD_COOLER' in device CCD Simulator\n",
"2018-10-27 15:04:36,456: indiclient ERROR Property duplicated: 'FILTER_SLOT' in device CCD Simulator\n",
"2018-10-27 15:04:36,459: indiclient ERROR Property duplicated: 'FILTER_NAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,461: indiclient ERROR Property duplicated: 'CCD_ROTATION' in device CCD Simulator\n",
"2018-10-27 15:04:36,466: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device CCD Simulator\n",
"2018-10-27 15:04:36,469: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,472: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device CCD Simulator\n",
"2018-10-27 15:04:36,475: indiclient ERROR Property duplicated: 'FPS' in device CCD Simulator\n",
"2018-10-27 15:04:36,473: indiclient WARNING BaseMediator: new_universal_message: 2018-10-27T13:04:36: No cameras detected.Check power and make sure camera is not mounted by other programs and try again.\n",
"2018-10-27 15:04:36,477: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device CCD Simulator\n",
"2018-10-27 15:04:36,483: indiclient ERROR Property duplicated: 'RECORD_FILE' in device CCD Simulator\n",
"2018-10-27 15:04:36,487: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device CCD Simulator\n",
"2018-10-27 15:04:36,489: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device CCD Simulator\n",
"2018-10-27 15:04:36,491: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device CCD Simulator\n",
"2018-10-27 15:04:36,496: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device CCD Simulator\n",
"2018-10-27 15:04:36,498: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device CCD Simulator\n",
"2018-10-27 15:04:36,502: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device CCD Simulator\n",
"2018-10-27 15:04:36,543: indiclient ERROR Property duplicated: 'EQUATORIAL_PE' in device CCD Simulator\n",
"2018-10-27 15:04:36,546: indiclient ERROR Property duplicated: 'CONNECTION' in device Guide Simulator\n",
"2018-10-27 15:04:36,550: indiclient ERROR Property duplicated: 'DRIVER_INFO' in device Guide Simulator\n",
"2018-10-27 15:04:36,554: indiclient ERROR Property duplicated: 'POLLING_PERIOD' in device Guide Simulator\n",
"2018-10-27 15:04:36,556: indiclient ERROR Property duplicated: 'DEBUG' in device Guide Simulator\n",
"2018-10-27 15:04:36,558: indiclient ERROR Property duplicated: 'CONFIG_PROCESS' in device Guide Simulator\n",
"2018-10-27 15:04:36,563: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Guide Simulator\n",
"2018-10-27 15:04:36,565: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device Guide Simulator\n",
"2018-10-27 15:04:36,568: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device Guide Simulator\n",
"2018-10-27 15:04:36,580: indiclient ERROR Property duplicated: 'CCD_EXPOSURE' in device Guide Simulator\n",
"2018-10-27 15:04:36,587: indiclient ERROR Property duplicated: 'CCD_ABORT_EXPOSURE' in device Guide Simulator\n",
"2018-10-27 15:04:36,589: indiclient ERROR Property duplicated: 'CCD_FRAME' in device Guide Simulator\n",
"2018-10-27 15:04:36,591: indiclient ERROR Property duplicated: 'CCD_BINNING' in device Guide Simulator\n",
"2018-10-27 15:04:36,598: indiclient ERROR Property duplicated: 'FITS_HEADER' in device Guide Simulator\n",
"2018-10-27 15:04:36,602: indiclient ERROR Property duplicated: 'CCD_INFO' in device Guide Simulator\n",
"2018-10-27 15:04:36,605: indiclient ERROR Property duplicated: 'CCD_COMPRESSION' in device Guide Simulator\n",
"2018-10-27 15:04:36,609: indiclient ERROR Property duplicated: 'CCD1' in device Guide Simulator\n",
"2018-10-27 15:04:36,613: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_NS' in device Guide Simulator\n",
"2018-10-27 15:04:36,615: indiclient ERROR Property duplicated: 'TELESCOPE_TIMED_GUIDE_WE' in device Guide Simulator\n",
"2018-10-27 15:04:36,617: indiclient ERROR Property duplicated: 'CCD_FRAME_TYPE' in device Guide Simulator\n",
"2018-10-27 15:04:36,620: indiclient ERROR Property duplicated: 'CCD_FRAME_RESET' in device Guide Simulator\n",
"2018-10-27 15:04:36,622: indiclient ERROR Property duplicated: 'CCD_RAPID_GUIDE' in device Guide Simulator\n",
"2018-10-27 15:04:36,624: indiclient ERROR Property duplicated: 'TELESCOPE_TYPE' in device Guide Simulator\n",
"2018-10-27 15:04:36,628: indiclient ERROR Property duplicated: 'WCS_CONTROL' in device Guide Simulator\n",
"2018-10-27 15:04:36,630: indiclient ERROR Property duplicated: 'UPLOAD_MODE' in device Guide Simulator\n",
"2018-10-27 15:04:36,632: indiclient ERROR Property duplicated: 'UPLOAD_SETTINGS' in device Guide Simulator\n",
"2018-10-27 15:04:36,634: indiclient ERROR Property duplicated: 'CCD_EXPOSURE_LOOP' in device Guide Simulator\n",
"2018-10-27 15:04:36,637: indiclient ERROR Property duplicated: 'CCD_EXPOSURE_LOOP_COUNT' in device Guide Simulator\n",
"2018-10-27 15:04:36,641: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,644: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device Guide Simulator\n",
"2018-10-27 15:04:36,649: indiclient ERROR Property duplicated: 'FPS' in device Guide Simulator\n",
"2018-10-27 15:04:36,652: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,655: indiclient ERROR Property duplicated: 'RECORD_FILE' in device Guide Simulator\n",
"2018-10-27 15:04:36,657: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device Guide Simulator\n",
"2018-10-27 15:04:36,661: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device Guide Simulator\n",
"2018-10-27 15:04:36,663: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device Guide Simulator\n",
"2018-10-27 15:04:36,666: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device Guide Simulator\n",
"2018-10-27 15:04:36,668: indiclient ERROR Property duplicated: 'ACTIVE_DEVICES' in device Guide Simulator\n",
"2018-10-27 15:04:36,671: indiclient ERROR Property duplicated: 'CCD_VIDEO_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,674: indiclient ERROR Property duplicated: 'STREAMING_EXPOSURE' in device Guide Simulator\n",
"2018-10-27 15:04:36,676: indiclient ERROR Property duplicated: 'FPS' in device Guide Simulator\n",
"2018-10-27 15:04:36,677: indiclient ERROR Property duplicated: 'RECORD_STREAM' in device Guide Simulator\n",
"2018-10-27 15:04:36,681: indiclient ERROR Property duplicated: 'RECORD_FILE' in device Guide Simulator\n",
"2018-10-27 15:04:36,683: indiclient ERROR Property duplicated: 'RECORD_OPTIONS' in device Guide Simulator\n",
"2018-10-27 15:04:36,686: indiclient ERROR Property duplicated: 'CCD_STREAM_FRAME' in device Guide Simulator\n",
"2018-10-27 15:04:36,688: indiclient ERROR Property duplicated: 'CCD_STREAM_ENCODER' in device Guide Simulator\n",
"2018-10-27 15:04:36,691: indiclient ERROR Property duplicated: 'CCD_STREAM_RECORDER' in device Guide Simulator\n",
"2018-10-27 15:04:36,693: indiclient ERROR Property duplicated: 'SIMULATOR_SETTINGS' in device Guide Simulator\n",
"2018-10-27 15:04:36,697: indiclient ERROR Property duplicated: 'ON_TIME_FACTOR' in device Guide Simulator\n",
"2018-10-27 15:04:36,699: indiclient ERROR Property duplicated: 'CONNECTION' in device Filter Simulator\n",
"2018-10-27 15:04:36,701: indiclient ERROR Property duplicated: 'DRIVER_INFO' in device Filter Simulator\n",
"2018-10-27 15:04:36,703: indiclient ERROR Property duplicated: 'CONFIG_PROCESS' in device Filter Simulator\n",
"2018-10-27 15:04:36,706: indiclient ERROR Property duplicated: 'FILTER_SLOT' in device Filter Simulator\n",
"2018-10-27 15:04:36,708: indiclient ERROR Property duplicated: 'FILTER_NAME' in device Filter Simulator\n",
"2018-10-27 15:04:36,712: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Filter Simulator\n",
"2018-10-27 15:04:36,714: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Filter Simulator\n",
"2018-10-27 15:04:36,717: indiclient ERROR Property duplicated: 'CONNECTION' in device Focuser Simulator\n",
"2018-10-27 15:04:36,719: indiclient ERROR Property duplicated: 'DRIVER_INFO' in device Focuser Simulator\n",
"2018-10-27 15:04:36,721: indiclient ERROR Property duplicated: 'DEBUG' in device Focuser Simulator\n",
"2018-10-27 15:04:36,723: indiclient ERROR Property duplicated: 'POLLING_PERIOD' in device Focuser Simulator\n",
"2018-10-27 15:04:36,725: indiclient ERROR Property duplicated: 'CONFIG_PROCESS' in device Focuser Simulator\n",
"2018-10-27 15:04:36,727: indiclient ERROR Property duplicated: 'CONNECTION_MODE' in device Focuser Simulator\n",
"2018-10-27 15:04:36,733: indiclient ERROR Property duplicated: 'DEVICE_PORT' in device Focuser Simulator\n",
"2018-10-27 15:04:36,734: indiclient ERROR Property duplicated: 'DEVICE_BAUD_RATE' in device Focuser Simulator\n",
"2018-10-27 15:04:36,735: indiclient ERROR Property duplicated: 'DEVICE_AUTO_SEARCH' in device Focuser Simulator\n",
"2018-10-27 15:04:36,736: indiclient ERROR Property duplicated: 'DEVICE_PORT_SCAN' in device Focuser Simulator\n",
"2018-10-27 15:04:36,738: indiclient ERROR Property duplicated: 'SYSTEM_PORTS' in device Focuser Simulator\n",
"2018-10-27 15:04:36,739: indiclient ERROR Property duplicated: 'Mode' in device Focuser Simulator\n",
"2018-10-27 15:04:36,741: indiclient ERROR Property duplicated: 'FOCUS_MOTION' in device Focuser Simulator\n",
"2018-10-27 15:04:36,743: indiclient ERROR Property duplicated: 'FOCUS_SPEED' in device Focuser Simulator\n",
"2018-10-27 15:04:36,744: indiclient ERROR Property duplicated: 'FOCUS_TIMER' in device Focuser Simulator\n",
"2018-10-27 15:04:36,746: indiclient ERROR Property duplicated: 'REL_FOCUS_POSITION' in device Focuser Simulator\n",
"2018-10-27 15:04:36,750: indiclient ERROR Property duplicated: 'ABS_FOCUS_POSITION' in device Focuser Simulator\n",
"2018-10-27 15:04:36,752: indiclient ERROR Property duplicated: 'Presets' in device Focuser Simulator\n",
"2018-10-27 15:04:36,754: indiclient ERROR Property duplicated: 'Goto' in device Focuser Simulator\n",
"2018-10-27 15:04:36,756: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Focuser Simulator\n",
"2018-10-27 15:04:36,757: indiclient ERROR Property duplicated: 'SEEING_SETTINGS' in device Focuser Simulator\n",
"2018-10-27 15:04:36,759: indiclient ERROR Property duplicated: 'FWHM' in device Focuser Simulator\n",
"2018-10-27 15:04:36,761: indiclient ERROR Property duplicated: 'USEJOYSTICK' in device Focuser Simulator\n",
"2018-10-27 15:04:36,763: indiclient ERROR Property duplicated: 'Mode' in device Focuser Simulator\n",
"2018-10-27 15:04:36,768: indiclient WARNING BaseMediator: new_universal_message: 2018-10-27T13:04:36: No cameras detected.Check power and make sure camera is not mounted by other programs and try again.\n"
]
}
],
"source": [
"client=IndiClient(host=host, port=port, logger=logger)\n",
"if not client.connect():\n",
" #logger.warning('INDI server not reachable')\n",
" print(\"FAILED\") \n",
" print(\"No indiserver running on \"+client.getHost()+\":\"+str(client.getPort()))\n",
" #sys.exit(1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"##### print(client.getHost(), client.getPort())"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [],
"source": [
"# Geographic location\n",
"latitude = '59:51:05.0'\n",
"longitude = '17:37:30.0'"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"COSMOS 1933 \n",
"1 18958U 88020A 18289.74738535 .00000151 00000-0 89206-5 0 9996\n",
"2 18958 82.5317 354.2573 0012993 70.7620 289.5011 15.03505730643462"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [],
"source": [
"# Satellite TLE (can be retreived on https://www.space-track.org)\n",
"TLE_line_1 = '1 18958U 88020A 18289.74738535 .00000151 00000-0 89206-5 0 9996'\n",
"TLE_line_2 = '2 18958 82.5317 354.2573 0012993 70.7620 289.5011 15.03505730643462'"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"# Script settings\n",
"update_delay = 1 # delay in s between updates"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Telescope Simulator is here ['CONNECTION', 'DRIVER_INFO', 'POLLING_PERIOD', 'DEBUG', 'CONFIG_PROCESS', 'CONNECTION_MODE', 'DEVICE_PORT', 'DEVICE_BAUD_RATE', 'DEVICE_AUTO_SEARCH', 'DEVICE_PORT_SCAN', 'ACTIVE_DEVICES', 'DOME_POLICY', 'TELESCOPE_INFO', 'SCOPE_CONFIG_NAME', 'ON_COORD_SET', 'EQUATORIAL_EOD_COORD', 'TELESCOPE_ABORT_MOTION', 'TELESCOPE_TRACK_MODE', 'TELESCOPE_TRACK_STATE', 'TELESCOPE_TRACK_RATE', 'TELESCOPE_MOTION_NS', 'TELESCOPE_MOTION_WE', 'TELESCOPE_SLEW_RATE', 'TARGET_EOD_COORD', 'TIME_UTC', 'GEOGRAPHIC_COORD', 'TELESCOPE_PARK', 'TELESCOPE_PARK_POSITION', 'TELESCOPE_PARK_OPTION', 'APPLY_SCOPE_CONFIG', 'USEJOYSTICK', 'TELESCOPE_TIMED_GUIDE_NS', 'TELESCOPE_TIMED_GUIDE_WE', 'GUIDE_RATE', 'SYSTEM_PORTS']\n"
]
}
],
"source": [
"DEVICE_NAME=driver_name\n",
"client.wait_device(DEVICE_NAME, connect=False)\n",
"device_telescope=client.devices[DEVICE_NAME]\n",
"print(DEVICE_NAME,'is here', [p for p in client.devices[DEVICE_NAME].properties.keys()])"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OK\n"
]
}
],
"source": [
"telescope_connect=device_telescope.getSwitch(\"CONNECTION\")\n",
"while not(telescope_connect):\n",
" time.sleep(0.5)\n",
" telescope_connect=device_telescope.getSwitch(\"CONNECTION\")\n",
"print(\"OK\")"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [],
"source": [
"# if the telescope device is not connected, we do connect it\n",
"# Not wirking yet"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Set tracking mode ... OK\n"
]
}
],
"source": [
"# We want to set the ON_COORD_SET switch to engage tracking after goto\n",
"# device.getSwitch is a helper to retrieve a property vector\n",
"print(\"Set tracking mode ... \", end='')\n",
"telescope_on_coord_set=device_telescope.getSwitch(\"ON_COORD_SET\")\n",
"while not(telescope_on_coord_set):\n",
" time.sleep(0.5)\n",
" telescope_on_coord_set=device_telescope.getSwitch(\"ON_COORD_SET\")\n",
"print('OK')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [],
"source": [
"# the order below is defined in the property vector, look at the standard Properties page\n",
"# or enumerate them in the Python shell when you're developing your program\n",
"telescope_on_coord_set.vp['TRACK'].s=INDI.ISState.ISS_ON # TRACK\n",
"telescope_on_coord_set.vp['SLEW'].s=INDI.ISState.ISS_OFF # SLEW\n",
"telescope_on_coord_set.vp['SYNC'].s=INDI.ISState.ISS_OFF # SYNC\n",
"client.send_new_property(telescope_on_coord_set)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<ISState.ISS_OFF: 'Off'>"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"telescope_on_coord_set=device_telescope.getSwitch(\"ON_COORD_SET\")\n",
"telescope_on_coord_set.vp['SLEW'].s"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"OK\n"
]
}
],
"source": [
"telescope_radec=device_telescope.getNumber(\"EQUATORIAL_EOD_COORD\")\n",
"while not(telescope_radec):\n",
" time.sleep(0.5)\n",
" telescope_radec=device_telescope.getNumber(\"EQUATORIAL_EOD_COORD\")\n",
"print(\"OK\")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ra= 4.513374368274331\n",
"dec= 18.304992289437713\n"
]
}
],
"source": [
"print('ra=',telescope_radec.vp['RA'].value)\n",
"print('dec=',telescope_radec.vp['DEC'].value)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Configure PyEphem ... OK\n"
]
}
],
"source": [
"# Configure PyEphem\n",
"print(\"Configure PyEphem ... \", end='')\n",
"obs = ephem.Observer()\n",
"obs.lon = longitude\n",
"obs.lat = latitude\n",
"satellite = ephem.readtle('TARGET',TLE_line_1,TLE_line_2)\n",
"print(\"OK\")"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2018/10/27 13:05:33\n",
" RA: 70.55899424013123\n",
" DEC: 18.4411979092415\n",
" ALT: -11.705301576906468\n",
" AZ: 359.31679985561465\n",
"4:42:14.16\n",
"18.39982416691322\n"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-36-be938f5eff3a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 19\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtelescope_radec\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvp\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'DEC'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 21\u001b[0;31m \u001b[0mtime\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mupdate_delay\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"from IPython.display import clear_output\n",
"\n",
"while 1:\n",
" # compute satellite coordinates\n",
" obs.date = ephem.now()\n",
" satellite.compute(obs)\n",
" clear_output()\n",
" print(obs.date)\n",
" print(\" RA: \",satellite.ra*360/2/pi)\n",
" print(\" DEC:\",satellite.dec*360/2/pi)\n",
" print(\" ALT:\",satellite.alt*360/2/pi)\n",
" print(\" AZ: \",satellite.az*360/2/pi)\n",
"\n",
" # We set the desired coordinates\n",
" telescope_radec.vp['RA'].value=ephem.hours(satellite.ra) \n",
" telescope_radec.vp['DEC'].value=ephem.degrees(satellite.dec) \n",
" client.send_new_property(telescope_radec)\n",
" print(telescope_radec.vp['RA'].value)\n",
" print(telescope_radec.vp['DEC'].value)\n",
"\n",
" time.sleep(update_delay) "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.0"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment