Пример #1
0
        public override void Run(string initial_command)
        {
            bool cameras_started = true;
            bool retry           = true;
            int  tries           = 0;

            usage.Update("Run, SurveyorVisionStereo, Run");

            while ((retry) && (tries < 4))
            {
                tries++;

                // start running the cameras
                for (int cam = 0; cam < 2; cam++)
                {
                    camera[cam].fps = fps;
                    if (cam == 0)
                    {
                        camera[cam].send_command = initial_command;
                    }
                    camera[cam].Start(host, port_number[cam]);
                    if (camera[cam].Running)
                    {
                        camera[cam].StartStream();
                        usage.Update("Camera " + cam.ToString() + " stream sterted, SurveyorVisionStereo, Run");
                    }
                    else
                    {
                        usage.Update("Camera " + cam.ToString() + " not running, SurveyorVisionStereo, Run");

                        Console.WriteLine("Camera " + cam.ToString() + " not running");
                        cameras_started = false;
                        break;
                    }
                }

                if (cameras_started)
                {
                    // create a thread to send the master pulse
                    grab_frames          = new SurveyorVisionThreadGrabFrameMulti(new WaitCallback(FrameGrabCallbackMulti), this);
                    sync_thread          = new Thread(new ThreadStart(grab_frames.Execute));
                    sync_thread.Priority = ThreadPriority.Normal;
                    Running = true;
                    sync_thread.Start();
                    retry = false;
                    Console.WriteLine("Stereo camera active on " + host);
                    usage.Update("Stereo camera active, SurveyorVisionStereo, Run");
                }
                else
                {
                    usage.Update("Stereo camera not started, SurveyorVisionStereo, Run");
                    Console.WriteLine("Cameras not started");
                }
            }
        }
Пример #2
0
        public override void Run(string initial_command)
        {
            bool cameras_started = true;
			bool retry = true;
			int tries = 0;

            usage.Update("Run, SurveyorVisionStereo, Run");
			
			while ((retry) && (tries < 4))
			{
				tries++;
            
	            // start running the cameras
	            for (int cam = 0; cam < 2; cam++)
	            {
	                camera[cam].fps = fps;
                    if (cam == 0) camera[cam].send_command = initial_command;
	                camera[cam].Start(host, port_number[cam]);
	                if (camera[cam].Running)
	                {
	                    camera[cam].StartStream();
                        usage.Update("Camera " + cam.ToString() + " stream sterted, SurveyorVisionStereo, Run");
	                }
	                else
	                {
                        usage.Update("Camera " + cam.ToString() + " not running, SurveyorVisionStereo, Run");
                        
                        Console.WriteLine("Camera " + cam.ToString() + " not running");
	                    cameras_started = false;
	                    break;
	                }
	            }
	            
	            if (cameras_started)
	            {
	                // create a thread to send the master pulse
	                grab_frames = new SurveyorVisionThreadGrabFrameMulti(new WaitCallback(FrameGrabCallbackMulti), this);        
	                sync_thread = new Thread(new ThreadStart(grab_frames.Execute));
	                sync_thread.Priority = ThreadPriority.Normal;
                    Running = true;
	                sync_thread.Start();   
					retry = false;
	                Console.WriteLine("Stereo camera active on " + host);
                    usage.Update("Stereo camera active, SurveyorVisionStereo, Run");
	            }
				else
				{
                    usage.Update("Stereo camera not started, SurveyorVisionStereo, Run");
					Console.WriteLine("Cameras not started");
				}
			}
        }