コード例 #1
0
        static void Main(string[] args)
        {
            string host = "localhost";

            if (args.Length > 0)
            {
                host = args[0];
            }
            try
            {
                using (Guider guider = Guider.Factory(host))
                {
                    guider.Connect();
                    var s = guider.GetStats();

                    double settlePixels  = 2.0;
                    double settleTime    = 20.0;
                    double settleTimeout = 60.0;

                    for (;;)
                    {
                        string state;
                        double avgDist;
                        guider.GetStatus(out state, out avgDist);

                        Console.WriteLine("{0} dist={1:F1}",
                                          state, avgDist);

                        Thread.Sleep(2000);
                        if (state == "LostLock" || state == "Looping")
                        {
                            guider.StopCapture();
                            Thread.Sleep(5000);
                            guider.Guide(settlePixels, settleTime, settleTimeout);
                            WaitForSettleDone(guider);
                            Thread.Sleep(5000);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("Error: {0}", err.Message);
            }

            Console.ReadLine();
        }
コード例 #2
0
ファイル: clsPhd.cs プロジェクト: mtodman/Nite-Opps
 public override void StopCapture(uint timeoutSeconds)
 {
     guider.StopCapture(timeoutSeconds);
     // throw new NotSupportedException(
     //    "The StopCapture() method was called on a class which does not support that method.");
 }
コード例 #3
0
        static void Main(string[] args)
        {
            string host = "localhost";

            if (args.Length > 0)
            {
                host = args[0];
            }

            try
            {
                using (Guider guider = Guider.Factory(host))
                {
                    // connect to PHD2

                    guider.Connect();

                    // get the list of equipment profiles

                    foreach (var p in guider.GetEquipmentProfiles())
                    {
                        Console.WriteLine("profile: {0}", p);
                    }

                    // connect equipment in profile "Simulator"

                    string profile = "Simulator";
                    Console.WriteLine("connect profile {0}", profile);

                    guider.ConnectEquipment(profile);

                    // start guiding

                    double settlePixels  = 2.0;
                    double settleTime    = 10.0;
                    double settleTimeout = 100.0;

                    Console.WriteLine("guide");

                    guider.Guide(settlePixels, settleTime, settleTimeout);

                    // wait for settling to complete

                    WaitForSettleDone(guider);

                    // monitor guiding for a little while

                    for (int i = 0; i < 15; i++)
                    {
                        GuideStats stats = guider.GetStats();

                        string state;
                        double avgDist;
                        guider.GetStatus(out state, out avgDist);

                        Console.WriteLine("{0} dist={1:F1} rms={2:F1} ({3:F1}, {4:F1}) peak = {5:F1}, {6:F1}",
                                          state, avgDist,
                                          stats.rms_tot, stats.rms_ra, stats.rms_dec, stats.peak_ra, stats.peak_dec);

                        System.Threading.Thread.Sleep(1000);
                    }

                    // Pause/resume guiding

                    Console.WriteLine("pause for 5s");
                    guider.Pause();
                    System.Threading.Thread.Sleep(5000);
                    Console.WriteLine("un-pause");
                    guider.Unpause();

                    // dither

                    double ditherPixels = 3.0;

                    Console.WriteLine("dither");

                    guider.Dither(ditherPixels, settlePixels, settleTime, settleTimeout);

                    // wait for settle

                    WaitForSettleDone(guider);

                    // stop guiding

                    Console.WriteLine("stop\n");

                    guider.StopCapture();

                    // disconnect from PHD2 (optional in this case since we've got a using() block to take care of it)
                    guider.Close();
                }
            }
            catch (Exception err)
            {
                Console.WriteLine("Error: {0}", err.Message);
            }
        }