Esempio n. 1
0
    /// Windows C# Sample Console Application: Dome
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from Dome.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2013)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates how to access dome control.
    ///
    ///  Note:  The Dome add-on was not available for testing this script. Use at your own risk.
    ///

    public void DomeSample()
    {
        ///Create the dome object, connect and get it///s targeting
        sky6Dome tsx_do = new sky6Dome();

        tsx_do.Connect();
        tsx_do.GetAzEl();

        double DomeAz = tsx_do.dAz;
        double DomeEl = tsx_do.dEl;

        MessageBox.Show("Dome Azimuth at: " + DomeAz.ToString() + "  Dome Elevation at: " + DomeEl.ToString());
        MessageBox.Show("Moving to Azimuth 0 degrees, Elevation 0 Degrees.");

        ///Target the dome at az = 0, alt = 0
        tsx_do.GotoAzEl(0, 0);

        ///Disconnect the dome
        tsx_do.Disconnect();

        return;
    }
Esempio n. 2
0
        public static bool CloseDome(int domeHomeAz)
        {
            //Method for closing the TSX dome
            // use exception handlers to check for dome commands, opt out if none
            //Park Mount, if not parked already
            sky6RASCOMTele tsxt = new sky6RASCOMTele();

            //Connect dome and decouple the dome from the mount position
            IsDomeCoupled = false;
            //Disconnect the mount
            tsxt.Disconnect();

            sky6Dome tsxd = new sky6Dome();

            try { tsxd.Connect(); }
            catch { return(false); }
            //Stop whatever the dome is doing, if any and wait a few seconds for it to clear
            try { tsxd.Abort(); }
            catch { }
            //Goto home position using goto rather than home
            ReliableGoTo(domeHomeAz);
            tsxd.CloseSlit();
            System.Threading.Thread.Sleep(10); // Release task thread so TSX can start Close Slit -- Command in Progress exception otherwise
            while (tsxd.IsCloseComplete == 0)
            {
                System.Threading.Thread.Sleep(1000);
            }
            //Check to see if slit got closed, if not, then try one more time
            //if (tsxd.SlitState() != SlitState.Closed)
            //{
            //    tsxd.CloseSlit();
            //    System.Threading.Thread.Sleep(1); // Release task thread so TSX can start FindHome -- Command in Progress exception otherwise
            //    while (tsxd.IsCloseComplete == 0) { System.Threading.Thread.Sleep(1000); }
            //}
            //disconnect dome controller
            tsxd.Disconnect();
            return(true);
        }
Esempio n. 3
0
        /// <summary>
        /// Closes the dome slit and disconnects by
        /// decoupling the dome slews from the mount
        /// then slewing the dome to home to align power strips
        /// then closing the dome slit, leaving the dome control disconnected
        /// </summary>
        /// <param name="domeHomeAz">Azimuth of home position of dome</param>
        public static void CloseDome()
        {
            //Method for closing the TSX dome
            // use exception handlers to check for dome commands, opt out if none
            //Park Mount, if not parked already
            sky6RASCOMTele tsxt = new sky6RASCOMTele();

            //Decouple the dome from the mount position
            IsDomeCoupled = false;
            //Disconnect the mount
            tsxt.Disconnect();

            sky6Dome tsxd = new sky6Dome();

            try { tsxd.Connect(); }
            catch { return; }
            //Stop whatever the dome is doing, if any and wait a few seconds for it to clear
            try { tsxd.Abort(); }
            catch { return; }
            //Wait for a second for the command to clear
            System.Threading.Thread.Sleep(5000);
            //Close up the dome:  Connect, Home (so power is to the dome), Close the slit
            if (tsxd.IsConnected == 1)
            {
                //Move the dome to 20 degrees short of home
                tsxd.FindHome();
                System.Threading.Thread.Sleep(1000);
                while (tsxd.IsFindHomeComplete == 0)
                {
                    System.Threading.Thread.Sleep(5000);
                }
                ;
                System.Threading.Thread.Sleep(6000);
                //Close slit
                //Standard false stop avoidance code
                bool slitClosed = false;
                try
                {
                    tsxd.CloseSlit();
                    System.Threading.Thread.Sleep(10000);
                    while (tsxd.IsCloseComplete == 0)
                    {
                        System.Threading.Thread.Sleep(5000);
                    }
                    //Report success
                    slitClosed = true;
                }
                catch
                {
                    slitClosed = false;
                }

                //Check to see if slit got closed, if not, then try one more time
                if (!slitClosed)
                {
                    tsxd.CloseSlit();
                    System.Threading.Thread.Sleep(10000);
                    try
                    {
                        while (tsxd.IsCloseComplete == 0)
                        {
                            System.Threading.Thread.Sleep(5000);
                        }
                        //Report success
                    }
                    catch
                    {
                    }
                }
            }
            //disconnect dome controller
            tsxd.Disconnect();
        }