Exemplo n.º 1
0
        public static bool SetTargetTracking(SpeedVector sv, double topo_Adjustment_RA, double topo_Adjustment_Dec)
        {
            const int ionTrackingOn  = 1;
            const int ionTrackingOff = 0;
            const int ignoreRates    = 1;
            const int useRates       = 0;

            double tgtRateRA     = sv.Rate_RA_CosDec_ArcsecPerMinute;
            double tgtRateDec    = sv.Rate_Dec_ArcsecPerMinute;
            double adjtgtRateRA  = tgtRateRA * topo_Adjustment_RA;
            double adjtgtRateDec = tgtRateDec * topo_Adjustment_Dec;

            sky6RASCOMTele tsxmt = new sky6RASCOMTele();

            tsxmt.Connect();
            //double dRA1 = tsxmt.dRaTrackingRate;
            //double dDec1 = tsxmt.dDecTrackingRate;
            try
            {
                //TSX expects tracking rates in arcsec/sec: convert it from arcsec/min
                tsxmt.SetTracking(ionTrackingOn, useRates, adjtgtRateRA / 60.0, adjtgtRateDec / 60.0);
            }
            catch
            {
                return(false);
            }
            //double dRA2 = tsxmt.dRaTrackingRate;
            //double dDec2 = tsxmt.dDecTrackingRate;
            return(true);
        }
Exemplo n.º 2
0
        static bool SlewToPosition(double starRA, double starDec)
        {
            //Moves the mount to center the calibration star in the guider FOV
            //Async slew to target (letting dome catch up), then CLS to align (does not coordinate with dome)
            //
            sky6RASCOMTele tsxm = new sky6RASCOMTele
            {
                Asynchronous = 0
            };

            if (tsxm.IsConnected == 0)
            {
                tsxm.Connect();
            }
            tsxm.SlewToRaDec(starRA, starDec, "Target Position");

            sky6StarChart  tsxsc     = new sky6StarChart();
            string         RADecname = starRA.ToString() + "," + starDec.ToString();
            ClosedLoopSlew tsxcls    = new ClosedLoopSlew();

            tsxsc.Find(RADecname);
            try
            { tsxcls.exec(); }
            catch (Exception ex)
            { return(false); }
            return(true);
        }
Exemplo n.º 3
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;
    }
Exemplo n.º 4
0
        /// <summary>
        /// TelescopePrePosition(side)
        /// Directs the mount to point either to the "East" or "West" side of the
        /// meridian at a location of 80 degrees altitude.  Used for autofocus routine
        /// and for starting off the target search
        /// </summary>
        /// <param name="side"></param>
        public void TelescopePrePosition(string side)
        {
            sky6RASCOMTele tsxm = new sky6RASCOMTele();

            //DeviceControl dctl = new DeviceControl();
            tsxm.Asynchronous = 0;
            tsxm.Connect();
            //dctl.DomeTrackingOff();
            if (side == "East")
            {
                tsxm.SlewToAzAlt(90.0, 80.0, "");
                while (tsxm.IsSlewComplete == 0)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            else
            {
                tsxm.SlewToAzAlt(270.0, 80.0, "");
                while (tsxm.IsSlewComplete == 0)
                {
                    System.Threading.Thread.Sleep(1000);
                }
            }
            //dctl.DomeTrackingOn();
            return;
        }
Exemplo n.º 5
0
        public bool TelescopeShutDown()
        //Method for connecting and parking the TSX mount
        {
            sky6RASCOMTele tsxm = new sky6RASCOMTele();

            if (tsxm.IsConnected == 0)
            {
                tsxm.Connect();
            }
            try { tsxm.Park(); }
            catch (Exception ex) { return(false); }
            return(true);
        }
Exemplo n.º 6
0
        public static bool SlewToTarget(string tgtName, SpeedVector sv)
        {
            sky6RASCOMTele tsxmt   = new sky6RASCOMTele();
            double         tgtRAH  = Transform.DegreesToHours(sv.RA_Degrees);
            double         tgtDecD = sv.Dec_Degrees;

            tsxmt.Connect();
            try
            {
                tsxmt.SlewToRaDec(tgtRAH, tgtDecD, tgtName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Slew Failed: " + ex.Message);
                return(false);
            }
            return(true);
        }
Exemplo n.º 7
0
        public bool CLSToTarget(SpeedVector sv)
        {
            int            clsStatus = 123;
            sky6RASCOMTele tsxmt     = new sky6RASCOMTele();
            ClosedLoopSlew tsx_cl    = new ClosedLoopSlew();
            sky6StarChart  tsxsc     = new sky6StarChart();
            //Clear any image reduction, otherwise full reduction might cause a problem
            ccdsoftCamera tsxcam = new ccdsoftCamera()
            {
                ImageReduction = ccdsoftImageReduction.cdNone,
                Asynchronous   = 1 //make sure nothing else happens while setting this up
            };

            //Abort any ongoing imaging
            tsxcam.Abort();

            double tgtRAH  = Transform.DegreesToHours(sv.RA_Degrees - RA_CorrectionD);
            double tgtDecD = sv.Dec_Degrees - Dec_CorrectionD;

            tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString());
            tsxmt.Connect();
            try
            {
                tsxmt.SlewToRaDec(tgtRAH, tgtDecD, TgtName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Slew to target failed: " + ex.Message);
                return(false);
            }
            //********** CLS AVOIDANCE CODE FOR SIMULATOR DEBUGGING PURPOSES
            //tsxsc.Find(TgtName);
            //return true;
            //*********************
            try
            { clsStatus = tsx_cl.exec(); }
            catch (Exception ex)
            {
                tsxsc.Find(TgtName);
                return(false);
            }
            tsxsc.Find(TgtName);
            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// TelescopePrePosition(side)
        /// Directs the mount to point either to the "East" or "West" side of the
        /// meridian at a location of 80 degrees altitude.  Used for autofocus routine
        /// and for starting off the galaxy search
        /// </summary>
        /// <param name="side"></param>
        public void TelescopePrePosition(string side)
        {
            sky6RASCOMTele tsxm = new sky6RASCOMTele();

            //DeviceControl dctl = new DeviceControl();
            tsxm.Asynchronous = 0;
            tsxm.Connect();
            //dctl.DomeTrackingOff();
            if (side == "East")
            {
                tsxm.SlewToAzAlt(90.0, 80.0, "");
            }
            else
            {
                tsxm.SlewToAzAlt(270.0, 80.0, "");
            }
            //dctl.DomeTrackingOn();
            return;
        }
Exemplo n.º 9
0
        public bool TelescopeStartUp()
        {
            //Method for connecting and initializing the TSX mount
            sky6RASCOMTele tsxm = new sky6RASCOMTele();

            if (tsxm.IsConnected == 0)
            {
                tsxm.Connect();
            }
            //If parked, try to unpark, if fails return false
            try { if (tsxm.IsParked())
                  {
                      tsxm.Unpark();
                  }
            }
            catch (Exception ex) { return(false); }
            //Otherwise return true;
            return(true);
        }
Exemplo n.º 10
0
        public static bool SetStandardTracking()
        {
            const int ionTrackingOn  = 1;
            const int ionTrackingOff = 0;
            const int ignoreRates    = 1;
            const int useRates       = 1; //Don't use rates

            sky6RASCOMTele tsxmt = new sky6RASCOMTele();

            tsxmt.Connect();
            try
            {
                tsxmt.SetTracking(ionTrackingOn, useRates, 0, 0);
            }
            catch
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 11
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;
    }
Exemplo n.º 12
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();
    }
Exemplo n.º 13
0
    /// 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;
    }
Exemplo n.º 14
0
        public static bool CLSToTarget(string tgtName, SpeedVector sv, bool IsPrecision = false)
        {
            //first, couple dome to telescope, if there is one
            sky6Dome tsxd = new sky6Dome();

            try
            {
                tsxd.Connect();
                tsxd.IsCoupled = 1;
            }
            catch (Exception ex)
            {
                //do nothing
            }

            int            clsStatus = 123;
            sky6RASCOMTele tsxmt     = new sky6RASCOMTele();
            ClosedLoopSlew tsx_cl    = new ClosedLoopSlew();
            sky6StarChart  tsxsc     = new sky6StarChart();
            sky6Utils      tsxu      = new sky6Utils();
            //Check to see if target is above horizon
            double tgtRAH  = Transform.DegreesToHours(sv.RA_Degrees);
            double tgtDecD = sv.Dec_Degrees;

            tsxu.ConvertRADecToAzAlt(tgtRAH, tgtDecD);
            double tgtAzmD = tsxu.dOut0;
            double tgtAltD = tsxu.dOut1;

            if (tgtAltD <= 0)
            {
                MessageBox.Show("Slew failure: Target is below the horizon");
                return(false);
            }
            //Clear any image reduction, otherwise full reduction might cause a problem
            ccdsoftCamera tsxcam = new ccdsoftCamera()
            {
                ImageReduction = ccdsoftImageReduction.cdNone,
                Asynchronous   = 1 //make sure nothing else happens while setting this up
            };

            //Abort any ongoing imaging
            tsxcam.Abort();

            bool returnStatus = true;
            // diagnostic
            string strRA  = Utils.HourString(tgtRAH, false);
            string strDec = Utils.DegreeString(tgtDecD, false);

            //
            tsxsc.Find(tgtRAH.ToString() + ", " + tgtDecD.ToString());
            tsxmt.Connect();
            tsxu.Precess2000ToNow(tgtRAH, tgtDecD);
            double jnRAH  = tsxu.dOut0;
            double jnDecD = tsxu.dOut1;

            //tsxmt.Asynchronous = 0;
            try
            {
                tsxmt.SlewToRaDec(jnRAH, jnDecD, tgtName);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Slew Failure: " + ex.Message);
                returnStatus = false;
            }
            if (IsPrecision && returnStatus)
            {
                //***  precision slew
                try
                {
                    clsStatus = tsx_cl.exec();
                }
                catch (Exception ex)
                {
                    returnStatus = false;
                }
            }
            try
            {
                tsxsc.Find(tgtName);
            }
            catch (Exception ex)
            {
                returnStatus = true;
            }
            return(returnStatus);
        }
Exemplo n.º 15
0
/// Windows C# Sample Console Application: AutoFocus
///
/// ------------------------------------------------------------------------
///
///               Author: R.McAlister (2017)
///
/// ------------------------------------------------------------------------
///
/// This application performs the following steps:
///   Saves the current target and imaging parameters
///   Turns off Autoguiding (if on)
///   Turns on AutoFocus
///   Returns to the current target

/// Note that "Automatically slew telescope to nearest appropriate focus star" must be checked in the @Focus2 start-up window.
///

    public void AutoFocusSample()
    {
        int iFilter = 3; ///Luminescent, I hope

        ///Connect the telescope for some slewing
        sky6RASCOMTele tsx_tt = new sky6RASCOMTele();

        tsx_tt.Connect();

        ///Work around and Run @Focus2
        ///   Save current target name so it can be found again
        ///   Run @Focus2 (which preempts the observating list and object)
        ///   Restore current target, using Name with Find method
        ///   ClosedLoopSlew back to target

        ccdsoftCamera tsx_cc = new ccdsoftCamera();

        tsx_cc.Connect();
        tsx_cc.focConnect();

        ///Get current target name so we can return after running @focus2
        sky6ObjectInformation tsx_oi = new sky6ObjectInformation();

        tsx_oi.Property(Sk6ObjectInformationProperty.sk6ObjInfoProp_NAME1);
        string sTargetName = tsx_oi.ObjInfoPropOut;

        ///TBD: Set up parameters for @Focus2, if necessary
        ///
        ///Run Autofocus
        ///   Create a camera object
        ///   Launch the autofocus watching out for an exception -- which will be posted in TSX

        ///Save current camera delay, exposure and filter
        /// then set the camera delay = 0
        /// set the delay back when done with focusing

        tsx_cc.AutoSaveFocusImages = 0;
        var dCamDelay     = tsx_cc.Delay;
        var iCamReduction = tsx_cc.ImageReduction;
        var iCamFilter    = tsx_cc.FilterIndexZeroBased;
        var dCamExp       = tsx_cc.ExposureTime;
        var iFocStatus    = 0;

        tsx_cc.ImageReduction       = ccdsoftImageReduction.cdAutoDark;
        tsx_cc.FilterIndexZeroBased = 3; ///Luminance
        tsx_cc.ExposureTime         = 10;
        tsx_cc.Delay = 0;
        tsx_cc.FilterIndexZeroBased = iFilter;

        iFocStatus = tsx_cc.AtFocus2();

        ///Restore the current target and slew back to it
        ///   Run a Find on the target -- which makes it the "observation"
        ///   Perform Closed Loop Slew to the target

        sky6StarChart tsx_sc = new sky6StarChart();

        tsx_sc.Find(sTargetName);
        ///Run a Closed Loop Slew to return
        ClosedLoopSlew tsx_cls = new ClosedLoopSlew();

        ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- any backlash
        /// should be picked up in the mount driver
        tsx_cc.ImageReduction       = ccdsoftImageReduction.cdAutoDark;
        tsx_cc.FilterIndexZeroBased = iFilter; ///Luminance, probably
        tsx_cc.ExposureTime         = 10;
        tsx_cc.Delay = 0;
        try
        {
            var clsstat = tsx_cls.exec();
        }
        catch
        {
            ///Just close up: TSX will spawn error window
            ///System.Windows.Forms.Show("AutoFocus return failure")
        };
        ///Put back the orginal settings

        tsx_cc.ImageReduction       = iCamReduction;
        tsx_cc.FilterIndexZeroBased = iCamFilter;
        tsx_cc.ExposureTime         = dCamExp;
        tsx_cc.Delay = dCamDelay;

        return;
    }