예제 #1
0
        private void ImageAbort_Click(object sender, EventArgs e)
        {
            //Stop the imaging, clean up form
            ccdsoftCamera tsxc = new ccdsoftCamera();

            tsxc.Abort();
            ImageButton.BackColor = Color.LightGreen;
            ImageAbort.Visible    = false;
            RepsBox.Value         = 1;
            return;
        }
예제 #2
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);
        }
예제 #3
0
 public void CameraAbort()
 {
     tsxc.Abort();
     return;
 }
예제 #4
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);
        }
예제 #5
0
/// Windows C# Sample Console Application: AutoGuide
///
/// ------------------------------------------------------------------------
///
///               Author: R.McAlister (2017)
///
/// ------------------------------------------------------------------------
///
/// This application performs the following steps:
///   Finds a target, M39 in this case
///   Turns off Autoguiding (if on)
///   Performs a Closed Loop Slew to the target
///   Takes an image with the Autoguide camera
///   Turns on Autoguiding
///
///

    public void AutoGuideSample()
    {
        ///Set connection to star chart and perform a find on M39 -- this will set the target for a CLS
        sky6StarChart tsx_sc = new sky6StarChart();

        tsx_sc.Find("M39");

        ///Create connection to autoguide camera and connect
        ccdsoftCamera tsx_ag = new ccdsoftCamera();

        ///Attach this object to the guider camera
        tsx_ag.Autoguider = 1;
        ///Find out with the guide camera is up to.  Abort if autoguiding or calibrating
        if (tsx_ag.Connect() == 0)
        {
            if ((tsx_ag.State == ccdsoftCameraState.cdStateAutoGuide) | (tsx_ag.State == ccdsoftCameraState.cdStateCalibrate))
            {
                tsx_ag.Abort();
            }
            ;
        }
        ;

        ///Create closed loop slew object
        ClosedLoopSlew tsx_cls = new ClosedLoopSlew();

        ///Set the exposure, filter to luminance and reduction, set the camera delay to 0 -- backlash
        /// should be picked up in the mount driver
        ccdsoftCamera tsx_cc = new ccdsoftCamera();

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

        ///run CLS synchronously
        ///tsx_cls.Asynchronous = False  ///-- this setting doesn///t appear to work (member not found) as of DB8458

        ///Execute
        try
        {
            int clsstat = tsx_cls.exec();
        }
        catch
        {    ///Just close up: TSX will spawn error window
            MessageBox.Show("Closed Loop Slew error");
            return;
            ///Let it go for demo purposes
        };

        ///Connect AutoGuide camera in case it isn///t
        try
        {
            tsx_ag.Connect();
        }
        catch
        {
            MessageBox.Show("Guide camera connect error");
            return;
        };
        ///Take an image to use for Autoguiding, run the function synchronously
        tsx_ag.ExposureTime = 2;
        tsx_ag.Asynchronous = 0;
        tsx_ag.Subframe     = 0;
        var tstat = tsx_ag.TakeImage(); ///Just assume it works

        ///Turn asynchronous back on to get out of this
        tsx_ag.Asynchronous = 1;
        ///Fire off Autoguiding
        tsx_ag.Autoguide();
        return;
    }