Exemplo n.º 1
0
    /// Windows C# Sample Console Application: Filter
    ///
    /// ------------------------------------------------------------------------
    ///               Vaguely adapted from Filter.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2009?)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates how to connect, change and disconnect a filter.  Along the way, most o
    ///  Along the way, most of the basic camera operating methods are also demonstrated.
    ///


    public void FilterSample()
    {
        ///Global Parameters
        double dExposure = 10.0; ///seconds
        int    ifilter   = 3;    ///4nd filter slot, probably clear/lumenscent      ///Create camera object and connect

        ccdsoftCamera tsx_cc = new ccdsoftCamera();

        tsx_cc.Connect();

        ///Set exposure length
        tsx_cc.ExposureTime = dExposure;

        ///Set frame type to Light frame
        tsx_cc.Frame = ccdsoftImageFrame.cdLight;

        ///Set filter
        tsx_cc.FilterIndexZeroBased = ifilter;

        ///Set preexposure delay
        tsx_cc.Delay = 5;  ///Possible filter change = 5 sec delay

        ///Set method type to Asynchronous (so we can demo the wait process)
        tsx_cc.Asynchronous = 0;

        ///Set for autodark
        tsx_cc.ImageReduction = ccdsoftImageReduction.cdAutoDark;

        ///Take image
        tsx_cc.TakeImage();

        ///Wait for completion (unnecessary if Asynchronous is set to "False"
        while (tsx_cc.State == ccdsoftCameraState.cdStateTakePicture)
        {
            System.Threading.Thread.Sleep(1000);
        }
        ;

        ///Clean up
        tsx_cc.Disconnect();
        return;
    }
Exemplo n.º 2
0
    /// Windows C# Sample Console Application: Cam
    ///
    /// ------------------------------------------------------------------------
    ///               Adapted from Cam.vbs  (Visual Basic Script)
    ///               Copyright (C) Software Bisque (2013)
    ///
    ///				Converted 2017, R.McAlister
    ///
    /// ------------------------------------------------------------------------
    ///
    /// This C# console application demonstrates the key elements of how to take images using the primary camera.

    public void CameraSample()
    {
        int iCamStatus;

        ///Create a TSX camera object
        ccdsoftCamera tsx_cam = new ccdsoftCamera();

        ///Connect TSX to the camera
        try {
            tsx_cam.Connect();
        }
        catch {
            MessageBox.Show("Camera Error");
            return;
        };


        ///Set the exposure time
        tsx_cam.ExposureTime = 15.0;
        ///SEt an exposure delay
        tsx_cam.Delay = 5.0;
        ///Set a frame type
        tsx_cam.Frame = ccdsoftImageFrame.cdLight;
        ///Set for autodark
        tsx_cam.ImageReduction = ccdsoftImageReduction.cdAutoDark;
        ///Set for synchronous imaging (this app will wait until done or error)
        tsx_cam.Asynchronous = 0;
        ///Take image
        iCamStatus = tsx_cam.TakeImage();
        if (iCamStatus != 0)
        {
            MessageBox.Show("Camera Error: " + iCamStatus.ToString());
        }
        ;

        ///Disconnect Camera
        tsx_cam.Disconnect();
    }
Exemplo n.º 3
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.º 4
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;
    }