Exemple #1
0
        /// <summary> 
        /// Class constructor 
        /// </summary> 
        /// <param name="ip"> ip address of the robot </param> 
        /// <param name="format"> image format to use </param> 
        /// <param name="colorSpace"> color space to use </param> 
        /// <param name="FPS"> FPS to use </param> 
        /// <param name="currentCamera"> instance of the camera class to use 
        /// <param name="currentStorage"> instance of the DataStorage class to use 
        public GetFrame(string ip, NaoCamImageFormat format, int colorSpace, int 
FPS, Camera currentCamera, DataStorage currentStorage) 
        { 
            naoCam = currentCamera; 
            storage = currentStorage; 
 
            naoCam.connect(ip, format, colorSpace, FPS); 
        } 
Exemple #2
0
        /// <summary> 
        /// Class constructor, starts getting frames from the robot 
        /// and makes a connection to the motion and audio classes 
        /// </summary> 
        /// <param name="ip"> ip address of the NAO robot </param> 
        public _640window(string ip) 
        { 
            InitializeComponent(); 
 
            // puts the IP in the ipBox so the user knows which NAO the program is connected to 
            ipBox.Text = ip; 
 
            // call the Camera constuctor, and set the image format to 640x480 
            naoCam = new Camera(); 
            currentFormat = naoCam.NaoCamImageFormats[2]; 
            HDFormat = naoCam.NaoCamImageFormats[3]; 
 
            // call the Motion constructor 
            naoMotion = new Motion();  
 
            // call the Audio constructor 
            naoAudio = new Audio(); 
 
            // create timer to display recording time 
            recordingTimer.Interval = new TimeSpan(0,0,1); 
            recordingTimer.Tick += new EventHandler(recordingTimeIncrease); 
 
            try // attempt to connect to the camera and motion system 
            { 
                // connect to the NAO Motion API 
                naoMotion.connect(ipBox.Text); 
 
                // create the newFrames instance of the getFrames class 
                newFrames = new GetFrame(ipBox.Text, currentFormat, COLOR_SPACE, FPS, naoCam, storage); 
 
                // create a new thread to allow frame acquisition to occur without interrupting UI smoothness 
                frameThread = new Thread(new ThreadStart(newFrames.grabFrame)); 
 
                // start the thread 
                frameThread.Start(); 
 
                // Create a timer for event based frame acquisition.  
                // Program will get new frame from storage based on FPS 
                dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 
(int)Math.Ceiling(1000.0 / 30)); 
                dispatcherTimer.Start(); 
 
                // whenever the timer ticks the bitmapReady event is called 
                dispatcherTimer.Tick += new EventHandler(bitmapReady); 
 
                // let rest of program know that camera is ready 
                isCamInitialized = true; 
            } 
            catch (Exception ex) 
            { 
                isCamInitialized = false; 
 
                // display error message and write exceptions to a file 
                MessageBox.Show("Exception occurred, error log in C:\\NAOcam\\exception.txt"); 
                System.IO.File.WriteAllText(@"C:\\NAOcam\\exception.txt", ex.ToString()); 
            } 
        } 
Exemple #3
0
        /// <summary> 
        /// constuctor for MainWindow 
        /// </summary> 
        public MainWindow() 
        { 
            InitializeComponent(); 
 
            // call the Camera constuctor, and set the image format to 640x480 
            naoCam = new Camera(); 
 
            // call the Motion constructor 
            naoMotion = new Motion(); 
 
            currentFormat = naoCam.NaoCamImageFormats[2]; 
 
            // Make sure the standard output directory exists 
            if (!System.IO.Directory.Exists("C:\\NAOserver\\")) 
            { 
                System.IO.Directory.CreateDirectory("C:\\NAOserver\\"); 
            } 
        } 
Exemple #4
0
        /// <summary> 
        /// constuctor for MainWindow 
        /// </summary> 
        public MainWindow() 
        { 
            InitializeComponent(); 
 
            // call the Camera constuctor, and set the image format to 320x240  
            naoCam = new Camera(); 
 
            // call the Motion constructor 
            naoMotion = new Motion();

            // call the Audio constructor 
            naoAudio = new Audio(); 
 
            currentFormat = naoCam.NaoCamImageFormats[1]; //angka 1 menunjukkan res 320x240
 
            // Make sure the standard output directory exists 
            if (!System.IO.Directory.Exists("C:\\NAOserver\\")) 
            { 
                System.IO.Directory.CreateDirectory("C:\\NAOserver\\"); 
            } 
        }