Beispiel #1
0
        public static bool OpenDome(int domeHomeAz)
        {
            //Method to open dome
            //Assume the dome is properly positioned for power
            //Position the dome with at home (wipers on pads)
            // open the dome shutter
            sky6RASCOMTele tsxt = new sky6RASCOMTele();

            //Make sure dome is connected and decoupled
            IsDomeCoupled = false;
            //Disconnect the mount
            tsxt.Disconnect();

            sky6Dome tsxd = new sky6Dome();

            try { tsxd.Connect(); }
            catch { return(false); }
            //Stop whatever the dome might have been doing, if any and wait a few seconds for it to clear
            try { tsxd.Abort(); }
            catch { }
            System.Threading.Thread.Sleep(10);
            //Goto home position using goto rather than home
            ReliableGoTo(domeHomeAz);
            //Open Slit
            tsxd.OpenSlit();
            System.Threading.Thread.Sleep(10);  //Workaround for problme in TSX
            while (tsxd.IsOpenComplete == 0)
            {
                System.Threading.Thread.Sleep(1000);
            }                                                                         //one second wait loop
            IsDomeCoupled = true;
            return(true);
        }
Beispiel #2
0
    /// Windows C# Sample Console Application: Solar
    ///
    /// ------------------------------------------------------------------------
    ///               Vaguely adapted from Solar.vbs
    ///               Copyright Software Bisque
    ///
    ///               Converted by:  R.McAlister 2017
    ///
    /// ------------------------------------------------------------------------
    ///
    ///Very simple demonstration application that targets the telescope on the Sun -- careful now.
    ///
    ///  Note:  this is basically simplification of "ListSearch.vb" where the only target is the Sun.
    ///
    ///


    public void SolarSample()
    {
        ///Target Sun
        string target = "Sun";

        ///Create Objects
        sky6StarChart         tsx_sc = new sky6StarChart();
        sky6RASCOMTele        tsx_ts = new sky6RASCOMTele();
        sky6ObjectInformation tsx_oi = new sky6ObjectInformation();

        ///Connect telescope
        tsx_ts.Connect();

        tsx_sc.Find(target);
        tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT);
        double dAlt = tsx_oi.ObjInfoPropOut;

        tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_AZM);
        double dAz = tsx_oi.ObjInfoPropOut;

        try {
            tsx_ts.SlewToAzAlt(dAz, dAlt, target);
        }
        catch {
            MessageBox.Show("An error has occurred running slew");
            return;
        };
        MessageBox.Show("The Sun's location is at: Altitude: " + dAlt.ToString() + "  Azimuth: " + dAz.ToString());

        ///Disconnect telesope
        tsx_ts.Disconnect();
        return;
    }
Beispiel #3
0
    /// Windows C# Sample Console Application: Tele
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from Tele.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2009?)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application exercises the telescope class functions
    ///

    public void TeleSample()
    {
        ///Use TheSky to generate a text file of mapping points
        string szPathToMapFile = "C:\\Users\\Rick\\Documents\\Software Bisque\\TheSkyX Professional Edition\\Exported Data\\map.txt";

        ///Set the exposure time for the image
        double dExposure = 1.0;

        ;
        ///Create the telescope object
        sky6RASCOMTele tsx_ts = new sky6RASCOMTele();

        ///Connect to the telescope
        tsx_ts.Connect();

        ///See if connection failed
        if (tsx_ts.IsConnected == 0)
        {
            MessageBox.Show("Connection failed.");
            return;
        }

        ///Get and show the current telescope ra, dec
        tsx_ts.GetRaDec();
        MessageBox.Show("Ra,Dec =" + tsx_ts.dRa.ToString() + ",  " + tsx_ts.dDec.ToString());

        ///Get and show the current telescope az, alt
        tsx_ts.GetAzAlt();
        MessageBox.Show("Az,Alt=" + tsx_ts.dAz.ToString() + ",  " + tsx_ts.dAlt.ToString());

        ///Goto an arbitrary RA and Dec
        tsx_ts.SlewToRaDec(2.0, 3.0, "Home");
        MessageBox.Show("GotoComplete");

        ///Sync on an ra dec
        tsx_ts.Sync(3.0, 3.0, "Matt");

        ///Disconnect the telscope
        tsx_ts.Disconnect();
        return;
    }
    /// Windows C# Sample Console Application: StarChartSetWW
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from TheSkySetWW.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2009?)
    ///
    ///				Converted 2014, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application exercises the Star Chart class functions for setting
    ///   Timne, Time Zone, Location, etc.
    ///

    public void StarChartSetWWSample()
    {
        double dJD   = 2452066.0; ///=06/05/2001, ignored if UseCompterClock=1
        double dTZ   = 7;         ///MST
        double dElev = 1000;      ///meters
        double dLat  = 39.5;
        double dLong = 105.5;
        string szLoc = "Location from script";

        ///Create Telescope Object and disconnect telescope -- time changes are not enabled with scope connected
        sky6RASCOMTele tsx_ts = new sky6RASCOMTele();

        tsx_ts.Disconnect();

        ///Create the Star Chart object
        sky6StarChart tsx_sc = new sky6StarChart();

        ///Turn off the Computer Clock
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_UseComputerClock, 0);

        ///Change the julian date
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow, dJD);

        ///Change the time zone
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Time_Zone, dTZ);

        ///Change the elevation
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_ElevationInMeters, dElev);

        ///Change the latitude
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Latitude, dLat);

        ///Change the longitude
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_Longitude, dLong);

        ///Change the location description
        tsx_sc.SetDocumentProperty(Sk6DocumentProperty.sk6DocProp_LocationDescription, szLoc);

        return;
    }
Beispiel #5
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);
        }
Beispiel #6
0
    public void AutomatedSearchSample()
    {
        /// ********************************************************************************
        /// *
        /// * Below is the flow of program execution
        /// * See the subroutine TargetLoop to see where the real work is done

        ///Create Objects

        sky6RASCOMTele tsx_tele = new sky6RASCOMTele();
        ccdsoftCamera  tsx_cam  = new ccdsoftCamera();

        ///Connect Objects
        try {
            tsx_tele.Connect();
        }
        catch {
            MessageBox.Show("Telescope Connect Error");
            return;;
        };

        try {
            tsx_cam.Connect();
        }
        catch {
            MessageBox.Show("Camera Connection Error");
            return;;
        }

        ///Run the target loop
        TargetLoop();

        ///Disconnect objects
        tsx_tele.Disconnect();
        tsx_cam.Disconnect();
    }
    /// Windows C# Sample Console Application: ListSearch
    ///
    /// ------------------------------------------------------------------------
    ///               Vaguely adapted from ErrorHandling.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2013)
    ///
    ///				Converted 2015, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates how to run the telescope through a list of targets as defined
    ///   by a list of names.
    ///
    ///  Note:  The gist of the orginal VBS script was entitled "ErrorHandling.vbs".  However, that
    ///  script, however labeled, performed the functions as adapted to VB herein.
    ///


    public void ListSearchSample()
    {
        ///Set the exposure time for the image
        double dExposure = 1.0;

        ///Target List
        string[] targetlist = new string[] {
            "NGC1348",
            "NGC1491",
            "NGC1708",
            "NGC179",
            "NGC1798",
            "NGC2165",
            "NGC2334",
            "NGC2436",
            "NGC2519",
            "NGC2605",
            "NGC2689",
            "NGC2666",
            "NGC4381",
            "NGC5785",
            "NGC5804",
            "NGC6895",
            "NGC6991",
            "NGC7011",
            "NGC7058",
            "M39",
            "NGC7071",
            "NGC7150",
            "NGC7295",
            "NGC7394",
            "NGC7686",
            "NGC7801"
        };

        ///Create objects

        sky6StarChart         objChrt = new sky6StarChart();
        sky6RASCOMTele        objTele = new sky6RASCOMTele();
        ccdsoftCamera         objCam  = new ccdsoftCamera();
        sky6Utils             objUtil = new sky6Utils();
        sky6ObjectInformation objInfo = new sky6ObjectInformation();

        ///Connect Objects
        objTele.Connect();
        objCam.Connect();

        ///Run loop over array of target names
        double dAlt;
        double dAz;
        bool   iError;

        foreach (string target in targetlist)
        {
            objChrt.Find(target);
            objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_ALT);
            dAlt = objInfo.ObjInfoPropOut;
            objInfo.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_AZM);
            dAz = objInfo.ObjInfoPropOut;

            try
            {
                objTele.SlewToAzAlt(dAz, dAlt, target);
            }
            catch
            {
                MessageBox.Show("An error has occurred running slew");
                return;
            };

            ///Set exposure time and try for image, exit if error
            objCam.ExposureTime = dExposure;
            try
            {
                objCam.TakeImage();
            }
            catch
            {
                MessageBox.Show("An error has occurred running image");
            };
        }

        ///Disconnect telescope and camera
        objTele.Disconnect();
        objCam.Disconnect();
        return;
    }
Beispiel #8
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();
        }