Esempio n. 1
0
        private void btnSetStartPoint_Click(JaguarCtrl jc, object sender, EventArgs e)
        {
            cam = new CameraInfoGE();
            double centerLat  = double.Parse(centerLatitude);
            double centerLong = double.Parse(centerLongitude);

            try
            {
                centerLat = double.Parse(jc.txtStartLat.Text);
            }
            catch
            {
            }
            try
            {
                centerLong = double.Parse(jc.txtStartLong.Text);
            }
            catch
            {
            }

            centerLat = (centerLat > 90 ? 90 : centerLat);
            centerLat = (centerLat < -90 ? -90 : centerLat);

            centerLong              = (centerLong > 180 ? 180 : centerLong);
            centerLong              = (centerLong < -180 ? -180 : centerLong);
            cam.FocusPointLatitude  = centerLat;
            cam.FocusPointLongitude = centerLong;
            cam.FocusPointAltitude  = 0;
            cam.Range = cameraRange;
            cam.Tilt  = 0;


            googleEarth.SetCamera(cam, 0.6);
        }
Esempio n. 2
0
        public void Initialize(JaguarCtrl jc)
        {
            centerLatitude       = jc.jaguarSetting.GoogleEarthStartLat.ToString();
            centerLongitude      = jc.jaguarSetting.GoogleEarthStartLong.ToString();
            jc.txtStartLat.Text  = centerLatitude;
            jc.txtStartLong.Text = centerLongitude;
            if (true)//(jc.DesignMode == false)
            {
                googleEarth = new ApplicationGEClass();

                MessageBox.Show("Waiting for GoogleEarth to be loaded…. \n This may take a while.When the GoogleEarth is shown, click OK to continue.", "DrRobot Jaguar Control", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //ShowWindowAsync(googleEarth.GetMainHwnd(), 0);

                GEHrender       = (IntPtr)googleEarth.GetRenderHwnd();
                GEParentHrender = GetParent(GEHrender);

                MoveWindow(GEHrender, 0, 0, jc.panelGE.Width, jc.panelGE.Height, true);
                SetParent(GEHrender, jc.panelGE.Handle);



                // don'tdo it now , we keep google earth window to clear the KML data in temporary node
                //Hide the main GE window
                //SetWindowPos(googleEarth.GetMainHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE + SWP_HIDEWINDOW);
            }
        }
Esempio n. 3
0
 //this is a zoom function
 private void trackBarZoom_Scroll(JaguarCtrl jc, object sender, EventArgs e)
 {
     if (cam != null)
     {
         cameraRange = jc.trackBarZoom.Value;
         cam.Range   = cameraRange;
         googleEarth.SetCamera(cam, 0.6);
     }
 }
Esempio n. 4
0
        // Constructor for the Navigation class
        public Navigation(JaguarCtrl jc)
        {
            // Initialize vars
            jaguarControl = jc;
            realJaguar = jc.realJaguar;
            simulatedJaguar = jc.simulatedJaguar;
            this.Initialize();

            // Start Control Thread
            controlThread = new Thread(new ThreadStart(runControlLoop));
            controlThread.Start();
        }
Esempio n. 5
0
        // this function will set map center as default map start point
        private void btnSetMapCenter_Click(JaguarCtrl jc, object sender, EventArgs e)
        {
            PointOnTerrainGE pointGe = new PointOnTerrainGE();

            pointGe = googleEarth.GetPointOnTerrainFromScreenCoords(0, 0);


            double lat       = pointGe.Latitude;
            double longitude = pointGe.Longitude;

            jc.txtStartLat.Text  = lat.ToString();
            jc.txtStartLong.Text = longitude.ToString();

            btnSetStartPoint_Click(jc, null, null);
        }
Esempio n. 6
0
        // Constructor for the Navigation class
        public Navigation(JaguarCtrl jc)
        {
            // Initialize vars
            jaguarControl       = jc;
            realJaguar          = jc.realJaguar;
            simulatedJaguar     = jc.simulatedJaguar;
            map                 = new Map();
            particles           = new Particle[numParticles];
            propagatedParticles = new Particle[numParticles];
            // Create particles
            for (int i = 0; i < numParticles; i++)
            {
                particles[i]           = new Particle();
                propagatedParticles[i] = new Particle();
            }

            this.Initialize();


            // Start Control Thread
            controlThread = new Thread(new ThreadStart(runControlLoop));
            controlThread.Start();
        }
Esempio n. 7
0
        public void Close(JaguarCtrl jc, RobotConfig robotCfg, string configFile)
        {
            double centerLat  = double.Parse(centerLatitude);
            double centerLong = double.Parse(centerLongitude);

            try
            {
                centerLat = double.Parse(jc.txtStartLat.Text);
            }
            catch
            {
            }
            try
            {
                centerLong = double.Parse(jc.txtStartLong.Text);
            }
            catch
            {
            }

            jc.jaguarSetting.GoogleEarthStartLat  = centerLat;
            jc.jaguarSetting.GoogleEarthStartLong = centerLong;
            try
            {
                robotCfg.WriteXml(configFile);
            }
            catch
            {
            }
            try
            {
                PostMessage(googleEarth.GetMainHwnd(), WM_QUIT, 0, 0);
            }
            catch
            {
            }
        }
        private void connectRobot()
        {
            //save any change to xml file
            row.LaserRangeIP = txtRobotIP.Text;
            
            row.RobotID = txtRobotID.Text;
            row.RobotIP = txtRobotIP.Text;
            row.GPSIP = txtGPSIP.Text;
            row.IMUIP = txtGPSIP.Text;
            row.CameraIP = txtCameraIP.Text;
            //row.CameraPWD = txtCameraPWD.Text;
            row.CameraUser = txtCameraID.Text;
            
            try
            {
                robotConfig.WriteXml(configFile);
            }
            catch
            {
            }
            //write gateway config file 
            XmlTextWriter textWriter = new XmlTextWriter("C:\\DrRobotAppFile\\gatewayConfig.xml", null);
            textWriter.WriteStartDocument();
            // Write comments
            textWriter.WriteComment("For Gateway Communication");
            // Write first element
            textWriter.WriteStartElement("GateWaySetting", "");
            // Write next element
            textWriter.WriteStartElement("RobotID", "");
            textWriter.WriteString(row.RobotID);
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotMethod", "");
            textWriter.WriteString("WiFi");
            //textWriter.WriteString("Serial");
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotCom", "");
            textWriter.WriteString("COM1");
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotIP", "");
            textWriter.WriteString(row.RobotIP);
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotPort", "");
            textWriter.WriteString("10001");
            textWriter.WriteEndElement();

            // Ends the document.
            textWriter.WriteEndElement();
            textWriter.WriteEndDocument();
            // close writer
            textWriter.Close();
            Thread.Sleep(1000);
            //start one gateway         
            p1 = new Process();
            p1.StartInfo.FileName = "C:\\DrRobotAppFile\\WirobotGateway.exe";
            p1.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
            p1.Start();

            Thread.Sleep(1000);
            controlForm = new JaguarCtrl(this, robotConfig);
            controlForm.Show();
        }
Esempio n. 9
0
        // Constructor for the Navigation class
        public Navigation(JaguarCtrl jc)
        {
            // Initialize vars
            jaguarControl = jc;
            realJaguar = jc.realJaguar;
            simulatedJaguar = jc.simulatedJaguar;
            genAlg_ = new Genetic(numGenerations, popSize, mutationRate, mutationFactor, this, numParents, maxSteps);
            this.Initialize();

            // Start Control Thread
            controlThread = new Thread(new ThreadStart(runControlLoop));
            controlThread.Start();
        }
Esempio n. 10
0
        // Constructor for the Navigation class
        public Navigation(JaguarCtrl jc)
        {
            // Initialize vars
            jaguarControl = jc;
            realJaguar = jc.realJaguar;
            simulatedJaguar = jc.simulatedJaguar;
            //genAlg_ = new Genetic(numGenerations, popSize, mutationRate, mutationFactor, this, numParents, maxSteps);
            map = new Map();
            particles = new Particle[numParticles];
            propagatedParticles = new List<Particle>(numParticles);
            // Create particles
            for (int i = 0; i < numParticles; i++)
            {
                particles[i] = new Particle();
                propagatedParticles.Add(new Particle());
            }

            this.Initialize();

            // Start Control Thread
            controlThread = new Thread(new ThreadStart(runControlLoop));
            controlThread.Start();
        }
Esempio n. 11
0
        public void Close(JaguarCtrl jc, RobotConfig robotCfg, string configFile)
        {
            double centerLat = double.Parse(centerLatitude);
            double centerLong = double.Parse(centerLongitude);
            try
            {
                centerLat = double.Parse(jc.txtStartLat.Text);
            }
            catch
            {
            }
            try
            {
                centerLong = double.Parse(jc.txtStartLong.Text);
            }
            catch
            {
            }

            jc.jaguarSetting.GoogleEarthStartLat = centerLat;
            jc.jaguarSetting.GoogleEarthStartLong = centerLong;
            try
            {
                robotCfg.WriteXml(configFile);
            }
            catch
            {
            }
            try
            {
                PostMessage(googleEarth.GetMainHwnd(), WM_QUIT, 0, 0);
            }
            catch
            {
            }

        }
Esempio n. 12
0
        public void Initialize(JaguarCtrl jc)
        {

            centerLatitude = jc.jaguarSetting.GoogleEarthStartLat.ToString();
            centerLongitude = jc.jaguarSetting.GoogleEarthStartLong.ToString();
            jc.txtStartLat.Text = centerLatitude;
            jc.txtStartLong.Text = centerLongitude;
            if (true)//(jc.DesignMode == false)
            {
                googleEarth = new ApplicationGEClass();

                MessageBox.Show("Waiting for GoogleEarth to be loaded…. \n This may take a while.When the GoogleEarth is shown, click OK to continue.", "DrRobot Jaguar Control", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //ShowWindowAsync(googleEarth.GetMainHwnd(), 0);

                GEHrender = (IntPtr)googleEarth.GetRenderHwnd();
                GEParentHrender = GetParent(GEHrender);

                MoveWindow(GEHrender, 0, 0, jc.panelGE.Width, jc.panelGE.Height, true);
                SetParent(GEHrender, jc.panelGE.Handle);



                // don'tdo it now , we keep google earth window to clear the KML data in temporary node
                //Hide the main GE window
                //SetWindowPos(googleEarth.GetMainHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE + SWP_HIDEWINDOW); 
            }

        }
Esempio n. 13
0
 public ParamEdit(JaguarCtrl jc)
 {
     jaguar = jc;
     InitializeComponent();
     button1.PerformClick();
 }
Esempio n. 14
0
        private void btnSetStartPoint_Click(JaguarCtrl jc, object sender, EventArgs e)
        {
            cam = new CameraInfoGE();
            double centerLat = double.Parse(centerLatitude);
            double centerLong = double.Parse(centerLongitude);
            try
            {
                centerLat = double.Parse(jc.txtStartLat.Text);
            }
            catch
            {
            }
            try
            {
                centerLong = double.Parse(jc.txtStartLong.Text);
            }
            catch
            {
            }

            centerLat = (centerLat > 90 ? 90 : centerLat);
            centerLat = (centerLat < -90 ? -90 : centerLat);

            centerLong = (centerLong > 180 ? 180 : centerLong);
            centerLong = (centerLong < -180 ? -180 : centerLong);
            cam.FocusPointLatitude = centerLat;
            cam.FocusPointLongitude = centerLong;
            cam.FocusPointAltitude = 0;
            cam.Range = cameraRange;
            cam.Tilt = 0;


            googleEarth.SetCamera(cam, 0.6);
        }
Esempio n. 15
0
 public DrRobotRobotConnection(JaguarCtrl jc)
 {
     InitializeComponent();
     controlForm = jc;
     DrRobotRobotConnection_Load();
 }
        private void connectRobot()
        {
            //save any change to xml file
            row.LaserRangeIP = txtRobotIP.Text;

            row.RobotID  = txtRobotID.Text;
            row.RobotIP  = txtRobotIP.Text;
            row.GPSIP    = txtGPSIP.Text;
            row.IMUIP    = txtGPSIP.Text;
            row.CameraIP = txtCameraIP.Text;
            //row.CameraPWD = txtCameraPWD.Text;
            row.CameraUser = txtCameraID.Text;

            try
            {
                robotConfig.WriteXml(configFile);
            }
            catch
            {
            }
            //write gateway config file
            XmlTextWriter textWriter = new XmlTextWriter("C:\\DrRobotAppFile\\gatewayConfig.xml", null);

            textWriter.WriteStartDocument();
            // Write comments
            textWriter.WriteComment("For Gateway Communication");
            // Write first element
            textWriter.WriteStartElement("GateWaySetting", "");
            // Write next element
            textWriter.WriteStartElement("RobotID", "");
            textWriter.WriteString(row.RobotID);
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotMethod", "");
            textWriter.WriteString("WiFi");
            //textWriter.WriteString("Serial");
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotCom", "");
            textWriter.WriteString("COM1");
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotIP", "");
            textWriter.WriteString(row.RobotIP);
            textWriter.WriteEndElement();
            textWriter.WriteStartElement("RobotPort", "");
            textWriter.WriteString("10001");
            textWriter.WriteEndElement();

            // Ends the document.
            textWriter.WriteEndElement();
            textWriter.WriteEndDocument();
            // close writer
            textWriter.Close();
            Thread.Sleep(1000);
            //start one gateway
            p1 = new Process();
            p1.StartInfo.FileName    = "C:\\DrRobotAppFile\\WirobotGateway.exe";
            p1.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
            p1.Start();

            Thread.Sleep(1000);
            controlForm = new JaguarCtrl(this, robotConfig);
            controlForm.Show();
        }
Esempio n. 17
0
        // Constructor for the Navigation class
        public Navigation(JaguarCtrl jc)
        {
            // Initialize vars
            jaguarControl = jc;
            realJaguar = jc.realJaguar;
            simulatedJaguar = jc.simulatedJaguar;
            map = new Map();
            particles = new Particle[numParticles];
            propagatedParticles = new Particle[numParticles];
            // Create particles
            for (int i = 0; i < numParticles; i++)
            {
                particles[i] = new Particle();
                propagatedParticles[i] = new Particle();
            }

            this.Initialize();


            // Start Control Thread
            controlThread = new Thread(new ThreadStart(runControlLoop));
            controlThread.Start();
        }
Esempio n. 18
0
 //this is a zoom function
 private void trackBarZoom_Scroll(JaguarCtrl jc, object sender, EventArgs e)
 {
     if (cam != null)
     {
         cameraRange = jc.trackBarZoom.Value;
         cam.Range = cameraRange;
         googleEarth.SetCamera(cam, 0.6);
     }
 }
 public DrRobotRobotConnection(JaguarCtrl jc)
 {
     InitializeComponent();
     controlForm = jc;
     DrRobotRobotConnection_Load();
 }
Esempio n. 20
0
        // this function will set map center as default map start point
        private void btnSetMapCenter_Click(JaguarCtrl jc, object sender, EventArgs e)
        {
            PointOnTerrainGE pointGe = new PointOnTerrainGE();
            pointGe = googleEarth.GetPointOnTerrainFromScreenCoords(0, 0);


            double lat = pointGe.Latitude;
            double longitude = pointGe.Longitude;
            jc.txtStartLat.Text = lat.ToString();
            jc.txtStartLong.Text = longitude.ToString();

            btnSetStartPoint_Click(jc, null, null);
        }