コード例 #1
0
ファイル: TargetingHUD.cs プロジェクト: hzeera/MissionPlanner
        private void Target_MouseUp(object sender, MouseEventArgs e)
        {
            tx2             = e.X;
            ty2             = e.Y;
            this.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.Target_MouseMove);

            MAVLink.mavlink_set_vision_target_box_t vision_position = new MAVLink.mavlink_set_vision_target_box_t();
            vision_position.topLeftX     = tx1;
            vision_position.topLeftY     = ty1;
            vision_position.bottomRightX = tx2;
            vision_position.bottomRightY = ty2;
            MainV2.comPort.sendPacket(vision_position);
        }
コード例 #2
0
ファイル: UAS.cs プロジェクト: hzeera/MissionPlanner
        public void runTLD()
        {
            Process TLDApp = new Process();
            TLDApp.StartInfo.UseShellExecute = false;
            TLDApp.StartInfo.RedirectStandardOutput = true;
            TLDApp.StartInfo.FileName = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\OpenTLD\opentld.exe";
            TLDApp.StartInfo.Arguments = "-s -n " + device;
            TLDApp.Start();

            string output;
            string[] splitOutput;
            while (!TLDApp.HasExited)
            {
                output = TLDApp.StandardOutput.ReadLine();
                if (output == null)
                    continue;
                splitOutput = output.Split(' ');

                int tx1 = 0;
                int ty1 = 0;
                int tx2 = 0;
                int ty2 = 0;
                try
                {
                    tx1 = Convert.ToInt32(splitOutput[1]);
                    ty1 = Convert.ToInt32(splitOutput[2]);
                    tx2 = tx1 + Convert.ToInt32(splitOutput[3]);
                    ty2 = ty1 + Convert.ToInt32(splitOutput[4]);
                }
                catch (Exception e)
                {
                    continue;
                }

                MAVLink.mavlink_set_vision_target_box_t vision_position = new MAVLink.mavlink_set_vision_target_box_t();
                vision_position.topLeftX = tx1;
                vision_position.topLeftY = ty1;
                vision_position.bottomRightX = tx2;
                vision_position.bottomRightY = ty2;
                MainV2.comPort.sendPacket(vision_position);
                //80, 160, 480, 560
                //80, 160, 340, 420
                int xStep = 0;
                int yStep = 0;

                if (tx1 < 80)
                {
                    xStep = 3;
                }
                else if (tx1 < 160)
                {
                    xStep = 1;
                }
                else if (tx2 > 560)
                {
                    xStep = -3;
                }
                else if (tx2 > 480)
                {
                    xStep = -1;
                }

                if (ty1 < 60)
                {
                    yStep = -3;
                }
                else if (ty1 < 120)
                {
                    yStep = -1;
                }
                else if (ty2 > 420)
                {
                    yStep = 3;
                }
                else if (ty2 > 360)
                {
                    yStep = 1;
                }

                controller.setStep(xStep, yStep);
            }
        }
コード例 #3
0
ファイル: TargetingHUD.cs プロジェクト: hzeera/MissionPlanner
        private void Target_MouseUp(object sender, MouseEventArgs e)
        {
            tx2 = e.X;
            ty2 = e.Y;
            this.MouseMove -= new System.Windows.Forms.MouseEventHandler(this.Target_MouseMove);

            MAVLink.mavlink_set_vision_target_box_t vision_position = new MAVLink.mavlink_set_vision_target_box_t();
            vision_position.topLeftX = tx1;
            vision_position.topLeftY = ty1;
            vision_position.bottomRightX = tx2;
            vision_position.bottomRightY = ty2;
            MainV2.comPort.sendPacket(vision_position);
        }
コード例 #4
0
ファイル: UAS.cs プロジェクト: hzeera/MissionPlanner
        public void runTLD()
        {
            Process TLDApp = new Process();

            TLDApp.StartInfo.UseShellExecute        = false;
            TLDApp.StartInfo.RedirectStandardOutput = true;
            TLDApp.StartInfo.FileName  = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\OpenTLD\opentld.exe";
            TLDApp.StartInfo.Arguments = "-s -n " + device;
            TLDApp.Start();

            string output;

            string[] splitOutput;
            while (!TLDApp.HasExited)
            {
                output = TLDApp.StandardOutput.ReadLine();
                if (output == null)
                {
                    continue;
                }
                splitOutput = output.Split(' ');

                int tx1 = 0;
                int ty1 = 0;
                int tx2 = 0;
                int ty2 = 0;
                try
                {
                    tx1 = Convert.ToInt32(splitOutput[1]);
                    ty1 = Convert.ToInt32(splitOutput[2]);
                    tx2 = tx1 + Convert.ToInt32(splitOutput[3]);
                    ty2 = ty1 + Convert.ToInt32(splitOutput[4]);
                }
                catch (Exception e)
                {
                    continue;
                }

                MAVLink.mavlink_set_vision_target_box_t vision_position = new MAVLink.mavlink_set_vision_target_box_t();
                vision_position.topLeftX     = tx1;
                vision_position.topLeftY     = ty1;
                vision_position.bottomRightX = tx2;
                vision_position.bottomRightY = ty2;
                MainV2.comPort.sendPacket(vision_position);
                //80, 160, 480, 560
                //80, 160, 340, 420
                int xStep = 0;
                int yStep = 0;

                if (tx1 < 80)
                {
                    xStep = 3;
                }
                else if (tx1 < 160)
                {
                    xStep = 1;
                }
                else if (tx2 > 560)
                {
                    xStep = -3;
                }
                else if (tx2 > 480)
                {
                    xStep = -1;
                }

                if (ty1 < 60)
                {
                    yStep = -3;
                }
                else if (ty1 < 120)
                {
                    yStep = -1;
                }
                else if (ty2 > 420)
                {
                    yStep = 3;
                }
                else if (ty2 > 360)
                {
                    yStep = 1;
                }

                controller.setStep(xStep, yStep);
            }
        }