Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2013
    Location
    Cloudcroft, NM
    Posts
    58

    Default I would like to query the dome status externally

    Greetings Bob (and other experts),

    I would like to query the telescope positions and dome status with a python program and send it off to another monitoring program for our site (we have multiple telescopes here). I have been using the win32com.client in my python program to communicate with the various ASCOM devices. I can successfully talk to ACPDome.Telescope to retrieve the azimuth and altitude of the telescope and send that information via socket to another machine. Where I am having trouble is trying to get the dome ShutterStatus. I see in the documentation that there is not really a "Dome Hub" nor is dome information available through the ACP hub. There is also the blurb in the programmers manual that dome control is buried deep in ACP and that ASCOM for the dome is not really used to talk to the MaxDome II controller. I've tried, MaxDome.Dome, ASCOMDome.Telescope, TCS772.Dome and none work while ACP has control of the COM port. I'd rather not disable ACP dome control to make this work. I'm curious if there may be another sneaky (or less obvious) way to query the status of the dome shutter without say modifying asystemstatus.asp to send the information on to where I want it to go. I do not have a need to control (open/close/rotate) the dome. Just query the status of the shutter.

    Some additional background: This is a 0.5-m DFM telescope running the newest TCS for windows 7. We are running MaxIm, MaxDome II, FocusMax and ACP.

    Thanks for listening! I look forward to any advice,

    Bill Ketzeback
    Chief Telescope Engineer
    Apache Point Observatory

  2. #2
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    33,216

    Default

    See ACP Help, Scripting Guide, ACP Programmer's Reference, Dome Object, Properties, ShutterStatus (see below). I'm not sure what ACPDome.Telescope is (maybe a typo, just ACP.Telescope). Create an instance of ACP.Dome then use that to read its ShutterStatus property. I'm not a Python guy but use the same syntax you use to create an ACP.Telescope and read its Altitude and Azimuth properties. If you hadn't yet found the Scripting Guide, it's probably worth checking out the other info at the beginning. I am unsure if your Python for Windows has support for the integrated Windows script debugging services, but if it does, the Windows debuggers like Visual Studio can be incredibly helpful.

    -- Bob

  3. #3
    Join Date
    Oct 2013
    Location
    Cloudcroft, NM
    Posts
    58

    Default

    Bob,

    Thank you for the reply. I am familiar with the ACP Programmers Reference manual. It was a great help getting me this far. As I said I am able to open an instance to the ACP.Telescope but not ACP.Dome (ACPDome.Telescope was indeed a typo on my part). I get an error that the class is not registered. I know you are not a python guy but through the python interactive interpreter here are some code snippets to show you what is happening.

    >>> import win32com.client
    >>> a = win32com.client.Dispatch("ACP.Telescope")
    >>> print a.Connected
    False
    >>> a.Connected = True
    >>> print a.Azimuth, ", ", a.Altitude
    63.3944905387, 51.1734266713
    >>> b = win32com.client.Dispatch("ACP.Dome")
    Traceback (most recent call last):
    File "<interactive input>", line 1, in <module>
    File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch, userName, clsctx)
    File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatchAndUserName(IDispatch, clsctx), userName)
    File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
    com_error: (-2147221164, 'Class not registered', None, None)
    >>>

    If I disconnect ACP.Telescope I can connect directly to MaxDome.Dome and get some of the functionality but I really want to be able to do this when ACP is connected given I'd like to query the shutter status frequently throughout the night for the other telescope operators on the mountain.

    >>> a.Connected = False
    >>> b = win32com.client.Dispatch("MaxDome.Dome")
    >>> print b.Connected
    False
    >>> b.Connected = True
    >>> print b.Azimuth
    63.875
    >>> print b.CanSetShutter
    True
    >>> print b.ShutterStatus
    1
    >>> print b.ShutterStatus # After a manual opening of the dome
    0
    >>> b.Connected = False
    >>> a.Connected = True

    Likewise I can use ASCOMDome.Dome to do similar

    >>> c = win32com.client.Dispatch("ASCOMDome.Dome")
    >>> print c.Connected
    False
    >>> c.Connected = True
    >>> print c.ShutterStatus
    1
    >>> print c.ShutterStatus # Manual opening
    2
    >>> print c.ShutterStatus # Manual open
    0
    >>> print c.ShutterStatus # Manual closing
    3
    >>> print c.ShutterStatus # Closed
    1
    >>> c.Connected = False
    >>> a.Connected = True

    Once again, thanks for any help you might be able to provide to figure out why the ACP hub will not allow me to connect to the Dome object would be appreciated.

    Bill

  4. #4
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    33,216

    Default

    Damn, my sleepy-eyed mistake. I forgot you are doing this externally... From the Overview of ACP.Dome:

    ACP.Dome cannot be created directly by external automation clients, however the master copy of Dome is available as Util.Dome. Creating a copy of Util will give access to Dome from external automation objects. You do not need to do this in ACP scripts or ASP pages, where Dome is available directly within the script namespace.
    So create ACP.Util then with that object reference use Dome.ShutterStatus:

    u = win32com.client.Dispatch("ACP.Util")
    print u.Dome.ShutterStatus


    of course you can assign a variable to the Dome object

    u = win32com.client.Dispatch("ACP.Util")
    d = u.Dome
    print d.ShutterStatus


    I learned Python quickly eh?
    -- Bob

  5. #5
    Join Date
    Oct 2013
    Location
    Cloudcroft, NM
    Posts
    58

    Default

    Bob,

    Perfect! It worked as you described. Yes, you are a quick study.

    Thank you!
    Bill

  6. #6

    Default

    This is why I love these forums. I had the exact same question just now and found the answer in a few secs. Thanks for the useful info!

  7. #7
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    33,216

    Default



    Thanks for the kind words. I queued your other one for next Monday, it will take me considerable time and I am out of time (almost) today.
    -- Bob

  8. #8

    Default

    No worries Bob, no rush on that one. Thanks.

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AO-7 query
    By George Webley in forum Pre-Sales Technical Questions and Help
    Replies: 1
    Last Post: Oct 9, 2013, 00:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •